Implemented FR #13321: added "unit advances=N"...

...command to debug console to immediately level-up active unit N
times
This commit is contained in:
Iurii Chernyi 2009-04-06 02:55:34 +00:00
parent 55ae886f8d
commit 93269b7fbc
2 changed files with 14 additions and 4 deletions

View File

@ -62,6 +62,8 @@ Version 1.7.0-svn:
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)

View File

@ -3020,10 +3020,18 @@ private:
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();
}