Author: shadowmaster
Date: Tue Aug 12 20:24:48 2008
New Revision: 28498

URL: http://svn.gna.org/viewcvs/wesnoth?rev=28498&view=rev
Log:
* Disallow [modify_turns] from changing to a earlier turn

Modified:
    trunk/src/game_events.cpp

Modified: trunk/src/game_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_events.cpp?rev=28498&r1=28497&r2=28498&view=diff
==============================================================================
--- trunk/src/game_events.cpp (original)
+++ trunk/src/game_events.cpp Tue Aug 12 20:24:48 2008
@@ -811,8 +811,9 @@
                if(!current.empty()) {
                        const int new_turn_number = 
lexical_cast_default<int>(current,1);
                        const unsigned int new_turn_number_u = 
static_cast<unsigned int>(new_turn_number);
-                       if(new_turn_number < 1 || new_turn_number > 
status_ptr->number_of_turns()) {
-                               ERR_NG << "attempted to change current turn 
number to one out of range (" << new_turn_number << ")\n";
+                       const unsigned int current_turn_number = 
status_ptr->turn();
+                       if(new_turn_number < current_turn_number || 
new_turn_number > status_ptr->number_of_turns()) {
+                               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 != status_ptr->turn()) {
                                status_ptr->set_turn(new_turn_number_u);
                                (screen)->new_turn();


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

Reply via email to