mail[Wesnoth-commits] r20044 - /trunk/data/core/macros/utils.cfg


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by lari . nieminen on September 01, 2007 - 23:40:
Author: zookeeper
Date: Sat Sep  1 23:40:05 2007
New Revision: 20044

URL: http://svn.gna.org/viewcvs/wesnoth?rev=20044&view=rev
Log:
Added a macro for preventing the view from scrolling to an (AI) side's leader 
at the beginning of its turn. Also nuked the table of contents as it's out of 
date and not maintained.

Modified:
    trunk/data/core/macros/utils.cfg

Modified: trunk/data/core/macros/utils.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/core/macros/utils.cfg?rev=20044&r1=20043&r2=20044&view=diff
==============================================================================
--- trunk/data/core/macros/utils.cfg (original)
+++ trunk/data/core/macros/utils.cfg Sat Sep  1 23:40:05 2007
@@ -5,49 +5,6 @@
 # is why they live hear rather than being broken out into topic-specific 
files.
 
 # ! in comments is used in generating HTML documentation, ignore it 
otherwise.
-
-#### TABLE OF CONTENTS ####
-
-# variable operations
-
-#   RANDOM
-#   VARIABLE
-#   VARIABLE_OP
-#   CLEAR_VARIABLE
-#   FOREACH
-#   NEXT
-#   IF_TERRAIN
-#   DEBUG_MSG
-
-# scenario/campaign setup
-
-#   STARTING_VILLAGES
-#   MENU_IMG_TXT
-#   MENU_IMG_TXT2
-
-# side setup
-
-#   TURNS
-#   GOLD
-#   INCOME
-#   ATTACK_DEPTH
-#   NO_SCOUTS
-
-# in-scenario actions
-
-#   UNIT
-#   UNDEAD_UNIT
-#   CREATE_UNIT
-#   MOVE_UNIT
-#   MODIFY_UNIT
-#   STORE_UNIT_VAR
-#   PUT_TO_RECALL_LIST
-
-# utilities not intended for general use
-
-#   QUANTITY
-
-#### END OF TABLE OF CONTENTS ####
 
 #define QUANTITY ATTRIBUTE ON_EASY ON_NORMAL ON_HARD
     # Macro to define a 'quantity' differently based on difficulty levels.
@@ -359,6 +316,62 @@
     {CLEAR_VARIABLE MOVE_UNIT_path_coords_y}
 #enddef
 
+#define NO_SCROLL_TO_AI_LEADER SIDE
+# Prevents the view from scrolling to the leader of a specific AI side at the
+# beginning of its turn. Useful if that side doesn't really do anything and 
the
+# scrolling distance would be long enough to be annoying every turn (for 
example
+# on a big map). Does not work on human-controlled sides.
+    [event]
+        name=side turn
+        first_time_only=no
+        
+        [if]
+            [variable]
+                name=side_number
+                numerical_equals={SIDE}
+            [/variable]
+            
+            [then]
+                [store_unit]
+                    [filter]
+                        side={SIDE}
+                        canrecruit=1
+                    [/filter]
+                    
+                    kill=no
+                    variable=stored_side_{SIDE}_leader
+                [/store_unit]
+                
+                {MODIFY_UNIT (
+                    side={SIDE}
+                    canrecruit=1
+                ) canrecruit 0}
+            [/then]
+        [/if]
+    [/event]
+    
+    [event]
+        name=ai turn
+        first_time_only=no
+        
+        [if]
+            [variable]
+                name=side_number
+                numerical_equals={SIDE}
+            [/variable]
+            
+            [then]
+                [unstore_unit]
+                    variable=stored_side_{SIDE}_leader
+                    find_vacant=no
+                [/unstore_unit]
+                
+                {CLEAR_VARIABLE stored_side_{SIDE}_leader}
+            [/then]
+        [/if]
+    [/event]
+#enddef
+
 #define PUT_TO_RECALL_LIST FILTER
     # This places a given unit back to the recall list of the side it is on.
     # Note however, that the unit is not healed to full health, so when




Related Messages


Powered by MHonArc, Updated Sun Sep 02 00:00:17 2007