Add debug command :unit status=list,of,statuses,to,add,or,-remove

This commit is contained in:
Celtic Minstrel 2015-09-10 01:35:45 -04:00
parent 2fd07684f2
commit 617fb26238
2 changed files with 19 additions and 0 deletions

View file

@ -42,6 +42,7 @@ Version 1.13.1+dev:
as "Bridge", retaining their descriptive names in the editor as per
convention.
* User interface:
* Add "unit status=..." command to debug console to add/remove unit statuses
* GUI2:
* stacked_widget can optionally display a single layer at a time. This
may be used to implement dialogs with multiple pages or tabs.

View file

@ -422,6 +422,24 @@ SYNCED_COMMAND_HANDLER_FUNCTION(debug_unit, child, use_undo, /*show*/, /*error_
break;
}
}
} else if (name == "status" ) {
config cfg;
i->write(cfg);
resources::units->erase(loc);
config& statuses = cfg.child_or_add("status");
BOOST_FOREACH(std::string status, utils::split(value)) {
bool add = true;
if (status.length() >= 1 && status[0] == '-') {
add = false;
status = status.substr(1);
}
if (status.empty()) {
continue;
}
statuses[status] = add;
}
unit new_u(cfg, true);
resources::units->add(loc, new_u);
} else {
config cfg;
i->write(cfg);