[world conquest] fix remaining deprecated code usage

1. Fixed an un-added entry in the changelog
2. fixed the last 2 deprecation messages
3. removed instances of `wml.parsed` as it is no longer required.
This commit is contained in:
Tahsin Jahin Khalid 2021-04-23 21:52:18 +06:00 committed by Pentarctagon
parent 73c4e19ea2
commit 45d7372e69
6 changed files with 14 additions and 15 deletions

View file

@ -34,7 +34,6 @@ email=#####
- fixed some instances of deprecated Lua
- re-added Dunefolk in selection
- re-enabled "The Empire" faction in World Conquest MP Era
- slightly reduced the overall difficulty (100% --> 75%)
- update changelog
0.8.2:

View file

@ -66,12 +66,12 @@ end
-- Like apply_to=resistance with replace=true, but never decreases resistances.
function wesnoth.effects.wc2_min_resistance(u, cfg)
local resistance_new = {}
local resistance_old = wml.parsed(wml.get_child(cfg, "resistance"))
local resistance_old = wml.get_child(cfg, "resistance")
local unit_resistance_cfg = nil
for k,v in pairs(resistance_old) do
if type(k) == "string" and type(v) == "number" then
if not unit_resistance_cfg then
unit_resistance_cfg = wml.parsed(wml.get_child(u.__cfg, "resistance"))
unit_resistance_cfg = wml.get_child(u.__cfg, "resistance")
end
if unit_resistance_cfg[k] >= v then
resistance_new[k] = v
@ -91,7 +91,7 @@ end
-- Like apply_to=defense with replace=true, but never decreases defense.
function wesnoth.effects.wc2_min_defense(u, cfg)
local defense_new = {}
local defense_old = wml.parsed(wml.get_child(cfg, "defense"))
local defense_old = wml.get_child(cfg, "defense")
for k,v in pairs(defense_old) do
if type(k) == "string" and type(v) == "number" and wesnoth.unit_defense(u, terrain_map[k] or "") >= v then
defense_new[k] = v

View file

@ -133,15 +133,15 @@ local function world_conquest_tek_map_repaint_6d()
}
else
-- this is faster.
local r8_Re = map:get_tiles_radius(
local r8_Re = map:find_in_radius(
map:find(f.terrain("Re")),
wesnoth.map.filter(f.all()),
8
8,
wesnoth.map.filter(f.all())
)
local r6_Khs = map:get_tiles_radius(
local r6_Khs = map:find_in_radius(
map:find(f.terrain("Khs")),
wesnoth.map.filter(f.all()),
6
6,
wesnoth.map.filter(f.all())
)
set_terrain { "Chs",
f.all(

View file

@ -76,7 +76,7 @@ function set_terrain_impl(data)
end
function set_terrain_simul(cfg)
cfg = wml.parsed(cfg)
cfg = cfg
local data = {}
for i, r in ipairs(cfg) do
r_new = {

View file

@ -111,8 +111,8 @@ function wct_castle_expansion_side(side_num)
if keep_loc == nil then
return
end
local castle = map:get_tiles_radius({keep_loc}, wesnoth.map.filter(f.terrain("C*,K*")), 1)
local keep_area = map:get_tiles_radius({keep_loc}, wesnoth.map.filter(f.all()), 2)
local castle = map:find_in_radius({keep_loc}, 1, wesnoth.map.filter(f.terrain("C*,K*")))
local keep_area = map:find_in_radius({keep_loc}, 2, wesnoth.map.filter(f.all()))
local candidates = get_locations {
filter = f.all(
@ -171,5 +171,5 @@ function get_oceanic()
--ignore rivers
f.adjacent(f.terrain("!,W*^*,S*^*,D*^*,Ai"), nil, "0-3")
))
return map:get_tiles_radius(water_border_tiles, filter_radius, 999)
return map:find_in_radius(water_border_tiles, 999, filter_radius)
end

View file

@ -4,7 +4,7 @@ function world_conquest_tek_map_noise_proxy(radius, fraction, terrain)
helper.shuffle(terrain_to_change)
for terrain_i = 1, math.ceil(#terrain_to_change / fraction) do
local loc_a = terrain_to_change[terrain_i]
local terrain_to_swap_b = map:get_tiles_radius({loc_a}, nop_filter, radius)
local terrain_to_swap_b = map:find_in_radius({loc_a}, radius, nop_filter)
terrain_to_swap_b = map:find(f.all(
f.none(f.is_loc(loc_a)),