wc: mapgen: move get_scenario_data to seperate function

it was just a one liner but a rather complicated one
This commit is contained in:
gfgtdf 2023-03-25 05:09:38 +01:00
parent cf19f4f686
commit c75fa8b4cb

View file

@ -31,6 +31,10 @@ local function get_map_generator(scenario_data)
end
end
local function get_scenario_data(nplayers, scenario_num)
return wesnoth.dofile(string.format("./scenarios/WC_II_%dp_scenario%d.lua", nplayers, scenario_num))
end
function wc_ii_generate_scenario(nplayers, gen_args)
nplayers = settings.nplayers or nplayers
@ -38,7 +42,8 @@ function wc_ii_generate_scenario(nplayers, gen_args)
local scenario_num = settings.scenario_num or wml.variables.wc2_scenario or 1
--todo: does this work properly in the first scenario?
local enemy_stength = wml.variables["wc2_difficulty.enemy_power"] or 6
local scenario_data = wesnoth.dofile(string.format("./scenarios/WC_II_%dp_scenario%d.lua", nplayers, scenario_num))
std_print("test_nplayers", wml.variables.test_nplayers)
local scenario_data = get_scenario_data(nplayers, scenario_num)
local prestart_event = { name = "prestart" }
-- our [scenario] skeleton