- added a level iterator for operations that need to make changes to all open levels.

Since currently there is only one level, this will obvciously only run once on that level for the time being.

This is mainly used for CCMDs and CVARs which either print some diagnostics or change some user-settable configuration.
This commit is contained in:
Christoph Oelckers 2019-01-28 02:41:29 +01:00
commit d941dea005
23 changed files with 198 additions and 126 deletions

View file

@ -813,9 +813,10 @@ public:
//
//=============================================================================
void PrintSections(FSectionContainer &container)
void PrintSections(FLevelLocals *Level)
{
auto Level = &level;
FSectionContainer &container = Level->sections;
Printf("Sections for %s\n", Level->MapName.GetChars());
for (unsigned i = 0; i < container.allSections.Size(); i++)
{
auto &section = container.allSections[i];
@ -852,7 +853,7 @@ void PrintSections(FSectionContainer &container)
}
}
}
Printf(PRINT_LOG, "%d sectors, %d subsectors, %d sections\n", Level->sectors.Size(), Level->subsectors.Size(), container.allSections.Size());
Printf(PRINT_LOG, "%d sectors, %d subsectors, %d sections\n\n", Level->sectors.Size(), Level->subsectors.Size(), container.allSections.Size());
}
@ -876,7 +877,10 @@ void CreateSections(FLevelLocals *Level)
CCMD(printsections)
{
PrintSections(level.sections);
for (auto Level : AllLevels())
{
PrintSections(Level);
}
}