Skip to content

Commit

Permalink
Moved Actor TID selector out of header
Browse files Browse the repository at this point in the history
  • Loading branch information
Boondorl authored and RicardoLuis0 committed Oct 31, 2024
1 parent f5ceaaf commit de8d839
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
18 changes: 18 additions & 0 deletions src/g_level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2400,6 +2400,24 @@ void FLevelLocals::ApplyCompatibility2()
i_compatflags2 = GetCompatibility2(compatflags2) | ii_compatflags2;
}

AActor* FLevelLocals::SelectActorFromTID(int tid, size_t index, AActor* defactor)
{
if (tid == 0)
return defactor;

AActor* actor = nullptr;
size_t cur = 0u;
auto it = GetActorIterator(tid);
while ((actor = it.Next()) != nullptr)
{
if (cur == index)
return actor;
++cur;
}

return nullptr;
}

//==========================================================================
// IsPointInMap
//
Expand Down
18 changes: 1 addition & 17 deletions src/g_levellocals.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ struct FLevelLocals
int GetCompatibility2(int mask);
void ApplyCompatibility();
void ApplyCompatibility2();
AActor* SelectActorFromTID(int tid, size_t index, AActor* defactor);

void Init();

Expand Down Expand Up @@ -316,23 +317,6 @@ struct FLevelLocals
{
return tid == 0 ? defactor : GetActorIterator(tid).Next();
}
AActor* SelectActorFromTID(int tid, size_t index, AActor *defactor)
{
if (tid == 0)
return defactor;

AActor* actor = nullptr;
size_t cur = 0u;
auto it = GetActorIterator(tid);
while ((actor = it.Next()) != nullptr)
{
if (cur == index)
return actor;
++cur;
}

return nullptr;
}

bool SectorHasTags(sector_t *sector)
{
Expand Down

0 comments on commit de8d839

Please sign in to comment.