Messenger MAI bug fix: don't try to attack with escort unit without weapon
This one was a much more serious bug than the previous one, as it could throw Wesnoth into an infinite loop.
This commit is contained in:
parent
2f56734d4e
commit
14570a0a96
1 changed files with 8 additions and 0 deletions
|
@ -98,7 +98,15 @@ return {
|
|||
local my_units = wesnoth.get_units{ side = wesnoth.current.side, formula = '$this_unit.attacks_left > 0',
|
||||
{ "not", { id = unit.id } }
|
||||
}
|
||||
|
||||
-- Eliminate units without attacks
|
||||
for i = #my_units,1,-1 do
|
||||
if (not H.get_child(my_units[i].__cfg, 'attack')) then
|
||||
table.remove(my_units, i)
|
||||
end
|
||||
end
|
||||
--print('#my_units', #my_units)
|
||||
|
||||
if (not my_units[1]) then return end
|
||||
|
||||
local my_attacks = AH.get_attacks(my_units, { simulate_combat = true })
|
||||
|
|
Loading…
Add table
Reference in a new issue