Refactor STARTING_VILLAGES and STARTING_VILLAGES_AREA...
...so the capture code is available outside prestart events, e.g. when an allied side is subsumed and you want the player to get its villages as well as its units.
This commit is contained in:
parent
d4095df821
commit
eaf04d8ef4
1 changed files with 24 additions and 34 deletions
|
@ -366,6 +366,27 @@
|
|||
{CLEAR_VARIABLE PUT_TO_RECALL_LIST_temp}
|
||||
#enddef
|
||||
|
||||
#define CAPTURE_VILLAGES SIDE X Y RADIUS
|
||||
# Change ownership of all villages near a specified location.
|
||||
[store_locations]
|
||||
terrain=*^V*
|
||||
[and]
|
||||
x,y={X},{Y}
|
||||
radius={RADIUS}
|
||||
[/and]
|
||||
variable=temp_target_villages
|
||||
[/store_locations]
|
||||
|
||||
{FOREACH temp_target_villages i}
|
||||
[capture_village]
|
||||
side={SIDE}
|
||||
x,y=$temp_target_villages[$i].x,$temp_target_villages[$i].y
|
||||
[/capture_village]
|
||||
{NEXT i}
|
||||
|
||||
{CLEAR_VARIABLE temp_target_villages}
|
||||
#enddef
|
||||
|
||||
#define STARTING_VILLAGES SIDE RADIUS
|
||||
# Macro to make a side start a scenario with villages
|
||||
[event]
|
||||
|
@ -376,23 +397,8 @@
|
|||
variable=temp_starting_location
|
||||
[/store_starting_location]
|
||||
|
||||
[store_locations]
|
||||
terrain=*^V*
|
||||
[and]
|
||||
x,y=$temp_starting_location.x,$temp_starting_location.y
|
||||
radius={RADIUS}
|
||||
[/and]
|
||||
variable=temp_starting_villages
|
||||
[/store_locations]
|
||||
|
||||
{FOREACH temp_starting_villages i}
|
||||
[capture_village]
|
||||
side={SIDE}
|
||||
x,y=$temp_starting_villages[$i].x,$temp_starting_villages[$i].y
|
||||
[/capture_village]
|
||||
{NEXT i}
|
||||
|
||||
{CLEAR_VARIABLE temp_starting_villages,temp_starting_location}
|
||||
{CAPTURE_VILLAGES {SIDE} $temp_starting_location.x $temp_starting_location.y {RADIUS}}
|
||||
{CLEAR_VARIABLE temp_starting_location}
|
||||
[/event]
|
||||
#enddef
|
||||
|
||||
|
@ -401,23 +407,7 @@
|
|||
[event]
|
||||
name=prestart
|
||||
|
||||
[store_locations]
|
||||
terrain=*^V*
|
||||
[and]
|
||||
x,y={X},{Y}
|
||||
radius={RADIUS}
|
||||
[/and]
|
||||
variable=temp_starting_villages_area
|
||||
[/store_locations]
|
||||
|
||||
{FOREACH temp_starting_villages_area i}
|
||||
[capture_village]
|
||||
side={SIDE}
|
||||
x,y=$temp_starting_villages_area[$i].x,$temp_starting_villages_area[$i].y
|
||||
[/capture_village]
|
||||
{NEXT i}
|
||||
|
||||
{CLEAR_VARIABLE temp_starting_villages_area}
|
||||
{CAPTURE_VILLAGES {SIDE} {X} {Y} {RADIUS}}
|
||||
[/event]
|
||||
#enddef
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue