Don't change Scenario.Prototype on Game.txt load

C4Value used itself as temporary storage, so when loading Scenario.Prototype
into Scenario.Prototype, bad things happened.
scancodes-fix
Günther Brammer 2013-03-29 20:33:09 +01:00
parent c17c971b40
commit a0f328468e
1 changed files with 5 additions and 3 deletions

View File

@ -342,19 +342,21 @@ void C4Value::CompileFunc(StdCompiler *pComp, C4ValueNumbers * numbers)
else
{
StdStrBuf s;
C4Value temp;
pComp->Value(mkParAdapt(s, StdCompiler::RCT_ID));
if (!::ScriptEngine.GetGlobalConstant(s.getData(), this))
if (!::ScriptEngine.GetGlobalConstant(s.getData(), &temp))
pComp->excCorrupt("Cannot find global constant %s", s.getData());
while(pComp->Separator(StdCompiler::SEP_PART))
{
C4PropList * p = getPropList();
C4PropList * p = temp.getPropList();
if (!p)
pComp->excCorrupt("static proplist %s is not a proplist anymore", s.getData());
pComp->Value(mkParAdapt(s, StdCompiler::RCT_ID));
C4String * c4s = ::Strings.FindString(s.getData());
if (!c4s || !p->GetPropertyByS(c4s, this))
if (!c4s || !p->GetPropertyByS(c4s, &temp))
pComp->excCorrupt("Cannot find property %s in %s", s.getData(), GetDataString().getData());
}
Set(temp);
}
break;
}