Fix bounds-checking on marker pages
This commit is contained in:
parent
d3ea1cc54b
commit
f528ac78bd
@ -279,9 +279,9 @@ minetest.register_on_player_receive_fields(function(player, name, fields)
|
|||||||
audio.play_feedback("cartographer_write", player);
|
audio.play_feedback("cartographer_write", player);
|
||||||
show_map_formspec(map, pos.x, pos.z, player:get_player_name(), data.page);
|
show_map_formspec(map, pos.x, pos.z, player:get_player_name(), data.page);
|
||||||
elseif k == "prev_button" then
|
elseif k == "prev_button" then
|
||||||
show_map_formspec(map, pos.x, pos.z, player:get_player_name(), data.height_mode, data.page - 1);
|
show_map_formspec(map, pos.x, pos.z, player:get_player_name(), data.height_mode, math.max(data.page - 1, 1));
|
||||||
elseif k == "next_button" then
|
elseif k == "next_button" then
|
||||||
show_map_formspec(map, pos.x, pos.z, player:get_player_name(), data.height_mode, data.page + 1);
|
show_map_formspec(map, pos.x, pos.z, player:get_player_name(), data.height_mode, math.min(data.page + 1, math.ceil(markers.count() / 20)));
|
||||||
elseif k == "height_button" then
|
elseif k == "height_button" then
|
||||||
show_map_formspec(map, pos.x, pos.z, player:get_player_name(), not data.height_mode, data.page);
|
show_map_formspec(map, pos.x, pos.z, player:get_player_name(), not data.height_mode, data.page);
|
||||||
elseif k == "quit" then
|
elseif k == "quit" then
|
||||||
|
Loading…
Reference in New Issue
Block a user