Use PField instead of PSymbolVariable for SetMapThingUserData()

This commit is contained in:
Randy Heit 2013-08-21 22:51:12 -05:00
parent 5aff8156ba
commit 6aee7833d0
1 changed files with 3 additions and 3 deletions

View File

@ -1686,18 +1686,18 @@ static void SetMapThingUserData(AActor *actor, unsigned udi)
{ {
FName varname = MapThingsUserData[udi].Property; FName varname = MapThingsUserData[udi].Property;
int value = MapThingsUserData[udi].Value; int value = MapThingsUserData[udi].Value;
PSymbolVariable *var = dyn_cast<PSymbolVariable>(actor->GetClass()->Symbols.FindSymbol(varname, true)); PField *var = dyn_cast<PField>(actor->GetClass()->Symbols.FindSymbol(varname, true));
udi++; udi++;
if (var == NULL || var->bUserVar || var->ValueType.Type != VAL_Int) if (var == NULL || (var->Flags & VARF_Native) || !var->Type->IsKindOf(RUNTIME_CLASS(PBasicType)))
{ {
DPrintf("%s is not a user variable in class %s\n", varname.GetChars(), DPrintf("%s is not a user variable in class %s\n", varname.GetChars(),
actor->GetClass()->TypeName.GetChars()); actor->GetClass()->TypeName.GetChars());
} }
else else
{ // Set the value of the specified user variable. { // Set the value of the specified user variable.
*(int *)(reinterpret_cast<BYTE *>(actor) + var->offset) = value; var->Type->SetValue(reinterpret_cast<BYTE *>(actor) + var->Offset, value);
} }
} }
} }