mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 16:13:46 +01:00
Clamp player wieldindex when processing hotbar item selection (#13098)
This commit is contained in:
parent
55804c56e9
commit
fb28ca463e
@ -2133,7 +2133,6 @@ void Game::processItemSelection(u16 *new_playeritem)
|
|||||||
/* Item selection using mouse wheel
|
/* Item selection using mouse wheel
|
||||||
*/
|
*/
|
||||||
*new_playeritem = player->getWieldIndex();
|
*new_playeritem = player->getWieldIndex();
|
||||||
|
|
||||||
s32 wheel = input->getMouseWheel();
|
s32 wheel = input->getMouseWheel();
|
||||||
u16 max_item = MYMIN(PLAYER_INVENTORY_SIZE - 1,
|
u16 max_item = MYMIN(PLAYER_INVENTORY_SIZE - 1,
|
||||||
player->hud_hotbar_itemcount - 1);
|
player->hud_hotbar_itemcount - 1);
|
||||||
@ -2160,6 +2159,9 @@ void Game::processItemSelection(u16 *new_playeritem)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clamp selection again in case it wasn't changed but max_item was
|
||||||
|
*new_playeritem = MYMIN(*new_playeritem, max_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user