Update uses of eval_conditional
This commit is contained in:
parent
2ea92baa13
commit
e8381ea9da
6 changed files with 11 additions and 11 deletions
|
@ -21,7 +21,7 @@ function ca_hang_out:evaluation(cfg, data)
|
|||
|
||||
-- Otherwise check if any of the mobilize conditions are now met
|
||||
local mobilize_condition = wml.get_child(cfg, "mobilize_condition")
|
||||
if (mobilize_condition and wesnoth.eval_conditional(mobilize_condition))
|
||||
if (mobilize_condition and wml.eval_conditional(mobilize_condition))
|
||||
or (cfg.mobilize_on_gold_less_than and (wesnoth.sides[wesnoth.current.side].gold < cfg.mobilize_on_gold_less_than))
|
||||
then
|
||||
MAISD.insert_mai_self_data(data, cfg.ai_id, { mobilize_units = true })
|
||||
|
|
|
@ -7,7 +7,7 @@ function wesnoth.wml_actions.find_respawn_point(cfg)
|
|||
local respawn_point
|
||||
local radius = 1
|
||||
|
||||
if not wesnoth.eval_conditional { T.have_unit { id = respawn_near} } then
|
||||
if not wml.eval_conditional { T.have_unit { id = respawn_near} } then
|
||||
respawn_near = "Tallin"
|
||||
end
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ wml_actions["if"] = function(cfg)
|
|||
wml.error("[if] didn't find any [then], [elseif], or [else] children.")
|
||||
end
|
||||
|
||||
if wesnoth.eval_conditional(cfg) then -- evaluate [if] tag
|
||||
if wml.eval_conditional(cfg) then -- evaluate [if] tag
|
||||
for then_child in wml.child_range(cfg, "then") do
|
||||
local action = utils.handle_event_commands(then_child, "conditional")
|
||||
if action ~= "none" then break end
|
||||
|
@ -23,7 +23,7 @@ wml_actions["if"] = function(cfg)
|
|||
end
|
||||
|
||||
for elseif_child in wml.child_range(cfg, "elseif") do
|
||||
if wesnoth.eval_conditional(elseif_child) then -- we'll evaluate the [elseif] tags one by one
|
||||
if wml.eval_conditional(elseif_child) then -- we'll evaluate the [elseif] tags one by one
|
||||
for then_tag in wml.child_range(elseif_child, "then") do
|
||||
local action = utils.handle_event_commands(then_tag, "conditional")
|
||||
if action ~= "none" then break end
|
||||
|
@ -46,7 +46,7 @@ wml_actions["while"] = function( cfg )
|
|||
|
||||
-- execute [do] up to 65536 times
|
||||
for i = 1, 65536 do
|
||||
if wesnoth.eval_conditional( cfg ) then
|
||||
if wml.eval_conditional( cfg ) then
|
||||
for do_child in wml.child_range( cfg, "do" ) do
|
||||
local action = utils.handle_event_commands(do_child, "loop")
|
||||
if action == "break" then
|
||||
|
|
|
@ -319,7 +319,7 @@ end
|
|||
|
||||
function wesnoth.wml_actions.message(cfg)
|
||||
local show_if = wml.get_child(cfg, "show_if") or {}
|
||||
if not wesnoth.eval_conditional(show_if) then
|
||||
if not wml.eval_conditional(show_if) then
|
||||
log("[message] skipped because [show_if] did not pass", "debug")
|
||||
return
|
||||
end
|
||||
|
@ -337,7 +337,7 @@ function wesnoth.wml_actions.message(cfg)
|
|||
local options, option_events = {}, {}
|
||||
for option in wml.child_range(cfg, "option") do
|
||||
local condition = wml.get_child(option, "show_if") or {}
|
||||
if wesnoth.eval_conditional(condition) then
|
||||
if wml.eval_conditional(condition) then
|
||||
|
||||
-- make message= and description= equivalent for the sake of backwards compatibility
|
||||
local msg_text = ""
|
||||
|
|
|
@ -42,7 +42,7 @@ local function generate_objectives(cfg)
|
|||
|
||||
for obj in wml.child_range(cfg, "objective") do
|
||||
local show_if = wml.get_child(obj, "show_if")
|
||||
if not show_if or wesnoth.eval_conditional(show_if) then
|
||||
if not show_if or wml.eval_conditional(show_if) then
|
||||
local objective_bullet = obj.bullet or bullet
|
||||
local condition = obj.condition
|
||||
local description = obj.description or ""
|
||||
|
@ -94,7 +94,7 @@ local function generate_objectives(cfg)
|
|||
|
||||
for obj in wml.child_range(cfg, "gold_carryover") do
|
||||
local show_if = wml.get_child(obj, "show_if")
|
||||
if not show_if or wesnoth.eval_conditional(show_if) then
|
||||
if not show_if or wml.eval_conditional(show_if) then
|
||||
local gold_carryover_bullet = obj.bullet or bullet
|
||||
local r = obj.red or 255
|
||||
local g = obj.green or 255
|
||||
|
@ -128,7 +128,7 @@ local function generate_objectives(cfg)
|
|||
|
||||
for note in wml.child_range(cfg, "note") do
|
||||
local show_if = wml.get_child(note, "show_if")
|
||||
if not show_if or wesnoth.eval_conditional(show_if) then
|
||||
if not show_if or wml.eval_conditional(show_if) then
|
||||
local note_bullet = note.bullet or bullet
|
||||
local r = note.red or 255
|
||||
local g = note.green or 255
|
||||
|
|
|
@ -44,7 +44,7 @@ local function explain(current_cfg, expect, logger)
|
|||
elseif tag == "true" or tag == "false" then
|
||||
-- We don't explain these ones.
|
||||
return true
|
||||
elseif wesnoth.eval_conditional{t} == expect then
|
||||
elseif wml.eval_conditional{t} == expect then
|
||||
local explanation_args = {}
|
||||
if expect then
|
||||
explanation_args.result = "passed"
|
||||
|
|
Loading…
Add table
Reference in a new issue