- fixed: The sector tag iterator needs access to the level.

This is done through the tag manager to avoid #include dependency hell. Trying to reference FLevelLocals directly from the inline functions will inevitably create a circular dependency.
This commit is contained in:
Christoph Oelckers 2019-01-10 02:50:48 +01:00
parent 72d09c0338
commit 7e3ef4d72d
3 changed files with 10 additions and 6 deletions

View file

@ -110,9 +110,6 @@ struct FLevelData
TArray<FPlayerStart> AllPlayerStarts;
FBehaviorContainer Behaviors;
FTagManager tagManager;
AActor *TIDHash[128];
TArray<FStrifeDialogueNode *> StrifeDialogues;
FDialogueIDMap DialogueRoots;
@ -124,6 +121,8 @@ struct FLevelData
struct FLevelLocals : public FLevelData
{
FLevelLocals() : tagManager(this) {}
void Tick();
void Mark();
void AddScroller(int secnum);
@ -155,6 +154,9 @@ struct FLevelLocals : public FLevelData
memset(TIDHash, 0, sizeof(TIDHash));
}
FTagManager tagManager;
AActor *TIDHash[128];
DSectorMarker *SectorMarker;
uint8_t md5[16]; // for savegame validation. If the MD5 does not match the savegame won't be loaded.

View file

@ -328,11 +328,11 @@ int FSectorTagIterator::Next()
else
{
// with the tag manager, searching for tag 0 has to be different, because it won't create entries for untagged sectors.
while (start < (int)level.sectors.Size() && tagManager.SectorHasTags(start))
while (start < (int)tagManager.Level->sectors.Size() && tagManager.SectorHasTags(start))
{
start++;
}
if (start == (int)level.sectors.Size()) return -1;
if (start == (int)tagManager.Level->sectors.Size()) return -1;
ret = start;
start++;
}
@ -349,7 +349,7 @@ int FSectorTagIterator::NextCompat(bool compat, int start)
{
if (!compat) return Next();
for (unsigned i = start + 1; i < level.sectors.Size(); i++)
for (unsigned i = start + 1; i < tagManager.Level->sectors.Size(); i++)
{
if (tagManager.SectorHasTag(i, searchtag)) return i;
}

View file

@ -24,6 +24,7 @@ class FTagManager
friend class FSectorTagIterator;
friend class FLineIdIterator;
FLevelLocals *Level;
TArray<FTagItem> allTags;
TArray<FTagItem> allIDs;
TArray<int> startForSector;
@ -42,6 +43,7 @@ class FTagManager
}
public:
FTagManager(FLevelLocals *l) : Level(l) {}
void Clear()
{
allTags.Clear();