mail[Wesnoth-commits] r44026 - in /trunk: changelog src/menu_events.cpp


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

Header


Content

Posted by shadowm2006 on July 09, 2010 - 00:55:
Author: shadowmaster
Date: Fri Jul  9 00:55:00 2010
New Revision: 44026

URL: http://svn.gna.org/viewcvs/wesnoth?rev=44026&view=rev
Log:
Implement :turn_limit command (debug only) to change the turn limit in
middle of a scenario.

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

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=44026&r1=44025&r2=44026&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Fri Jul  9 00:55:00 2010
@@ -201,6 +201,7 @@
    * Fix rare layer's order bug about unit drawn above big south-west unit
    * Improvements to make Wesnoth compile better with g++-4.5 in C++-0x mode
    * Added ":undiscover" to clear all your discovered units from help
+   * Added ":turn_limit" to change the turn limit for a scenario in debug 
mode
    * Fix a crash when a sighted event killed a unit just before a fight
    * Fixed bug #16171: Disable commands during [animate_unit]
 

Modified: trunk/src/menu_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/menu_events.cpp?rev=44026&r1=44025&r2=44026&view=diff
==============================================================================
--- trunk/src/menu_events.cpp (original)
+++ trunk/src/menu_events.cpp Fri Jul  9 00:55:00 2010
@@ -2370,6 +2370,7 @@
                void do_next_level();
                void do_choose_level();
                void do_turn();
+               void do_turn_limit();
                void do_debug();
                void do_nodebug();
                void do_lua();
@@ -2458,6 +2459,8 @@
                        register_alias("choose_level", "cl");
                        register_command("turn", &console_handler::do_turn,
                                _("Change turn number (and time of day)"), 
_("[turn]"), "D");
+                       register_command("turn_limit", 
&console_handler::do_turn_limit,
+                               _("Change turn limit"), _("[limit]"), "D");
                        register_command("debug", &console_handler::do_debug,
                                _("Turn debug mode on."));
                        register_command("nodebug", 
&console_handler::do_nodebug,
@@ -3186,6 +3189,16 @@
        menu_handler_.gui_->redraw_everything();
 }
 
+void console_handler::do_turn_limit()
+{
+       tod_manager& tod_man = *resources::tod_manager;
+       int limit =
+               get_data().empty() ? -1 : 
lexical_cast_default<int>(get_data(), 1);
+       tod_man.add_turns(-tod_man.number_of_turns());
+       tod_man.add_turns(lexical_cast_default<int>(limit,-1));
+       menu_handler_.gui_->redraw_everything();
+}
+
 void console_handler::do_debug() {
        if (network::nconnections() == 0) {
                print(get_cmd(), _("Debug mode activated!"));




Related Messages


Powered by MHonArc, Updated Fri Jul 09 01:00:09 2010