- Added a simple check for abstract weapon classes so that I can properly define

the DoomWeapon base class.
- Fixed: When the Tome of Power runs out it must also set any pending weapon
  back to their regular state.


SVN r521 (trunk)
This commit is contained in:
Christoph Oelckers 2007-04-29 08:44:32 +00:00
commit 6e5b1f1182
5 changed files with 36 additions and 17 deletions

View file

@ -4362,11 +4362,21 @@ void FinishThingdef()
if (isRuntimeActor)
{
// Do some consistency checks. If these states are undefined the weapon cannot work!
if (!ti->ActorInfo->FindState(NAME_Ready)) I_Error("Weapon %s doesn't define a ready state.\n", ti->TypeName.GetChars());
if (!ti->ActorInfo->FindState(NAME_Select)) I_Error("Weapon %s doesn't define a select state.\n", ti->TypeName.GetChars());
if (!ti->ActorInfo->FindState(NAME_Deselect)) I_Error("Weapon %s doesn't define a deselect state.\n", ti->TypeName.GetChars());
if (!ti->ActorInfo->FindState(NAME_Fire)) I_Error("Weapon %s doesn't define a fire state.\n", ti->TypeName.GetChars());
FState * ready = ti->ActorInfo->FindState(NAME_Ready);
FState * select = ti->ActorInfo->FindState(NAME_Select);
FState * deselect = ti->ActorInfo->FindState(NAME_Deselect);
FState * fire = ti->ActorInfo->FindState(NAME_Fire);
// Consider any weapon without any valid state abstract and don't output a warning
// This is for creating base classes for weapon groups that only set up some properties.
if (ready || select || deselect || fire)
{
// Do some consistency checks. If these states are undefined the weapon cannot work!
if (!ready) I_Error("Weapon %s doesn't define a ready state.\n", ti->TypeName.GetChars());
if (!select) I_Error("Weapon %s doesn't define a select state.\n", ti->TypeName.GetChars());
if (!deselect) I_Error("Weapon %s doesn't define a deselect state.\n", ti->TypeName.GetChars());
if (!fire) I_Error("Weapon %s doesn't define a fire state.\n", ti->TypeName.GetChars());
}
}
}