commit
17d47e9b63
|
@ -76,6 +76,8 @@ CBotInstr* CBotExprVar::Compile(CBotToken*& p, CBotCStack* pStack, bool bCheckRe
|
||||||
// This is an element of the current class
|
// This is an element of the current class
|
||||||
// ads the equivalent of this. before
|
// ads the equivalent of this. before
|
||||||
CBotToken token("this");
|
CBotToken token("this");
|
||||||
|
// invisible 'this.' highlights member token on error
|
||||||
|
token.SetPos(p->GetStart(), p->GetEnd());
|
||||||
inst->SetToken(&token);
|
inst->SetToken(&token);
|
||||||
(static_cast<CBotExprVar*>(inst))->m_nIdent = -2; // identificator for this
|
(static_cast<CBotExprVar*>(inst))->m_nIdent = -2; // identificator for this
|
||||||
|
|
||||||
|
@ -196,6 +198,8 @@ CBotInstr* CBotExprVar::CompileMethode(CBotToken* &p, CBotCStack* pStack)
|
||||||
// this is an element of the current class
|
// this is an element of the current class
|
||||||
// adds the equivalent of this. before
|
// adds the equivalent of this. before
|
||||||
|
|
||||||
|
// invisible 'this.' highlights member token on error
|
||||||
|
pthis.SetPos(pp->GetStart(), pp->GetEnd());
|
||||||
inst->SetToken(&pthis);
|
inst->SetToken(&pthis);
|
||||||
(static_cast<CBotExprVar*>(inst))->m_nIdent = -2; // ident for this
|
(static_cast<CBotExprVar*>(inst))->m_nIdent = -2; // ident for this
|
||||||
|
|
||||||
|
|
|
@ -464,6 +464,7 @@ void CBotFunction::RestoreState(CBotVar** ppVars, CBotStack* &pj, CBotVar* pInst
|
||||||
{
|
{
|
||||||
CBotVar* pThis = pile->FindVar("this");
|
CBotVar* pThis = pile->FindVar("this");
|
||||||
pThis->SetInit(CBotVar::InitType::IS_POINTER);
|
pThis->SetInit(CBotVar::InitType::IS_POINTER);
|
||||||
|
pThis->SetPointer(pInstance);
|
||||||
pThis->SetUniqNum(-2);
|
pThis->SetUniqNum(-2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,6 +673,7 @@ int CBotFunction::DoCall(CBotProgram* program, const std::list<CBotFunction*>& l
|
||||||
{
|
{
|
||||||
CBotTypResult type;
|
CBotTypResult type;
|
||||||
CBotFunction* pt = nullptr;
|
CBotFunction* pt = nullptr;
|
||||||
|
CBotProgram* baseProg = pStack->GetProgram(true);
|
||||||
|
|
||||||
pt = FindLocalOrPublic(localFunctionList, nIdent, name, ppVars, type);
|
pt = FindLocalOrPublic(localFunctionList, nIdent, name, ppVars, type);
|
||||||
|
|
||||||
|
@ -695,7 +697,7 @@ int CBotFunction::DoCall(CBotProgram* program, const std::list<CBotFunction*>& l
|
||||||
|
|
||||||
if (pStk3b->GetState() == 0 && !pt->m_MasterClass.empty())
|
if (pStk3b->GetState() == 0 && !pt->m_MasterClass.empty())
|
||||||
{
|
{
|
||||||
CBotVar* pInstance = program->m_thisVar;
|
CBotVar* pInstance = (baseProg != nullptr) ? baseProg->m_thisVar : nullptr;
|
||||||
// make "this" known
|
// make "this" known
|
||||||
CBotVar* pThis ;
|
CBotVar* pThis ;
|
||||||
if ( pInstance == nullptr )
|
if ( pInstance == nullptr )
|
||||||
|
@ -762,8 +764,7 @@ void CBotFunction::RestoreCall(const std::list<CBotFunction*>& localFunctionList
|
||||||
CBotFunction* pt = nullptr;
|
CBotFunction* pt = nullptr;
|
||||||
CBotStack* pStk1;
|
CBotStack* pStk1;
|
||||||
CBotStack* pStk3;
|
CBotStack* pStk3;
|
||||||
|
CBotProgram* baseProg = pStack->GetProgram(true);
|
||||||
// search function to return the ok identifier
|
|
||||||
|
|
||||||
pt = FindLocalOrPublic(localFunctionList, nIdent, name, ppVars, type);
|
pt = FindLocalOrPublic(localFunctionList, nIdent, name, ppVars, type);
|
||||||
|
|
||||||
|
@ -792,10 +793,11 @@ void CBotFunction::RestoreCall(const std::list<CBotFunction*>& localFunctionList
|
||||||
{
|
{
|
||||||
if ( !pt->m_MasterClass.empty() )
|
if ( !pt->m_MasterClass.empty() )
|
||||||
{
|
{
|
||||||
// CBotVar* pInstance = m_pProg->m_thisVar;
|
CBotVar* pInstance = (baseProg != nullptr) ? baseProg->m_thisVar : nullptr;
|
||||||
// make "this" known
|
// make "this" known
|
||||||
CBotVar* pThis = pStk1->FindVar("this");
|
CBotVar* pThis = pStk1->FindVar("this");
|
||||||
pThis->SetInit(CBotVar::InitType::IS_POINTER);
|
pThis->SetInit(CBotVar::InitType::IS_POINTER);
|
||||||
|
pThis->SetPointer(pInstance);
|
||||||
pThis->SetUniqNum(-2);
|
pThis->SetUniqNum(-2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,8 @@ CBotLeftExpr* CBotLeftExpr::Compile(CBotToken* &p, CBotCStack* pStack)
|
||||||
// this is an element of the current class
|
// this is an element of the current class
|
||||||
// adds the equivalent of this. before
|
// adds the equivalent of this. before
|
||||||
CBotToken pthis("this");
|
CBotToken pthis("this");
|
||||||
|
// invisible 'this.' highlights member token on error
|
||||||
|
pthis.SetPos(p->GetStart(), p->GetEnd());
|
||||||
inst->SetToken(&pthis);
|
inst->SetToken(&pthis);
|
||||||
inst->m_nIdent = -2; // indent for this
|
inst->m_nIdent = -2; // indent for this
|
||||||
|
|
||||||
|
|
|
@ -518,6 +518,8 @@ void CPlayerProfile::LoadScene(std::string dir)
|
||||||
CLevelParserLine* line = levelParser.Get("Mission");
|
CLevelParserLine* line = levelParser.Get("Mission");
|
||||||
cat = GetLevelCategoryFromDir(line->GetParam("base")->AsString());
|
cat = GetLevelCategoryFromDir(line->GetParam("base")->AsString());
|
||||||
|
|
||||||
|
if (dir == "../../crashsave") LoadFinishedLevels(cat);
|
||||||
|
|
||||||
rank = line->GetParam("rank")->AsInt();
|
rank = line->GetParam("rank")->AsInt();
|
||||||
if (cat == LevelCategory::CustomLevels)
|
if (cat == LevelCategory::CustomLevels)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3689,7 +3689,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
||||||
// TODO: m_engine->TimeInit(); ??
|
// TODO: m_engine->TimeInit(); ??
|
||||||
m_input->ResetKeyStates();
|
m_input->ResetKeyStates();
|
||||||
m_time = 0.0f;
|
m_time = 0.0f;
|
||||||
m_gameTime = 0.0f;
|
if (m_sceneReadPath.empty()) m_gameTime = 0.0f;
|
||||||
m_gameTimeAbsolute = 0.0f;
|
m_gameTimeAbsolute = 0.0f;
|
||||||
m_autosaveLast = 0.0f;
|
m_autosaveLast = 0.0f;
|
||||||
m_infoUsed = 0;
|
m_infoUsed = 0;
|
||||||
|
@ -4542,6 +4542,7 @@ bool CRobotMain::IOWriteScene(std::string filename, std::string filecbot, std::s
|
||||||
else
|
else
|
||||||
line->AddParam("chap", MakeUnique<CLevelParserParam>(m_levelChap));
|
line->AddParam("chap", MakeUnique<CLevelParserParam>(m_levelChap));
|
||||||
line->AddParam("rank", MakeUnique<CLevelParserParam>(m_levelRank));
|
line->AddParam("rank", MakeUnique<CLevelParserParam>(m_levelRank));
|
||||||
|
line->AddParam("gametime", MakeUnique<CLevelParserParam>(GetGameTime()));
|
||||||
levelParser.AddLine(std::move(line));
|
levelParser.AddLine(std::move(line));
|
||||||
|
|
||||||
line = MakeUnique<CLevelParserLine>("Map");
|
line = MakeUnique<CLevelParserLine>("Map");
|
||||||
|
@ -4722,6 +4723,9 @@ CObject* CRobotMain::IOReadScene(std::string filename, std::string filecbot)
|
||||||
int objCounter = 0;
|
int objCounter = 0;
|
||||||
for (auto& line : levelParser.GetLines())
|
for (auto& line : levelParser.GetLines())
|
||||||
{
|
{
|
||||||
|
if (line->GetCommand() == "Mission")
|
||||||
|
m_gameTime = line->GetParam("gametime")->AsFloat(0.0f);
|
||||||
|
|
||||||
if (line->GetCommand() == "Map")
|
if (line->GetCommand() == "Map")
|
||||||
m_map->ZoomMap(line->GetParam("zoom")->AsFloat());
|
m_map->ZoomMap(line->GetParam("zoom")->AsFloat());
|
||||||
|
|
||||||
|
|
|
@ -1010,6 +1010,8 @@ void COldObject::Write(CLevelParserLine* line)
|
||||||
if ( m_virusTime != 0.0f )
|
if ( m_virusTime != 0.0f )
|
||||||
line->AddParam("virusTime", MakeUnique<CLevelParserParam>(m_virusTime));
|
line->AddParam("virusTime", MakeUnique<CLevelParserParam>(m_virusTime));
|
||||||
|
|
||||||
|
line->AddParam("lifetime", MakeUnique<CLevelParserParam>(m_aTime));
|
||||||
|
|
||||||
// Sets the parameters of the command line.
|
// Sets the parameters of the command line.
|
||||||
CLevelParserParamVec cmdline;
|
CLevelParserParamVec cmdline;
|
||||||
for(float value : GetCmdLine())
|
for(float value : GetCmdLine())
|
||||||
|
@ -1144,6 +1146,8 @@ void COldObject::Read(CLevelParserLine* line)
|
||||||
m_bVirusMode = line->GetParam("virusMode")->AsBool(false);
|
m_bVirusMode = line->GetParam("virusMode")->AsBool(false);
|
||||||
m_virusTime = line->GetParam("virusTime")->AsFloat(0.0f);
|
m_virusTime = line->GetParam("virusTime")->AsFloat(0.0f);
|
||||||
|
|
||||||
|
m_aTime = line->GetParam("lifetime")->AsFloat(0.0f);
|
||||||
|
|
||||||
if ( m_motion != nullptr )
|
if ( m_motion != nullptr )
|
||||||
{
|
{
|
||||||
m_motion->Read(line);
|
m_motion->Read(line);
|
||||||
|
|
Loading…
Reference in New Issue