diff --git a/data/ai/lua/ai_helper.lua b/data/ai/lua/ai_helper.lua index 4c482686fe8c..02b34b327e9b 100644 --- a/data/ai/lua/ai_helper.lua +++ b/data/ai/lua/ai_helper.lua @@ -70,7 +70,7 @@ end function ai_helper.clear_labels() -- Clear all labels on a map for x, y in wesnoth.current.map:iter(true) do - wesnoth.label { x = x, y = y, text = "" } + M.add_labels { x = x, y = y, text = "" } end end @@ -111,7 +111,7 @@ function ai_helper.put_labels(map, cfg) end if (type(out) == 'number') then out = out * factor end - wesnoth.label { x = x, y = y, text = out, color = cfg.color } + M.add_labels { x = x, y = y, text = out, color = cfg.color } end) end @@ -782,7 +782,7 @@ function ai_helper.get_closest_location(hex, location_filter, unit) if unit then for _,loc in ipairs(locs) do - local movecost = unit:movement(wesnoth.current.map[loc]) + local movecost = unit:movement_on(wesnoth.current.map[loc]) if (movecost <= unit.max_moves) then return loc end end else @@ -808,7 +808,7 @@ function ai_helper.get_passable_locations(location_filter, unit) if unit then local locs = {} for _,loc in ipairs(all_locs) do - local movecost = unit:movement(wesnoth.current.map[loc]) + local movecost = unit:movement_on(wesnoth.current.map[loc]) if (movecost <= unit.max_moves) then table.insert(locs, loc) end end return locs diff --git a/data/ai/micro_ais/cas/ca_assassin_move.lua b/data/ai/micro_ais/cas/ca_assassin_move.lua index c486e3656431..1470d23b5b79 100644 --- a/data/ai/micro_ais/cas/ca_assassin_move.lua +++ b/data/ai/micro_ais/cas/ca_assassin_move.lua @@ -25,7 +25,7 @@ local function custom_cost(x, y, unit, enemy_rating_map, prefer_map) -- must return values >=1 for the a* search to work. local terrain = wesnoth.current.map[{x, y}] - local move_cost = unit:movement(terrain) + local move_cost = unit:movement_on(terrain) move_cost = move_cost + (enemy_rating_map:get(x, y) or 0) diff --git a/data/ai/micro_ais/cas/ca_goto.lua b/data/ai/micro_ais/cas/ca_goto.lua index 0b2a44ea6216..4e1c7e635908 100644 --- a/data/ai/micro_ais/cas/ca_goto.lua +++ b/data/ai/micro_ais/cas/ca_goto.lua @@ -8,7 +8,7 @@ local M = wesnoth.map local function custom_cost(x, y, unit, avoid_map, enemy_map, enemy_attack_map, multiplier) local terrain = wesnoth.current.map[{x, y}] - local move_cost = unit:movement(terrain) + local move_cost = unit:movement_on(terrain) if avoid_map and avoid_map:get(x, y) then move_cost = move_cost + AH.no_path diff --git a/data/ai/micro_ais/cas/ca_wolves_multipacks_functions.lua b/data/ai/micro_ais/cas/ca_wolves_multipacks_functions.lua index 9669751c7e73..0ab9a47a1e76 100644 --- a/data/ai/micro_ais/cas/ca_wolves_multipacks_functions.lua +++ b/data/ai/micro_ais/cas/ca_wolves_multipacks_functions.lua @@ -4,14 +4,14 @@ local M = wesnoth.map local wolves_multipacks_functions = {} function wolves_multipacks_functions.clear_label(x, y) - wesnoth.label{ x = x, y = y, text = "" } + M.add_label{ x = x, y = y, text = "" } end function wolves_multipacks_functions.put_label(x, y, text) -- For displaying the wolf pack number underneath each wolf -- Only use gray for now, but easily expandable to add a color option text = "" .. text .. "" - wesnoth.label{ x = x, y = y, text = text } + M.add_label{ x = x, y = y, text = text } end function wolves_multipacks_functions.assign_packs(cfg) diff --git a/data/campaigns/World_Conquest/lua/map/postgeneration/4F_Wild.lua b/data/campaigns/World_Conquest/lua/map/postgeneration/4F_Wild.lua index 6cd2c052d395..9a612e779235 100644 --- a/data/campaigns/World_Conquest/lua/map/postgeneration/4F_Wild.lua +++ b/data/campaigns/World_Conquest/lua/map/postgeneration/4F_Wild.lua @@ -17,7 +17,7 @@ function connected_components(locs) local todo = { loc } l_set[loc_i] = color_i while #todo ~= 0 do - for i, loc_ad in ipairs({wesnoth.map.get_adjacent_tiles(todo[1][1], todo[1][2])}) do + for i, loc_ad in ipairs({wesnoth.map.get_adjacent_hexes(todo[1][1], todo[1][2])}) do local loc_ad_i = loc_to_index(loc_ad) if l_set[loc_ad_i] then if l_set[loc_ad_i] == true then diff --git a/data/lua/helper.lua b/data/lua/helper.lua index 511c67e49849..4e7370c557ad 100644 --- a/data/lua/helper.lua +++ b/data/lua/helper.lua @@ -72,7 +72,7 @@ end -- Not deprecated because, unlike wesnoth.map.get_adjacent_tiles, -- this verifies that the locations are on the map. function helper.adjacent_tiles(x, y, with_borders) - local adj = {wesnoth.map.get_adjacent_tiles(x, y)} + local adj = {wesnoth.map.get_adjacent_hexes(x, y)} local i = 0 return function() while i < #adj do diff --git a/data/lua/wml-tags.lua b/data/lua/wml-tags.lua index 9da68b83b682..2472f3f0b72c 100644 --- a/data/lua/wml-tags.lua +++ b/data/lua/wml-tags.lua @@ -800,7 +800,7 @@ function wml_actions.label( cfg ) local new_cfg = wml.parsed( cfg ) for index, location in ipairs( wesnoth.map.find( cfg ) ) do new_cfg.x, new_cfg.y = location[1], location[2] - wesnoth.label( new_cfg ) + wesnoth.map.add_label( new_cfg ) end end