Author: crab
Date: Mon Apr  6 04:55:34 2009
New Revision: 34578

URL: http://svn.gna.org/viewcvs/wesnoth?rev=34578&view=rev
Log:
Implemented FR #13321: added "unit advances=N" command to debug console
to immediately level-up active unit N times

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

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=34578&r1=34577&r2=34578&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Mon Apr  6 04:55:34 2009
@@ -62,6 +62,8 @@
      plus some other unwanted changes there (bug #13243)
    * Making the game return to the add-on install dialog just before
      installing one, and with its entry selected
+   * Implemented FR #13321: added "unit advances=N" command to debug console
+     to immediately level-up selected unit N times
  * WML Engine:
    * Added [show_objectives] tag (part of bug #13042)
    * Made moveto events set $x2,$y2 to the source hex. (bug #13140)

Modified: trunk/src/menu_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/menu_events.cpp?rev=34578&r1=34577&r2=34578&view=diff
==============================================================================
--- trunk/src/menu_events.cpp (original)
+++ trunk/src/menu_events.cpp Mon Apr  6 04:55:34 2009
@@ -3020,10 +3020,18 @@
                        command_failed("Invalid alignment: '" + value + "', 
needs to be one of lawful, neutral or chaotic.");
                        return;
                }
-               config cfg;
-               i->second.write(cfg);
-               cfg[name] = value;
-               i->second = 
unit(&menu_handler_.units_,&menu_handler_.map_,&menu_handler_.status_,&menu_handler_.teams_,cfg);
+               if (name == "advances" ){
+                       int int_value = lexical_cast<int>(value);
+                       for (int levels=0; levels<int_value; levels++) {
+                               i->second.get_experience( 
i->second.max_experience() - i->second.experience() );
+                               dialogs::advance_unit(menu_handler_.map_, 
menu_handler_.units_,i->first,*menu_handler_.gui_);
+                       }
+               } else {
+                       config cfg;
+                       i->second.write(cfg);
+                       cfg[name] = value;
+                       i->second = 
unit(&menu_handler_.units_,&menu_handler_.map_,&menu_handler_.status_,&menu_handler_.teams_,cfg);
+               }
                menu_handler_.gui_->invalidate(i->first);
                menu_handler_.gui_->invalidate_unit();
        }


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

Reply via email to