- Fixed: FWeaponSlot::PickWeapon() wrapped around improperly when the starting

value for i was 0.


SVN r1750 (trunk)
This commit is contained in:
Randy Heit 2009-08-04 23:19:09 +00:00
parent 00f88610ac
commit be9830f219
2 changed files with 7 additions and 3 deletions

View File

@ -1,4 +1,8 @@
August 3, 2009 (Changes by Graf Zahl)
August 4, 2009
- Fixed: FWeaponSlot::PickWeapon() wrapped around improperly when the starting
value for i was 0.
August 3, 2009 (Changes by Graf Zahl)
- Added kgsws's SummonActor enhancement and bumped netgame and demo versions
because this submission changes an existing command.

View File

@ -776,9 +776,9 @@ AWeapon *FWeaponSlot::PickWeapon(player_t *player)
player->ReadyWeapon->SisterWeapon != NULL &&
player->ReadyWeapon->SisterWeapon->GetClass() == Weapons[i].Type))
{
for (j = (unsigned)(i - 1) % Weapons.Size();
for (j = (i == 0 ? Weapons.Size() - 1 : i - 1);
j != i;
j = (unsigned)(j + Weapons.Size() - 1) % Weapons.Size()) // + Weapons.Size is to avoid underflows
j = (j == 0 ? Weapons.Size() - 1 : j - 1))
{
AWeapon *weap = static_cast<AWeapon *> (player->mo->FindInventory(Weapons[j].Type));