- added compile time checks for bad state links and state label references.

- preserve a state's source line information for the postprocessing phase so that the checker can output more useful information.
- added missing check for weapon psprites to DPSprite::SetState.
This commit is contained in:
Christoph Oelckers 2016-11-15 11:21:08 +01:00
commit 96d093d01f
10 changed files with 179 additions and 45 deletions

View file

@ -300,11 +300,22 @@ void DPSprite::SetState(FState *newstate, bool pending)
if (!(newstate->UseFlags & (SUF_OVERLAY|SUF_WEAPON))) // Weapon and overlay are mostly the same, the main difference is that weapon states restrict the self pointer to class Actor.
{
auto so = FState::StaticFindStateOwner(newstate);
Printf("State %s.%d not flagged for use in overlays or weapons\n", so->TypeName.GetChars(), int(newstate - so->OwnedStates));
Printf(TEXTCOLOR_RED "State %s.%d not flagged for use in overlays or weapons\n", so->TypeName.GetChars(), int(newstate - so->OwnedStates));
State = nullptr;
Destroy();
return;
}
else if (!(newstate->UseFlags & SUF_WEAPON))
{
if (Caller->IsKindOf(RUNTIME_CLASS(AWeapon)))
{
auto so = FState::StaticFindStateOwner(newstate);
Printf(TEXTCOLOR_RED "State %s.%d not flagged for use in weapons\n", so->TypeName.GetChars(), int(newstate - so->OwnedStates));
State = nullptr;
Destroy();
return;
}
}
State = newstate;