From 765bc2db3980345ddf7ec7c8a753233e1ba98435 Mon Sep 17 00:00:00 2001 From: ZZYZX Date: Tue, 31 Jan 2017 06:24:39 +0200 Subject: [PATCH] Made map-section handlers in MAPINFO not static. Static now unambiguously means 'global from GameInfo'. --- src/events.cpp | 16 +++++++--------- src/events.h | 3 --- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/events.cpp b/src/events.cpp index d9c489f8d..c9aba1660 100755 --- a/src/events.cpp +++ b/src/events.cpp @@ -23,8 +23,7 @@ bool E_RegisterHandler(DStaticEventHandler* handler) if (handler->IsStatic()) { handler->ObjectFlags |= OF_Fixed; - if (!handler->isMapScope) // global (GameInfo) handlers are not serialized. - handler->ObjectFlags |= OF_Transient; + handler->ObjectFlags |= OF_Transient; } return true; } @@ -149,7 +148,6 @@ static void E_InitStaticHandler(PClass* type, FString typestring, bool map) if (typeExists) return; DStaticEventHandler* handler = (DStaticEventHandler*)type->CreateNew(); - handler->isMapScope = map; E_RegisterHandler(handler); } @@ -189,7 +187,7 @@ void E_InitStaticHandlers(bool map) // delete old static handlers if any. for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next) { - if (handler->IsStatic() && !handler->isMapScope) + if (handler->IsStatic()) handler->Destroy(); } @@ -218,8 +216,8 @@ void E_WorldLoaded() { for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next) { - if (handler->IsStatic() && !handler->isMapScope) continue; - if (handler->isMapScope && savegamerestore) continue; // don't execute WorldLoaded for handlers loaded from the savegame. + if (handler->IsStatic()) continue; + if (savegamerestore) continue; // don't execute WorldLoaded for handlers loaded from the savegame. handler->WorldLoaded(); } } @@ -228,7 +226,7 @@ void E_WorldUnloaded() { for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next) { - if (handler->IsStatic() && !handler->isMapScope) continue; + if (handler->IsStatic()) continue; handler->WorldUnloaded(); } } @@ -237,7 +235,7 @@ void E_WorldLoadedUnsafe() { for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next) { - if (!handler->IsStatic() || handler->isMapScope) continue; + if (!handler->IsStatic()) continue; handler->WorldLoaded(); } } @@ -246,7 +244,7 @@ void E_WorldUnloadedUnsafe() { for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next) { - if (!handler->IsStatic() || handler->isMapScope) continue; + if (!handler->IsStatic()) continue; handler->WorldUnloaded(); } } diff --git a/src/events.h b/src/events.h index 73fd5e401..4bbeb6174 100755 --- a/src/events.h +++ b/src/events.h @@ -59,12 +59,10 @@ public: { prev = 0; next = 0; - isMapScope = false; } DStaticEventHandler* prev; DStaticEventHandler* next; - bool isMapScope; virtual bool IsStatic() { return true; } // serialization handler. let's keep it here so that I don't get lost in serialized/not serialized fields @@ -74,7 +72,6 @@ public: if (arc.isReading()) { Printf("DStaticEventHandler::Serialize: reading object %s\n", GetClass()->TypeName.GetChars()); - isMapScope = true; // unserialized static handler means map scope anyway. other handlers don't get serialized. } else {