diff --git a/src/events.cpp b/src/events.cpp index 5b39d7f54..69de8cca5 100755 --- a/src/events.cpp +++ b/src/events.cpp @@ -46,6 +46,13 @@ EventManager staticEventManager; EventManager eventManager; +void EventManager::CallOnRegister() +{ + for (DStaticEventHandler* handler = FirstEventHandler; handler; handler = handler->next) + { + handler->OnRegister(); + } +} bool EventManager::RegisterHandler(DStaticEventHandler* handler) { diff --git a/src/events.h b/src/events.h index 79c75023a..7608dfa1a 100755 --- a/src/events.h +++ b/src/events.h @@ -240,6 +240,8 @@ struct EventManager ~EventManager() { Shutdown(); } bool ShouldCallStatic(bool forplay); + // for use after loading a savegame. The old handler explicitly reinstalled all handlers instead of doing a list deserialization which resulted in OnRegister being called even when a save was loaded. + void CallOnRegister(); // register bool RegisterHandler(DStaticEventHandler* handler); // unregister diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index 7421185ee..b7584bb1d 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -994,6 +994,7 @@ void FLevelLocals::Serialize(FSerializer &arc, bool hubload) // [ZZ] serialize events arc("firstevent", localEventManager->FirstEventHandler) ("lastevent", localEventManager->LastEventHandler); + localEventManager->CallOnRegister(); Thinkers.SerializeThinkers(arc, hubload); arc("polyobjs", Polyobjects); SerializeSubsectors(arc, "subsectors");