Game Events: don't write disabled events to config
This should help mitigate an odd issue some people have reported with 1.13.11. After reloading a save *after* executing a first_time_only=yes event, they can execute the event again. Looking at savefiles for one of the reports, the event was included in the savefile even though it had already executed. Most likely, when the player reloaded, the event was re-added to the gamestate and they could execute it again. The questions is then why the event had never been removed in handler cleanup. I'll have to look into that further, but this at least ensures we don't get dead events written to config (that includes saved games).
This commit is contained in:
parent
390df50ebc
commit
a46ddf9bcd
1 changed files with 2 additions and 4 deletions
|
@ -108,11 +108,9 @@ void manager::add_events(const config::const_child_itors& cfgs, const std::strin
|
|||
void manager::write_events(config& cfg) const
|
||||
{
|
||||
for(const handler_ptr& eh : event_handlers_->get_active()) {
|
||||
if(!eh || eh->is_menu_item()) {
|
||||
continue;
|
||||
if(eh && !eh->is_menu_item() && !eh->disabled()) {
|
||||
cfg.add_child("event", eh->get_config());;
|
||||
}
|
||||
|
||||
cfg.add_child("event", eh->get_config());
|
||||
}
|
||||
|
||||
cfg["unit_wml_ids"] = utils::join(unit_wml_ids_);
|
||||
|
|
Loading…
Add table
Reference in a new issue