Skip to content

Commit

Permalink
- added validation for presence of drop item classes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-lysiuk authored and coelckers committed Jul 11, 2019
1 parent 8efe18b commit b7e0a8d
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/scripting/thingdef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,27 @@ static void CheckStates(PClassActor *obj)
}
}

void CheckDropItems(const PClassActor *const obj)
{
const FDropItem *dropItem = obj->ActorInfo()->DropItems;

while (dropItem != nullptr)
{
if (dropItem->Name != NAME_None)
{
const char *const dropItemName = dropItem->Name.GetChars();

if (dropItemName[0] != '\0' && PClass::FindClass(dropItem->Name) == nullptr)
{
Printf(TEXTCOLOR_ORANGE "Undefined drop item class %s referenced from actor %s\n", dropItemName, obj->TypeName.GetChars());
FScriptPosition::WarnCounter++;
}
}

dropItem = dropItem->Next;
}
}

//==========================================================================
//
// LoadActors
Expand Down Expand Up @@ -500,6 +521,8 @@ void LoadActors()
// PASSMOBJ is irrelevant for normal missiles, but not for bouncers.
defaults->flags2 |= MF2_PASSMOBJ;
}

CheckDropItems(ti);
}
if (FScriptPosition::ErrorCounter > 0)
{
Expand Down

0 comments on commit b7e0a8d

Please sign in to comment.