mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-25 19:10:26 +00:00
Fix non-serializable events being serialized as an empty [event] tag
This commit is contained in:
parent
865eface07
commit
72249b1bb3
@ -184,7 +184,11 @@ void manager::write_events(config& cfg, bool include_nonserializable) const
|
||||
assert(!eh->disabled());
|
||||
}
|
||||
|
||||
eh->write_config(cfg.add_child("event"), include_nonserializable);
|
||||
config event_cfg;
|
||||
eh->write_config(event_cfg, include_nonserializable);
|
||||
if(!event_cfg.empty()) {
|
||||
cfg.add_child("event", std::move(event_cfg));
|
||||
}
|
||||
}
|
||||
|
||||
cfg["unit_wml_ids"] = utils::join(unit_wml_ids_);
|
||||
|
@ -73,6 +73,9 @@ public:
|
||||
|
||||
void add_events(const config::const_child_itors& cfgs, game_lua_kernel& lk, const std::string& type = std::string());
|
||||
|
||||
// Normally non-serializable events are skipped when serializing (with a warning).
|
||||
// If include_nonserializable is true, the game attempts to serialize them anyway.
|
||||
// This will produce output that kind of looks like the event but would not deserialize to the same event.
|
||||
void write_events(config& cfg, bool include_nonserializable=false) const;
|
||||
|
||||
using event_func_t = std::function<void(game_events::manager&, handler_ptr&)>;
|
||||
|
Loading…
x
Reference in New Issue
Block a user