diff --git a/data/lua/core.lua b/data/lua/core.lua index 87d392f1c2de..ee82497f14ab 100644 --- a/data/lua/core.lua +++ b/data/lua/core.lua @@ -834,11 +834,10 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then end get_map()[loc] = new_ter end) - wesnoth.get_map_size = wesnoth.deprecate_api('wesnoth.get_map_size', 'wesnoth.map.get().width,height,border_size', 1, nil, function() + wesnoth.get_map_size = wesnoth.deprecate_api('wesnoth.get_map_size', 'wesnoth.map.get().playable_width,playable_height,border_size', 1, nil, function() local m = get_map() - local border = m.border_size - return m.width - 2 * border, m.height - 2 * border, border - end, 'Note: width and height on map.get() return the size including the border, while get_map_size() returns the size excluding the border') + return m.playable_width, m.playable_height, m.border_size + end) wesnoth.special_locations = wesnoth.deprecate_api('wesnoth.special_locations', 'wesnoth.map.get():special_locations', 1, nil, setmetatable({}, { __index = function(_, k) return get_map().special_locations[k] end, __newindex = function(_, k, v) get_map().special_locations[k] = v end, diff --git a/src/scripting/lua_terrainmap.cpp b/src/scripting/lua_terrainmap.cpp index 9b4e147c1a3c..1e3de1645ad2 100644 --- a/src/scripting/lua_terrainmap.cpp +++ b/src/scripting/lua_terrainmap.cpp @@ -306,6 +306,8 @@ static int impl_terrainmap_get(lua_State *L) // Find the corresponding attribute. return_int_attrib("width", tm.total_width()); return_int_attrib("height", tm.total_height()); + return_int_attrib("playable_width", tm.w()); + return_int_attrib("playable_height", tm.h()); return_int_attrib("border_size", tm.border_size()); return_string_attrib("data", tm.to_string());