Reverted FOREACH, NEXT and REPEAT to their original forms

This is because the changes (9fb175c9d6) possibly break some existing uses for no reason.
This commit is contained in:
ln-zookeeper 2017-03-22 19:45:21 +02:00
parent 9a288ab78c
commit 8bbe4189ed
2 changed files with 24 additions and 7 deletions

View File

@ -308,16 +308,24 @@ _"No gold carried over to the next scenario."#enddef
# wmlindent: start ignoring
#define FOREACH ARRAY_VALUE VAR
# Macro to begin a WML clause that iterates over an array.
[for]
array={ARRAY_VALUE}
variable={VAR}
{VARIABLE {VAR} 0}
[while]
[variable]
name={VAR}
less_than=${ARRAY_VALUE}.length
[/variable]
[do]
#enddef
#define NEXT VAR
# Macro to end a WML clause that iterates over an array.
[set_variable]
name={VAR}
add=1
[/set_variable]
[/do]
[/for]
[/while]
{CLEAR_VARIABLE {VAR}}
#enddef
# wmlindent: stop ignoring

View File

@ -215,13 +215,22 @@
#! {REPEAT 5 (
#! {QUAKE "rumble.ogg"}
#! )}
{VARIABLE REPEAT_i 0}
[while]
[variable]
name=REPEAT_i
less_than={NUMBER}
[/variable]
[repeat]
times={NUMBER}
[do]
{BODY_WML}
{VARIABLE_OP REPEAT_i add 1}
[/do]
[/repeat]
[/while]
{CLEAR_VARIABLE REPEAT_i}
#enddef
#define LOOKUP_INDEX FROM_ARRAY_NAME WHERE_KEY_NAME WHERE_VALUE SAVE_AS_NAME