- moved all service code to 'common'.

This needs to work on Raze as well!
This commit is contained in:
Christoph Oelckers 2023-03-26 10:55:09 +02:00
commit 9fbac8f1d4
2 changed files with 32 additions and 27 deletions

View file

@ -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)