Author: esr
Date: Wed Feb 27 00:58:43 2008
New Revision: 24100
URL: http://svn.gna.org/viewcvs/wesnoth?rev=24100&view=rev
Log:
Move some unit macros without dependencies, in order to reduce the
tangle in utils.cfg
Added:
trunk/data/core/macros/unit-utils.cfg
Modified:
trunk/data/core/macros/utils.cfg
Added: trunk/data/core/macros/unit-utils.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/core/macros/unit-utils.cfg?rev=24100&view=auto
==============================================================================
--- trunk/data/core/macros/unit-utils.cfg (added)
+++ trunk/data/core/macros/unit-utils.cfg Wed Feb 27 00:58:43 2008
@@ -1,0 +1,139 @@
+#textdomain wesnoth
+# This file contains unit utility macros for WML authors.
+#
+# These don't rely on any other macros. Please don't change this.
+
+#define GENERIC_UNIT SIDE TYPE X Y
+ # Creates a generic unit of TYPE belonging to SIDE at X,Y, which has a
+ # random name, gender and traits (just like a recruited unit).
+ [unit]
+ side={SIDE}
+ type={TYPE}
+ x={X}
+ y={Y}
+ generate_description=yes
+ random_traits=yes
+ random_gender=yes
+ upkeep=full
+ [/unit]
+#enddef
+
+#define MP_GENERIC_UNIT SIDE TYPE X Y
+ # Creates a generic unit of TYPE belonging to SIDE at X,Y, which has a
+ # random name and no traits.
+ # This can be removed and GENERIC_UNIT be used instead once random traits
+ # work in multiplayer.
+ [unit]
+ side={SIDE}
+ type={TYPE}
+ x={X}
+ y={Y}
+ generate_description=yes
+ random_traits=no
+ upkeep=full
+ [/unit]
+#enddef
+
+#define NOTRAIT_UNIT TYPE DESCRIPTION USER_DESCRIPTION SIDE X Y
+ # Creates a unit with no traits.
+ #
+ # Example:
+ #! {LOYAL_UNIT (Elvish Fighter) (Myname) ( _ "Myname") 1 19 16}
+ #
+ [unit]
+ type={TYPE}
+ description={DESCRIPTION}
+ user_description={USER_DESCRIPTION}
+ side={SIDE}
+ x={X}
+ y={Y}
+ [/unit]
+#enddef
+
+#define LOYAL_UNIT TYPE DESCRIPTION USER_DESCRIPTION SIDE X Y
+ # Creates a unit with the Loyal trait.
+ #
+ # Example:
+ #! {LOYAL_UNIT (Elvish Fighter) (Myname) ( _ "Myname") 1 19 16}
+ #
+ [unit]
+ type={TYPE}
+ description={DESCRIPTION}
+ user_description={USER_DESCRIPTION}
+ side={SIDE}
+ x={X}
+ y={Y}
+ [modifications]
+ {TRAIT_LOYAL}
+ [/modifications]
+ [/unit]
+#enddef
+
+#define UNDEAD_UNIT TYPE SIDE X Y
+ # Create a unit with the Undead and Loyal traits.
+ [unit]
+ type={TYPE}
+ side={SIDE}
+ x={X}
+ y={Y}
+ [modifications]
+ {TRAIT_UNDEAD}
+ {TRAIT_LOYAL}
+ [/modifications]
+ [/unit]
+#enddef
+
+#define RECALL_OR_CREATE TYPE DESCRIPTION
+ # A substitute for [recall] that works even when there's no-one to recall
+ # useful for testing scenarios out of order.
+ [recall]
+ description={DESCRIPTION}
+ [/recall]
+ [if]
+ [have_unit]
+ description={DESCRIPTION}
+ [/have_unit]
+ [else]
+ [store_starting_location]
+ side=1
+ variable=tmp
+ [/store_starting_location]
+ [unit]
+ type={TYPE}
+ description={DESCRIPTION}
+ side=1
+ x=$tmp.x
+ y=$tmp.y
+ [/unit]
+ [clear_variable]
+ name=tmp
+ [/clear_variable]
+ [/else]
+ [/if]
+#enddef
+
+#define STORE_UNIT_VAR FILTER VAR TO_VAR
+ # Stores an attribute of a unit to the given variable.
+ #
+ # Example where this is used to flip all orcs to whatever side James is on:
+ #! {STORE_UNIT_VAR description=James side side_of_James}
+ #! {MODIFY_UNIT race=orc side $side_of_James}
+ [store_unit]
+ [filter]
+ {FILTER}
+ [/filter]
+
+ kill=no
+ variable=STORE_UNIT_VAR_store
+ [/store_unit]
+
+ [set_variable]
+ name={TO_VAR}
+ format=$STORE_UNIT_VAR_store.{VAR}
+ [/set_variable]
+
+ [clear_variable]
+ name=STORE_UNIT_VAR_store
+ [/clear_variable]
+#enddef
+
Modified: trunk/data/core/macros/utils.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/core/macros/utils.cfg?rev=24100&r1=24099&r2=24100&view=diff
==============================================================================
--- trunk/data/core/macros/utils.cfg (original)
+++ trunk/data/core/macros/utils.cfg Wed Feb 27 00:58:43 2008
@@ -161,61 +161,10 @@
{CLEAR_VARIABLE MODIFY_UNIT_store}
#enddef
-#define STORE_UNIT_VAR FILTER VAR TO_VAR
- # Stores an attribute of a unit to the given variable.
- #
- # Example where this is used to flip all orcs to whatever side James is on:
- #! {STORE_UNIT_VAR description=James side side_of_James}
- #! {MODIFY_UNIT race=orc side $side_of_James}
- [store_unit]
- [filter]
- {FILTER}
- [/filter]
-
- kill=no
- variable=STORE_UNIT_VAR_store
- [/store_unit]
-
- {VARIABLE_OP {TO_VAR} format $STORE_UNIT_VAR_store.{VAR}}
-
- {CLEAR_VARIABLE STORE_UNIT_VAR_store}
-#enddef
-
-#define GENERIC_UNIT SIDE TYPE X Y
- # Creates a generic unit of TYPE belonging to SIDE at X,Y, which has a
- # random name, gender and traits (just like a recruited unit).
- [unit]
- side={SIDE}
- type={TYPE}
- x={X}
- y={Y}
- generate_description=yes
- random_traits=yes
- random_gender=yes
- upkeep=full
- [/unit]
-#enddef
-
-#define MP_GENERIC_UNIT SIDE TYPE X Y
- # Creates a generic unit of TYPE belonging to SIDE at X,Y, which has a
- # random name no traits.
- # This can be removed and GENERIC_UNIT be used instead once random traits
- # work in multiplayer.
- [unit]
- side={SIDE}
- type={TYPE}
- x={X}
- y={Y}
- generate_description=yes
- random_traits=no
- upkeep=full
- [/unit]
-#enddef
-
#define MOVE_UNIT FILTER TO_X TO_Y
# Moves a unit from its current location to the given location along a
- # relatively straight line displaying the movement just like
[move_unit_fake]
- # does.
+ # relatively straight line displaying the movement just like
+ # [move_unit_fake] does.
#
# Note that setting the destination on an existing unit does not kill
either
# one, but causes the unit to move to the nearest vacant hex instead.
@@ -495,85 +444,6 @@
{CLEAR_VARIABLE TRANSFER_VILLAGE_OWNERSHIP_i}
#enddef
-#define NOTRAIT_UNIT TYPE DESCRIPTION USER_DESCRIPTION SIDE X Y
- # Creates a unit with no traits.
- #
- # Example:
- #! {LOYAL_UNIT (Elvish Fighter) (Myname) ( _ "Myname") 1 19 16}
- #
- [unit]
- type={TYPE}
- description={DESCRIPTION}
- user_description={USER_DESCRIPTION}
- side={SIDE}
- x={X}
- y={Y}
- [/unit]
-#enddef
-
-#define LOYAL_UNIT TYPE DESCRIPTION USER_DESCRIPTION SIDE X Y
- # Creates a unit with the Loyal trait.
- #
- # Example:
- #! {LOYAL_UNIT (Elvish Fighter) (Myname) ( _ "Myname") 1 19 16}
- #
- [unit]
- type={TYPE}
- description={DESCRIPTION}
- user_description={USER_DESCRIPTION}
- side={SIDE}
- x={X}
- y={Y}
- [modifications]
- {TRAIT_LOYAL}
- [/modifications]
- [/unit]
-#enddef
-
-#define UNDEAD_UNIT TYPE SIDE X Y
- # Create a unit with the Undead and Loyal traits.
- [unit]
- type={TYPE}
- side={SIDE}
- x={X}
- y={Y}
- [modifications]
- {TRAIT_UNDEAD}
- {TRAIT_LOYAL}
- [/modifications]
- [/unit]
-#enddef
-
-#define RECALL_OR_CREATE TYPE DESCRIPTION
- # A substitute for [recall] that works even when there's no-one to recall
- # useful for testing scenarios out of order.
- [recall]
- description={DESCRIPTION}
- [/recall]
- [if]
- [have_unit]
- description={DESCRIPTION}
- [/have_unit]
- [else]
- [store_starting_location]
- side=1
- variable=tmp
- [/store_starting_location]
- [unit]
- type={TYPE}
- description={DESCRIPTION}
- side=1
- x=$tmp.x
- y=$tmp.y
- [/unit]
- [clear_variable]
- name=tmp
- [/clear_variable]
- [/else]
- [/if]
-#enddef
-
-
# FIXME: Documentation for these is needed.
#define MENU_IMG_TXT IMG TXT
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits