| 606 | } |
| 607 | |
| 608 | void *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 | //========================================================================== |
nothing calls this directly
no test coverage detected