aboutsummaryrefslogtreecommitdiff
path: root/src/client/game.cpp
diff options
context:
space:
mode:
authoriliekprogrammar <iliekprogrammar@gmail.com>2023-01-08 13:03:16 +0000
committerGitHub <noreply@github.com>2023-01-08 14:03:16 +0100
commitfb28ca463ea2762b43fe0d94955f6ede4df72f38 (patch)
tree7af9f805b1b3829075920fd4823e6553e88b0627 /src/client/game.cpp
parent55804c56e9485659c912bf965761187b9ec0597f (diff)
downloadminetest-fb28ca463ea2762b43fe0d94955f6ede4df72f38.tar.xz
Clamp player wieldindex when processing hotbar item selection (#13098)
Diffstat (limited to 'src/client/game.cpp')
-rw-r--r--src/client/game.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/client/game.cpp b/src/client/game.cpp
index cf0117046..56d4ae13e 100644
--- a/src/client/game.cpp
+++ b/src/client/game.cpp
@@ -2133,7 +2133,6 @@ void Game::processItemSelection(u16 *new_playeritem)
/* Item selection using mouse wheel
*/
*new_playeritem = player->getWieldIndex();
-
s32 wheel = input->getMouseWheel();
u16 max_item = MYMIN(PLAYER_INVENTORY_SIZE - 1,
player->hud_hotbar_itemcount - 1);
@@ -2160,6 +2159,9 @@ void Game::processItemSelection(u16 *new_playeritem)
break;
}
}
+
+ // Clamp selection again in case it wasn't changed but max_item was
+ *new_playeritem = MYMIN(*new_playeritem, max_item);
}