anonymous patch: add set_var and show_var commands to debug mode

This commit is contained in:
Jérémy Rosen 2006-12-03 09:29:30 +00:00
parent fb21593d37
commit 557743b1f0
2 changed files with 11 additions and 0 deletions

View file

@ -116,6 +116,8 @@ Version 1.3-svn:
* removed manpages (outdated): Hungarian.
* other:
* --validcache runtime switch to force assumption that cache is valid
* add two new debug command set_var and show_var to check variables within
the game easily
* Python AI
* Added various input validations
* Set Python errors upon error

View file

@ -1781,6 +1781,15 @@ namespace events{
game_config::debug = true;
} else if(cmd == "nodebug") {
game_config::debug = false;
} else if(game_config::debug && cmd == "set_var") {
const std::string::const_iterator j = std::find(data.begin(),data.end(),'=');
if(j != data.end()) {
const std::string name(data.begin(),j);
const std::string value(j+1,data.end());
gamestate_.set_variable(name,value);
}
} else if(game_config::debug && cmd == "show_var") {
gui::show_dialog(*gui_,NULL,"",gamestate_.get_variable(data),gui::MESSAGE);
} else if(game_config::debug && cmd == "unit") {
const unit_map::iterator i = current_unit(mousehandler);
if(i != units_.end()) {