mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
- moved all service code to 'common'.
This needs to work on Raze as well!
This commit is contained in:
parent
7537f415ce
commit
9fbac8f1d4
2 changed files with 32 additions and 27 deletions
|
@ -55,6 +55,35 @@
|
|||
|
||||
#include "maps.h"
|
||||
|
||||
static ZSMap<FName, DObject*> AllServices;
|
||||
|
||||
static void MarkServices() {
|
||||
|
||||
ZSMap<FName, DObject*>::Iterator it(AllServices);
|
||||
ZSMap<FName, DObject*>::Pair* pair;
|
||||
while (it.NextPair(pair))
|
||||
{
|
||||
GC::Mark<DObject>(pair->Value);
|
||||
}
|
||||
}
|
||||
|
||||
void InitServices()
|
||||
{
|
||||
PClass* cls = PClass::FindClass("Service");
|
||||
for (PClass* clss : PClass::AllClasses)
|
||||
{
|
||||
if (clss != cls && cls->IsAncestorOf(clss))
|
||||
{
|
||||
DObject* obj = clss->CreateNew();
|
||||
obj->ObjectFlags |= OF_Transient;
|
||||
AllServices.Insert(clss->TypeName, obj);
|
||||
}
|
||||
}
|
||||
GC::AddMarkerFunc(&MarkServices);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// status bar exports
|
||||
|
@ -1161,8 +1190,6 @@ DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, baseorder);
|
|||
DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, loop);
|
||||
DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, handle);
|
||||
|
||||
extern ZSMap<FName, DObject* > AllServices;
|
||||
|
||||
DEFINE_GLOBAL_NAMED(PClass::AllClasses, AllClasses)
|
||||
|
||||
DEFINE_GLOBAL(AllServices)
|
||||
|
|
|
@ -369,18 +369,7 @@ static void LoadAltHudStuff()
|
|||
// PClassActor :: StaticInit STATIC
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
ZSMap<FName, DObject*> AllServices;
|
||||
|
||||
static void MarkServices(){
|
||||
|
||||
ZSMap<FName, DObject*>::Iterator it(AllServices);
|
||||
ZSMap<FName, DObject*>::Pair *pair;
|
||||
while (it.NextPair(pair))
|
||||
{
|
||||
GC::Mark<DObject>(pair->Value);
|
||||
}
|
||||
}
|
||||
void InitServices();
|
||||
|
||||
void PClassActor::StaticInit()
|
||||
{
|
||||
|
@ -407,6 +396,8 @@ void PClassActor::StaticInit()
|
|||
if (!batchrun) Printf ("LoadActors: Load actor definitions.\n");
|
||||
ClearStrifeTypes();
|
||||
LoadActors ();
|
||||
InitServices();
|
||||
|
||||
|
||||
for (auto cls : AllClasses)
|
||||
{
|
||||
|
@ -416,19 +407,6 @@ void PClassActor::StaticInit()
|
|||
}
|
||||
}
|
||||
|
||||
PClass * cls = PClass::FindClass("Service");
|
||||
for(PClass * clss : PClass::AllClasses)
|
||||
{
|
||||
if(clss != cls && cls->IsAncestorOf(clss))
|
||||
{
|
||||
DObject * obj = clss->CreateNew();
|
||||
obj->ObjectFlags |= OF_Transient;
|
||||
AllServices.Insert(clss->TypeName, obj);
|
||||
}
|
||||
}
|
||||
|
||||
GC::AddMarkerFunc(&MarkServices);
|
||||
|
||||
LoadAltHudStuff();
|
||||
InitBotStuff();
|
||||
|
||||
|
|
Loading…
Reference in a new issue