Fix bounds-checking on marker pages

This commit is contained in:
Hugues Ross 2020-06-27 13:45:44 -04:00
parent d3ea1cc54b
commit f528ac78bd
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -226,7 +226,7 @@ local function scan_internal()
end end
local biome,height = get_biome(startpos, endpos); local biome,height = get_biome(startpos, endpos);
if biome ~= nil then if biome ~= nil then
register_tile(chunk_x, chunk_z, biome, height, true) register_tile(chunk_x, chunk_z, biome, height, true)
end end