mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
Made map-section handlers in MAPINFO not static. Static now unambiguously means 'global from GameInfo'.
This commit is contained in:
parent
6ada9c0291
commit
765bc2db39
2 changed files with 7 additions and 12 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue