Switch mine type if only alternate mine is available

v0.58.1 did this, but the functionality was accidentally removed in
859b399d20.  Restore it.

Fixes: 859b399d20 ("Use mask for Secondary_last_was_super")
This commit is contained in:
Kp 2021-01-17 22:23:22 +00:00
parent b51da25a42
commit c7680621a8

View file

@ -262,11 +262,19 @@ int which_bomb()
const auto bomb = (Secondary_last_was_super & mask) ? SMART_MINE_INDEX : PROXIMITY_INDEX;
auto &secondary_ammo = player_info.secondary_ammo;
if (secondary_ammo[bomb] == 0 &&
secondary_ammo[SMART_MINE_INDEX + PROXIMITY_INDEX - bomb] != 0)
if (secondary_ammo[bomb])
/* Player has the requested bomb type available. Use it. */
return bomb;
const auto alt_bomb = SMART_MINE_INDEX + PROXIMITY_INDEX - bomb;
if (secondary_ammo[alt_bomb])
{
/* Player has the alternate bomb type, but not the requested
* bomb type. Switch.
*/
Secondary_last_was_super ^= mask;
return alt_bomb;
}
/* Player has no bombs of either type. */
return bomb;
}
#endif