mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-02 16:54:20 +00:00
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(). (cherry-picked from commit afaa75842c8914406bed75d3557ec241b0de9b6a)
This commit is contained in:
parent
d422f2172c
commit
2220078c65
@ -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…
x
Reference in New Issue
Block a user