Skip to content

Commit

Permalink
SotA S21: Fix #1706
Browse files Browse the repository at this point in the history
Improve speed & readability of code and a comment fix.
  • Loading branch information
sigurdfdragon committed May 25, 2017
1 parent ea5dc13 commit eba9672
Showing 1 changed file with 13 additions and 16 deletions.
Expand Up @@ -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]
Expand All @@ -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]
Expand Down Expand Up @@ -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]
Expand Down

3 comments on commit eba9672

@Vultraz
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FTR you don't need to paste the whole link in the commit message. You can simply put "fixes #1706" and it would refer to the issue automatically.

@Vultraz
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though perhaps you did and it's the IRC bot who expanded it. In which case disregard.

@sigurdfdragon
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure I had the whole link. Thanks for the tip.

Please sign in to comment.