Add ability to bypass strict no-disabled-events assertion when writing events
This is since the Gamestate Inspector can be invoked mid-event (using [inspect]) and it makes use of write_events().
This commit is contained in:
parent
ea739324df
commit
60aee8face
3 changed files with 7 additions and 4 deletions
|
@ -132,11 +132,14 @@ void manager::add_events(const config::const_child_itors& cfgs, const std::strin
|
|||
}
|
||||
}
|
||||
|
||||
void manager::write_events(config& cfg) const
|
||||
void manager::write_events(config& cfg, bool strict) const
|
||||
{
|
||||
for(const handler_ptr& eh : event_handlers_->get_active()) {
|
||||
if(eh && !eh->is_menu_item()) {
|
||||
assert(!eh->disabled());
|
||||
if(strict) {
|
||||
assert(!eh->disabled());
|
||||
}
|
||||
|
||||
cfg.add_child("event", eh->get_config());;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
|
||||
void add_events(const config::const_child_itors& cfgs, const std::string& type = std::string());
|
||||
|
||||
void write_events(config& cfg) const;
|
||||
void write_events(config& cfg, bool strict = true) const;
|
||||
|
||||
using event_func_t = std::function<void(game_events::manager&, handler_ptr&)>;
|
||||
void execute_on_events(const std::string& event_id, event_func_t func);
|
||||
|
|
|
@ -509,7 +509,7 @@ const display_context& single_mode_controller::dc() const {
|
|||
event_mode_controller::event_mode_controller(gamestate_inspector::controller& c)
|
||||
: single_mode_controller(c)
|
||||
{
|
||||
single_mode_controller::events().write_events(events);
|
||||
single_mode_controller::events().write_events(events, false);
|
||||
}
|
||||
|
||||
void variable_mode_controller::show_list(tree_view_node& node)
|
||||
|
|
Loading…
Add table
Reference in a new issue