mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 13:11:33 +00:00
- Fixed: The Heretic "take weapons" cheat did not remove all the weapons at
once. This is because destroying one weapon has a potential to destroy a sister weapon as well. If the sister weapon is the next one in line (as it typically is), it would process that one, not realizing it was no longer part of the inventory, and stop because its Inventory link was NULL. SVN r1610 (trunk)
This commit is contained in:
parent
e637fe3ea7
commit
4e5d5d0f2e
1 changed files with 13 additions and 9 deletions
|
@ -391,10 +391,13 @@ void cht_DoCheat (player_t *player, int cheat)
|
|||
{
|
||||
return;
|
||||
}
|
||||
// Take away all weapons that are either non-wimpy or use ammo.
|
||||
for (item = player->mo->Inventory; item != NULL; )
|
||||
{
|
||||
AInventory *next = item->Inventory;
|
||||
// Take away all weapons that are either non-wimpy or use ammo.
|
||||
AInventory **invp = &player->mo->Inventory, **lastinvp;
|
||||
for (item = *invp; item != NULL; item = *invp)
|
||||
{
|
||||
lastinvp = invp;
|
||||
invp = &(*invp)->Inventory;
|
||||
if (item->IsKindOf (RUNTIME_CLASS(AWeapon)))
|
||||
{
|
||||
AWeapon *weap = static_cast<AWeapon *> (item);
|
||||
|
@ -402,9 +405,10 @@ void cht_DoCheat (player_t *player, int cheat)
|
|||
weap->AmmoType1 != NULL)
|
||||
{
|
||||
item->Destroy ();
|
||||
invp = lastinvp;
|
||||
}
|
||||
}
|
||||
}
|
||||
item = next;
|
||||
}
|
||||
msg = GStrings("TXT_CHEATIDKFA");
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue