mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- fixed handling of dummy flags.
This commit is contained in:
parent
d6b781312c
commit
f4789bdefc
3 changed files with 20 additions and 16 deletions
|
@ -530,8 +530,8 @@ FFlagDef *FindFlag (const PClass *type, const char *part1, const char *part2, bo
|
|||
{
|
||||
forInternalFlags.fieldsize = 4;
|
||||
forInternalFlags.name = "";
|
||||
forInternalFlags.flagbit = field->bitval >= 0? 1 << field->bitval : DEPF_UNUSED;
|
||||
forInternalFlags.structoffset = field->bitval >= 0 ? field->Offset->Offset : -1;
|
||||
forInternalFlags.flagbit = field->Offset? 1 << field->bitval : DEPF_UNUSED;
|
||||
forInternalFlags.structoffset = field->Offset? (int)field->Offset->Offset : -1;
|
||||
forInternalFlags.varflags = 0;
|
||||
return &forInternalFlags;
|
||||
}
|
||||
|
@ -548,8 +548,8 @@ FFlagDef *FindFlag (const PClass *type, const char *part1, const char *part2, bo
|
|||
{
|
||||
forInternalFlags.fieldsize = 4;
|
||||
forInternalFlags.name = "";
|
||||
forInternalFlags.flagbit = field->bitval >= 0 ? 1 << field->bitval : DEPF_UNUSED;
|
||||
forInternalFlags.structoffset = field->bitval >= 0 ? field->Offset->Offset : -1;
|
||||
forInternalFlags.flagbit = field->Offset ? 1 << field->bitval : DEPF_UNUSED;
|
||||
forInternalFlags.structoffset = field->Offset ? (int)field->Offset->Offset : -1;
|
||||
forInternalFlags.varflags = 0;
|
||||
return &forInternalFlags;
|
||||
}
|
||||
|
|
|
@ -1468,15 +1468,19 @@ bool ZCCCompiler::CompileFlagDefs(PClass *type, TArray<ZCC_FlagDef *> &Propertie
|
|||
}
|
||||
else
|
||||
{
|
||||
field = dyn_cast<PField>(type->FindSymbol(referenced, true));
|
||||
if (field == nullptr)
|
||||
if (referenced != NAME_None)
|
||||
{
|
||||
Error(p, "Variable %s not found in %s", referenced.GetChars(), type->TypeName.GetChars());
|
||||
}
|
||||
if (!field->Type->isInt() || field->Type->Size != 4)
|
||||
{
|
||||
Error(p, "Variable %s in %s must have a size of 4 bytes for use as flag storage", referenced.GetChars(), type->TypeName.GetChars());
|
||||
field = dyn_cast<PField>(type->FindSymbol(referenced, true));
|
||||
if (field == nullptr)
|
||||
{
|
||||
Error(p, "Variable %s not found in %s", referenced.GetChars(), type->TypeName.GetChars());
|
||||
}
|
||||
if (!field->Type->isInt() || field->Type->Size != 4)
|
||||
{
|
||||
Error(p, "Variable %s in %s must have a size of 4 bytes for use as flag storage", referenced.GetChars(), type->TypeName.GetChars());
|
||||
}
|
||||
}
|
||||
else field = nullptr;
|
||||
|
||||
|
||||
FString qualifiedname;
|
||||
|
@ -1498,7 +1502,7 @@ bool ZCCCompiler::CompileFlagDefs(PClass *type, TArray<ZCC_FlagDef *> &Propertie
|
|||
}
|
||||
}
|
||||
|
||||
if (p->BitValue >= 0)
|
||||
if (field != nullptr)
|
||||
type->VMType->AddNativeField(FStringf("b%s", name.GetChars()), TypeSInt32, field->Offset, 0, 1 << p->BitValue);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,10 +80,10 @@ class Weapon : StateProvider
|
|||
flagdef CheatNotWeapon: WeaponFlags, 18; // Give cheat considers this not a weapon (used by Sigil)
|
||||
|
||||
// no-op flags
|
||||
flagdef NoLMS: WeaponFlags, -1;
|
||||
flagdef Allow_With_Respawn_Invul: WeaponFlags, -1;
|
||||
flagdef BFG: WeaponFlags, -1;
|
||||
flagdef Explosive: WeaponFlags, -1;
|
||||
flagdef NoLMS: none, 0;
|
||||
flagdef Allow_With_Respawn_Invul: none, 0;
|
||||
flagdef BFG: none, 0;
|
||||
flagdef Explosive: none, 0;
|
||||
|
||||
Default
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue