Skip to content

Commit

Permalink
Rename wesnoth.map.get_locations -> wesnoth.map.find_locations
Browse files Browse the repository at this point in the history
Also rename get_hexes -> find_hexes

This is more consistent with the terminology in the units and side modules, where find takes a filter and returns a list but get takes a unique identifier and returns a single element.
  • Loading branch information
CelticMinstrel committed Feb 17, 2021
1 parent 6f5d14a commit c50b03c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions data/lua/core.lua
Expand Up @@ -744,8 +744,8 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
return setmetatable({x = x, y = y}, hex_mt)
end

function wesnoth.map.get_hexes(cfg)
local hexes = wesnoth.map.get_locations(cfg)
function wesnoth.map.find_hexes(cfg)
local hexes = wesnoth.map.find_locations(cfg)
for i = 1, #hexes do
hexes[i] = wesnoth.map.get_hex(hexes[i].x, hexes[i].y)
end
Expand Down Expand Up @@ -1003,7 +1003,7 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
wesnoth.label = wesnoth.deprecate_api('wesnoth.label', 'wesnoth.map.add_label', 1, nil, wesnoth.map.add_label)
wesnoth.add_time_area = wesnoth.deprecate_api('wesnoth.add_time_area', 'wesnoth.map.place_area', 1, nil, wesnoth.map.place_area)
wesnoth.remove_time_area = wesnoth.deprecate_api('wesnoth.remove_time_are', 'wesnoth.map.remove_area', 1, nil, wesnoth.map.remove_area)
wesnoth.get_locations = wesnoth.deprecate_api('wesnoth.get_locations', 'wesnoth.map.get_locations', 1, nil, wesnoth.map.get_locations)
wesnoth.get_locations = wesnoth.deprecate_api('wesnoth.get_locations', 'wesnoth.map.find_locations', 1, nil, wesnoth.map.find_locations)
wesnoth.get_villages = wesnoth.deprecate_api('wesnoth.get_locations', 'wesnoth.map.get_locations', 1, nil, function(cfg)
return wesnoth.map.get_locations{
gives_income = true,
Expand Down
2 changes: 1 addition & 1 deletion src/scripting/game_lua_kernel.cpp
Expand Up @@ -4148,7 +4148,7 @@ game_lua_kernel::game_lua_kernel(game_state & gs, play_controller & pc, reports
{"place_area", &dispatch<&game_lua_kernel::intf_add_time_area>},
{"remove_area", &dispatch<&game_lua_kernel::intf_remove_time_area>},
// Filters
{"get_locations", &dispatch<&game_lua_kernel::intf_get_locations>},
{"find_locations", &dispatch<&game_lua_kernel::intf_get_locations>},
{"match_location", &dispatch<&game_lua_kernel::intf_match_location>},
{ nullptr, nullptr }
};
Expand Down

0 comments on commit c50b03c

Please sign in to comment.