MCPcopy Create free account
hub / github.com/ZDoom/Raze / ScriptVar

Method ScriptVar

source/common/objects/dobject.cpp:608–625  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

606}
607
608void *DObject::ScriptVar(FName field, PType *type)
609{
610 auto cls = GetClass();
611 auto sym = dyn_cast<PField>(cls->FindSymbol(field, true));
612 if (sym && (sym->Type == type || type == nullptr))
613 {
614 if (!(sym->Flags & VARF_Meta))
615 {
616 return (((char*)this) + sym->Offset);
617 }
618 else
619 {
620 return (cls->Meta + sym->Offset);
621 }
622 }
623 // This is only for internal use so I_Error is fine.
624 I_Error("Variable %s not found in %s\n", field.GetChars(), cls->TypeName.GetChars());
625}
626
627
628//==========================================================================

Callers

nothing calls this directly

Calls 3

I_ErrorFunction · 0.85
FindSymbolMethod · 0.45
GetCharsMethod · 0.45

Tested by

no test coverage detected