From 2bc6df7678a5c8fdb2c92f589b3d6376a46b8407 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sat, 25 Mar 2023 22:05:06 +1100 Subject: [PATCH] - Exhumed: Repair signedness issue with weapon change code. * Never revealed itself when I was cheating to get weapons. * Fixes #898 --- source/games/exhumed/src/player.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index 7f012f01c..f8790b033 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -1511,12 +1511,10 @@ static void updatePlayerAction(Player* const pPlayer) pPlayer->bIsFiring = !!(pPlayer->input.actions & SB_FIRE); // Handle player pressing number keys to change weapon - if (auto newWeap = pPlayer->input.getNewWeapon()) + const unsigned newWeap = pPlayer->input.getNewWeapon() - 1; + if (pPlayer->nPlayerWeapons & (1 << newWeap)) { - if (pPlayer->nPlayerWeapons & (1 << (newWeap--))) - { - SetNewWeapon(pPlayer->nPlayer, newWeap); - } + SetNewWeapon(pPlayer->nPlayer, newWeap); } } else // player is mummified