diff --git a/data/campaigns/Delfadors_Memoirs/utils/sides.cfg b/data/campaigns/Delfadors_Memoirs/utils/sides.cfg index f581899b6758..6e6cef32eade 100644 --- a/data/campaigns/Delfadors_Memoirs/utils/sides.cfg +++ b/data/campaigns/Delfadors_Memoirs/utils/sides.cfg @@ -516,13 +516,16 @@ y=18 [/unstore_unit] {CLEAR_VARIABLE chantal_store} - {FOREACH delfador_elvish_veterans i} - [unstore_unit] - variable=delfador_elvish_veterans[$i] - find_vacant=yes - x,y=2,19 - [/unstore_unit] - {NEXT i} + [foreach] + array=delfador_elvish_veterans + [do] + [unstore_unit] + variable=this_item + find_vacant=yes + x,y=2,19 + [/unstore_unit] + [/do] + [/foreach] [clear_variable] name=delfador_elvish_veterans [/clear_variable] diff --git a/data/scenario-test.cfg b/data/scenario-test.cfg index 4c5352c84266..0975d3788990 100644 --- a/data/scenario-test.cfg +++ b/data/scenario-test.cfg @@ -1312,22 +1312,28 @@ My best advancement costs $next_cost gold and I’m $experience|% there." variable=unit_reach [/store_reachable_locations] - {FOREACH unit_reach i} - [item] - x,y=$unit_reach[$i].x,$unit_reach[$i].y - image=misc/waypoint.png - [/item] - {NEXT i} + [foreach] + array=unit_reach + [do] + [item] + x,y=$this_item.x,$this_item.y + image=misc/waypoint.png + [/item] + [/do] + [/foreach] [event] name=select,side turn,moveto - {FOREACH unit_reach i} - [remove_item] - x,y=$unit_reach[$i].x,$unit_reach[$i].y - image="misc/waypoint.png" - [/remove_item] - {NEXT i} + [foreach] + array=unit_reach + [do] + [remove_item] + x,y=$this_item.x,$this_item.y + image=misc/waypoint.png + [/remove_item] + [/do] + [/foreach] [redraw] [/redraw] @@ -1368,12 +1374,15 @@ My best advancement costs $next_cost gold and I’m $experience|% there." [event] name=select,side turn,moveto - {FOREACH unit_reach i} - [remove_item] - x,y=$unit_reach[$i].x,$unit_reach[$i].y - image="misc/waypoint.png~CS(255,-127,-127)" - [/remove_item] - {NEXT i} + [foreach] + array=unit_reach + [do] + [remove_item] + x,y=$this_item.x,$this_item.y + image="misc/waypoint.png~CS(255,-127,-127)" + [/remove_item] + [/do] + [/foreach] [redraw] [/redraw] @@ -1720,12 +1729,15 @@ Also, 0..9 = $below_ten, one,two,three = $ascii and the bonus answer is $mixed." [/variable] [/not] [then] - {FOREACH territory i} - [capture_village] - side=$territory[$i].owner_side - x,y=$territory[$i].x,$territory[$i].y - [/capture_village] - {NEXT i} + [foreach] + array=territory + [do] + [capture_village] + side=$this_item.owner_side + x,y=$this_item.x,$this_item.y + [/capture_village] + [/do] + [/foreach] [/then] [/if] {CLEAR_VARIABLE store} @@ -3652,12 +3664,15 @@ unplagueable: $wml_unit.status.unplagueable" variable=temp_villages_area [/store_locations] - {FOREACH temp_villages_area i} - [capture_village] - side=2 - x,y=$temp_villages_area[$i].x,$temp_villages_area[$i].y - [/capture_village] - {NEXT i} + [foreach] + array=temp_villages_area + [do] + [capture_village] + side=2 + x,y=$this_item.x,$this_item.y + [/capture_village] + [/do] + [/foreach] # Then put goblins on the northernmost villages diff --git a/data/test/scenarios/characterize_pathfinding.cfg b/data/test/scenarios/characterize_pathfinding.cfg index c6ab20da0f50..88aa5a72316b 100644 --- a/data/test/scenarios/characterize_pathfinding.cfg +++ b/data/test/scenarios/characterize_pathfinding.cfg @@ -92,10 +92,13 @@ [else] {CHECK_ANSWER path.movement_cost} #{CHECK_ANSWER path.required_turns} Comment this out -- there may be multiple shortest paths, so finding a different shortest path is okay. - #{FOREACH path.steps step} - # {CHECK_ANSWER (path.steps[$step|].x)} - # {CHECK_ANSWER (path.steps[$step|].y)} - #{NEXT step} + #[foreach] + # array=path.steps + # [do] + # {CHECK_ANSWER (this_item.x)} + # {CHECK_ANSWER (this_item.y)} + # [do] + #[foreach] [/else] )} #enddef @@ -380,10 +383,13 @@ [/store_reachable_locations] {VARIABLE nlocs $r.length} {CHECK_ANSWER nlocs} - {FOREACH r i} - {CHECK_ANSWER (r[$i|].x)} - {CHECK_ANSWER (r[$i|].y)} - {NEXT i} + [foreach] + array=r + [do] + {CHECK_ANSWER (this_item.x)} + {CHECK_ANSWER (this_item.y)} + [/do] + [/foreach] #enddef #define MAKE_SHORT_TEST ID MACRO INIT_MACRO INIT_COUNTER