Author: shadowmaster
Date: Sat Jul 19 03:23:51 2008
New Revision: 28085
URL: http://svn.gna.org/viewcvs/wesnoth?rev=28085&view=rev
Log:
* Apply patch #1063 from AI0867 (ADVANCE_UNIT macro for advancing arbitrary
units to arbitrary types)
Modified:
trunk/data/core/macros/unit-utils.cfg
trunk/data/scenario-test.cfg
Modified: trunk/data/core/macros/unit-utils.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/core/macros/unit-utils.cfg?rev=28085&r1=28084&r2=28085&view=diff
==============================================================================
--- trunk/data/core/macros/unit-utils.cfg (original)
+++ trunk/data/core/macros/unit-utils.cfg Sat Jul 19 03:23:51 2008
@@ -121,3 +121,49 @@
name=STORE_UNIT_VAR_store
[/clear_variable]
#enddef
+
+#define ADVANCE_UNIT FILTER ADVANCETO
+ # Advances all units matching the filter to ADVANCETO or if missing, their
normal advancement
+ #
+ # Example to advance all spearmen to a cavalrymen:
+ #! {ADVANCE_UNIT type=Spearman Cavalryman}
+ # Example to advance your leader normally:
+ #! {ADVANCE_UNIT side,canrecruit=1,yes ""}
+ [store_unit]
+ [filter]
+ {FILTER}
+ [/filter]
+ variable=ADVANCE_UNIT_store
+ kill=no
+ [/store_unit]
+ [set_variable]
+ name=advanceto_len
+ string_length={ADVANCETO}
+ [/set_variable]
+
+ {FOREACH ADVANCE_UNIT_store i}
+ [if]
+ [variable]
+ name=advanceto_len
+ greater_than=0
+ [/variable]
+ [then]
+ [set_variable]
+ name=ADVANCE_UNIT_store[$i].advances_to
+ value={ADVANCETO}
+ [/set_variable]
+ [/then]
+ [/if]
+ [set_variable]
+ name=ADVANCE_UNIT_store[$i].experience
+ value=$ADVANCE_UNIT_store[$i].max_experience
+ [/set_variable]
+ [unstore_unit]
+ variable=ADVANCE_UNIT_store[$i]
+ find_vacant=no
+ advance=true
+ [/unstore_unit]
+ {NEXT i}
+ {CLEAR_VARIABLE ADVANCE_UNIT_store}
+ {CLEAR_VARIABLE advanceto_len}
+#enddef
Modified: trunk/data/scenario-test.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/scenario-test.cfg?rev=28085&r1=28084&r2=28085&view=diff
==============================================================================
--- trunk/data/scenario-test.cfg (original)
+++ trunk/data/scenario-test.cfg Sat Jul 19 03:23:51 2008
@@ -1001,6 +1001,21 @@
[/standing_anim]
[/effect]
[/object]
+ [/event]
+
+ [label]
+ x,y=5,5
+ text="promotions"
+ [/label]
+
+ [event]
+ name=moveto
+ first_time_only=no
+ [filter]
+ x=5
+ y=5
+ [/filter]
+ {ADVANCE_UNIT x,y=5,5 (Grand Marshal,Yeti,Fire Dragon) }
[/event]
# Capture connected villages near 13,2 for team 2
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits