WC: Fix invest dialog

This commit is contained in:
Celtic Minstrel 2021-03-31 00:45:14 -04:00
parent 7fa0e1aa16
commit ea2d74580f
2 changed files with 5 additions and 2 deletions

View file

@ -137,7 +137,7 @@ function wc2_invest.invest()
local deserters_available = stringx.split(side.variables["wc2.deserters"] or "")
local trainings_available = wc2_training.list_available(side_num, {2,3,4,5,6})
local gold_available = true
for i =1,2 do
for i = 1,2 do
local is_local = false
local res = wesnoth.synchronize_choice(_"WC2 Invest", function()
is_local = true

View file

@ -154,7 +154,7 @@ function wc2_show_invest_dialog_impl(args)
page.info_label.label = _"Gives 70 gold and places a village on your keep."
end
function root_node.on_modified()
local function set_result()
local selected = root_node.selected_item_path
local selected_data = index_map[table.concat(selected, '_')]
if selected_data ~= nil then
@ -162,6 +162,9 @@ function wc2_show_invest_dialog_impl(args)
end
res = selected_data.res
end
root_node.on_modified = set_result
set_result()
end
local d_res = gui.show_dialog(dialog_wml, preshow)
return d_res, res