mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-27 06:12:19 +00:00
- fixed: Since the serializing code cannot distinguish between user variables of the same name coming from different actors in an inheritance chain, this kind of name duplication must be prohibited.
This commit is contained in:
parent
44683657f2
commit
cbf72fe992
1 changed files with 11 additions and 0 deletions
|
@ -374,6 +374,8 @@ static void ParseUserVariable (FScanner &sc, PSymbolTable *symt, PClass *cls)
|
|||
FScriptPosition::ErrorCounter++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
FName symname = sc.String;
|
||||
if (sc.CheckToken('['))
|
||||
{
|
||||
|
@ -391,6 +393,15 @@ static void ParseUserVariable (FScanner &sc, PSymbolTable *symt, PClass *cls)
|
|||
}
|
||||
sc.MustGetToken(';');
|
||||
|
||||
// We must ensure that we do not define duplicates, even when they come from a parent table.
|
||||
if (symt->FindSymbol(symname, true) != NULL)
|
||||
{
|
||||
sc.ScriptMessage ("'%s' is already defined in '%s' or one of its ancestors.",
|
||||
symname.GetChars(), cls ? cls->TypeName.GetChars() : "Global");
|
||||
FScriptPosition::ErrorCounter++;
|
||||
return;
|
||||
}
|
||||
|
||||
PSymbolVariable *sym = new PSymbolVariable(symname);
|
||||
sym->offset = cls->Extend(sizeof(int) * (valuetype.Type == VAL_Array ? valuetype.size : 1));
|
||||
sym->ValueType = valuetype;
|
||||
|
|
Loading…
Reference in a new issue