mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Clamp hotbar selection to slots that exist (#14869)
This commit is contained in:
parent
39c2af9710
commit
98e51a0159
8 changed files with 51 additions and 11 deletions
|
@ -2188,12 +2188,14 @@ void Game::processItemSelection(u16 *new_playeritem)
|
|||
{
|
||||
LocalPlayer *player = client->getEnv().getLocalPlayer();
|
||||
|
||||
*new_playeritem = player->getWieldIndex();
|
||||
u16 max_item = player->getMaxHotbarItemcount();
|
||||
if (max_item == 0)
|
||||
return;
|
||||
max_item -= 1;
|
||||
|
||||
/* Item selection using mouse wheel
|
||||
*/
|
||||
*new_playeritem = player->getWieldIndex();
|
||||
u16 max_item = MYMIN(PLAYER_INVENTORY_SIZE - 1,
|
||||
player->hud_hotbar_itemcount - 1);
|
||||
|
||||
s32 wheel = input->getMouseWheel();
|
||||
if (!m_enable_hotbar_mouse_wheel)
|
||||
wheel = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue