mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- restored calling OnRegister for event handlers after loading a savegame
It should be said in no uncertain terms that OnRegister operates on an uninitialized level so it should only be used for setting up the registering process of the event handler itself and nothing else - not even the event handler's data!!!
This commit is contained in:
parent
ddc67fb1bc
commit
0422f40d80
3 changed files with 10 additions and 0 deletions
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue