Author: sapient
Date: Sat Apr  7 23:32:52 2007
New Revision: 16680

URL: http://svn.gna.org/viewcvs/wesnoth?rev=16680&view=rev
Log:
new [store_turns] tag to store the number of turns remaining

Modified:
    trunk/changelog
    trunk/src/game_events.cpp

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=16680&r1=16679&r2=16680&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Sat Apr  7 23:32:52 2007
@@ -68,6 +68,7 @@
  * WML engine
    * new [own_village] condition to check if someone own a particular village
    * new [store_villages] tag to store village locations
+   * new [store_turns] tag to store the number of turns remaining
    * all [store_*] tags get a default variable name
    * use complex variable substitution almost everywhere
    * new key for [set_variable], literal=, to avoid variable substitution

Modified: trunk/src/game_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_events.cpp?rev=16680&r1=16679&r2=16680&view=diff
==============================================================================
--- trunk/src/game_events.cpp (original)
+++ trunk/src/game_events.cpp Sat Apr  7 23:32:52 2007
@@ -744,7 +744,16 @@
                        status_ptr->add_turns(-status_ptr->number_of_turns());
                        
status_ptr->add_turns(lexical_cast_default<int>(value,50));
                }
-
+       }
+       else if(cmd == "store_turns") {
+               std::string var_name = cfg["variable"];
+               if(var_name.empty()) {
+                       var_name = cmd.substr(cmd.find_first_of('_') + 1);
+               }
+               wassert(state_of_game != NULL);
+               wassert(status_ptr != NULL);
+               int turns = status_ptr->number_of_turns();
+               state_of_game->get_variable(var_name) = 
lexical_cast_default<std::string>(turns,"");
        }
 
        //moving a 'unit' - i.e. a dummy unit that is just moving for


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to