mail[Wesnoth-commits] r28989 - in /trunk: changelog src/game_events.cpp src/play_controller.cpp


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

Header


Content

Posted by shadowm2006 on August 26, 2008 - 00:02:
Author: shadowmaster
Date: Tue Aug 26 00:01:59 2008
New Revision: 28989

URL: http://svn.gna.org/viewcvs/wesnoth?rev=28989&view=rev
Log:
* (details in changelog diff)
  * Fixed 3 bugs related to [modify_turns]
  * Fixed turn_at or [modify_turns] current= on prestart/start
    events breaking havoc all over the place
  * Fixed initial-turn autosave detection to take real start turn
    into account.

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

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=28989&r1=28988&r2=28989&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Tue Aug 26 00:01:59 2008
@@ -33,8 +33,15 @@
    * Changed the behavior of [modify_turns] value= to default to -1
      (no turn limit) instead of 50 if an invalid string is passed instead
      of a number.
+   * Fixed [modify_turns] causing weird behavior when used in prestart
+     or start events to change current turn.
    * Fixed [modify_turns] giving the unwanted side-effect of changing
-     turn limit when only current= modifier was used.=
+     turn limit when only current= modifier was used.
+   * Fixed [modify_turns] not updating $turn_number when current= was
+     used.
+   * Fixed a few inconsistencies related to scenarios which are not at
+     turn 1 at the beginning (namely start autosave detection and initial
+     triggering of a matching "turn *" event).
    * Removed the compiler work arounds for MSVC6.
    * Added some more compiler workarounds for MSVC9.
 

Modified: trunk/src/game_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_events.cpp?rev=28989&r1=28988&r2=28989&view=diff
==============================================================================
--- trunk/src/game_events.cpp (original)
+++ trunk/src/game_events.cpp Tue Aug 26 00:01:59 2008
@@ -814,6 +814,7 @@
                                ERR_NG << "attempted to change current turn 
number to one out of range (" << new_turn_number << ") or less than current 
turn\n";
                        } else if(new_turn_number_u != current_turn_number) {
                                status_ptr->set_turn(new_turn_number_u);
+                               state_of_game->set_variable("turn_number", 
str_cast<size_t>(new_turn_number_u));
                                (screen)->new_turn();
                        }
                }

Modified: trunk/src/play_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/play_controller.cpp?rev=28989&r1=28988&r2=28989&view=diff
==============================================================================
--- trunk/src/play_controller.cpp (original)
+++ trunk/src/play_controller.cpp Tue Aug 26 00:01:59 2008
@@ -373,13 +373,17 @@
        if (execute){
                update_locker lock_display(gui_->video());
                game_events::fire("prestart");
+               // prestart event may modify start turn with WML, reflect any 
changes.
+               start_turn_ = status_.turn();
        }
 }
 
 void play_controller::fire_start(bool execute){
        if(execute) {
                game_events::fire("start");
-               gamestate_.set_variable("turn_number", "1");
+               // start event may modify start turn with WML, reflect any 
changes.
+               start_turn_ = status_.turn();
+               gamestate_.set_variable("turn_number", 
str_cast<size_t>(start_turn_));
                first_turn_ = true;
        } else {
                first_turn_ = false;
@@ -423,7 +427,7 @@
        */
        bool real_side_change = true;
        if(first_turn_) {
-               game_events::fire("turn 1");
+               game_events::fire("turn " + str_cast<size_t>(start_turn_));
                game_events::fire("new turn");
                game_events::fire("side turn");
                first_turn_ = false;
@@ -794,7 +798,7 @@
                                        } else {
                                                newsaves.push_back(name);
                                        }
-                                       if (turn == 1) {
+                                       if (turn == start_turn_) {
                                                newitems.push_back(_("Back to 
start"));
                                        } else {
                                                newitems.push_back(_("Back to 
turn ") + lexical_cast<std::string>(turn));




Related Messages


Powered by MHonArc, Updated Tue Aug 26 09:40:53 2008