- scriptified the basic attack functions, its properties and the explosion properties to test the new metadata system.

This commit is contained in:
Christoph Oelckers 2017-02-28 10:51:32 +01:00
commit b6a1fe7fc6
10 changed files with 102 additions and 201 deletions

View file

@ -623,12 +623,20 @@ DEFINE_ACTION_FUNCTION(DObject, MSTime)
void *DObject::ScriptVar(FName field, PType *type)
{
auto sym = dyn_cast<PField>(GetClass()->Symbols.FindSymbol(field, true));
auto cls = GetClass();
auto sym = dyn_cast<PField>(cls->Symbols.FindSymbol(field, true));
if (sym && (sym->Type == type || type == nullptr))
{
return (((char*)this) + sym->Offset);
if (!(sym->Flags & VARF_Meta))
{
return (((char*)this) + sym->Offset);
}
else
{
return (cls->Meta + sym->Offset);
}
}
// This is only for internal use so I_Error is fine.
I_Error("Variable %s not found in %s\n", field.GetChars(), GetClass()->TypeName.GetChars());
I_Error("Variable %s not found in %s\n", field.GetChars(), cls->TypeName.GetChars());
return nullptr;
}