mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-20 16:15:40 +00:00
SotA S21: Fix https://github.com/wesnoth/wesnoth/issues/1706
Improve speed & readability of code and a comment fix.
This commit is contained in:
parent
ea5dc137ed
commit
eba967234c
@ -236,6 +236,9 @@ We finally made it out of the mountains. We crossed the Ford of Abez late this m
|
||||
[store_unit]
|
||||
[filter]
|
||||
side=1
|
||||
[not]
|
||||
x,y="recall","recall"
|
||||
[/not]
|
||||
[/filter]
|
||||
variable=side1_units
|
||||
[/store_unit]
|
||||
@ -244,42 +247,36 @@ We finally made it out of the mountains. We crossed the Ford of Abez late this m
|
||||
# adjacent to the enemy leader to see if one matches one of those locations.
|
||||
[for]
|
||||
array=side1_units
|
||||
variable=unit
|
||||
variable=u
|
||||
[do]
|
||||
[store_reachable_locations]
|
||||
[filter]
|
||||
id=$side1_units[$unit].id
|
||||
id=$side1_units[$u].id
|
||||
[/filter]
|
||||
moves=max
|
||||
variable=reachable_locations
|
||||
[/store_reachable_locations]
|
||||
[for]
|
||||
array=adjacent_to_leader
|
||||
variable=adjacent
|
||||
variable=a
|
||||
[do]
|
||||
[if]
|
||||
[have_location]
|
||||
# If an enemy unit can reach this hex...
|
||||
x=$adjacent_to_leader[$adjacent].x
|
||||
y=$adjacent_to_leader[$adjacent].y
|
||||
x=$adjacent_to_leader[$a].x
|
||||
y=$adjacent_to_leader[$a].y
|
||||
find_in=reachable_locations
|
||||
[/have_location]
|
||||
[and]
|
||||
# ...and we haven't already stored this unit...
|
||||
[have_unit]
|
||||
id=$side1_units[$unit].id
|
||||
[not]
|
||||
find_in=close_units
|
||||
[/not]
|
||||
[/have_unit]
|
||||
[/and]
|
||||
[then]
|
||||
# ...then add it to the close_units list:
|
||||
[set_variables]
|
||||
name=close_units
|
||||
mode=append
|
||||
to_variable=side1_units[$unit]
|
||||
to_variable=side1_units[$u]
|
||||
[/set_variables]
|
||||
[break]
|
||||
# So we don't store the unit again.
|
||||
[/break]
|
||||
[/then]
|
||||
[/if]
|
||||
[/do]
|
||||
@ -423,7 +420,7 @@ We finally made it out of the mountains. We crossed the Ford of Abez late this m
|
||||
|
||||
# If the AI got just a couple units, they would go off to die one at a time. We
|
||||
# finish filling up the keep so that doesn't happen. Also, this will make leader
|
||||
# assassination by backstabbing shadows or nightguants very difficult. We will
|
||||
# assassination by backstabbing shadows or nightgaunts very difficult. We will
|
||||
# do nothing if side 1 wasn't nearby, and no extra units were added. In that case,
|
||||
# the leader will just recruit as normal.
|
||||
[store_unit]
|
||||
|
Loading…
x
Reference in New Issue
Block a user