From 65bc6e6aef337a630b688151a86c854f5f8c9c05 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 21 Dec 2021 09:23:39 +0100 Subject: [PATCH] - removed the now redundant wall() and sector() interator helper functions. With both wall and sector now being TArrays they are not needed anymore. --- source/core/actorlist.cpp | 2 +- source/core/automap.cpp | 2 +- source/core/gamefuncs.cpp | 5 ++--- source/core/gamefuncs.h | 10 ---------- source/core/maploader.cpp | 10 +++++----- source/core/maptypes.h | 2 +- source/games/blood/src/db.cpp | 4 ++-- source/games/blood/src/eventq.cpp | 4 ++-- source/games/blood/src/gameutil.cpp | 4 ++-- source/games/blood/src/nnexts.cpp | 8 ++++---- source/games/blood/src/preload.cpp | 4 ++-- source/games/blood/src/sectorfx.cpp | 6 +++--- source/games/blood/src/triggers.cpp | 12 ++++++------ source/games/blood/src/warp.cpp | 6 +++--- source/games/duke/src/cheats.cpp | 2 +- source/games/duke/src/premap.cpp | 6 +++--- source/games/duke/src/premap_d.cpp | 6 +++--- source/games/duke/src/premap_r.cpp | 10 +++++----- source/games/duke/src/sectors_d.cpp | 2 +- source/games/duke/src/sectors_r.cpp | 4 ++-- source/games/exhumed/src/enginesubs.cpp | 4 ++-- source/games/exhumed/src/init.cpp | 4 ++-- source/games/exhumed/src/map.cpp | 2 +- source/games/exhumed/src/object.cpp | 10 +++++----- source/games/exhumed/src/view.cpp | 8 ++++---- source/games/sw/src/break.cpp | 2 +- source/games/sw/src/cache.cpp | 4 ++-- source/games/sw/src/cheats.cpp | 2 +- source/games/sw/src/jsector.cpp | 4 ++-- source/games/sw/src/player.cpp | 2 +- source/games/sw/src/rooms.cpp | 2 +- source/games/sw/src/sector.cpp | 8 ++++---- source/games/sw/src/sprite.cpp | 2 +- source/games/sw/src/track.cpp | 4 ++-- source/games/sw/src/wallmove.cpp | 2 +- 35 files changed, 79 insertions(+), 90 deletions(-) diff --git a/source/core/actorlist.cpp b/source/core/actorlist.cpp index 1234c3591..72749be86 100644 --- a/source/core/actorlist.cpp +++ b/source/core/actorlist.cpp @@ -422,7 +422,7 @@ void InitSpriteLists() { stat.firstEntry = stat.lastEntry = nullptr; } - for (auto& sect : sectors()) + for (auto& sect: sector) { sect.firstEntry = sect.lastEntry = nullptr; } diff --git a/source/core/automap.cpp b/source/core/automap.cpp index 91d20ed6e..e9c88da84 100644 --- a/source/core/automap.cpp +++ b/source/core/automap.cpp @@ -167,7 +167,7 @@ static void CalcMapBounds() y_max_bound = INT_MIN; - for(auto& wal : walls()) + for(auto& wal : wall) { // get map min and max coordinates if (wal.x < x_min_bound) x_min_bound = wal.x; diff --git a/source/core/gamefuncs.cpp b/source/core/gamefuncs.cpp index b39e6fe61..2b947528e 100644 --- a/source/core/gamefuncs.cpp +++ b/source/core/gamefuncs.cpp @@ -335,11 +335,10 @@ void GetFlatSpritePosition(const tspritetype* spr, vec2_t pos, vec2_t* out, bool void checkRotatedWalls() { - for (int i = 0; i < numwalls; ++i) + for (auto& w : wall) { - if (wall[i].cstat & CSTAT_WALL_ROTATE_90) + if (w.cstat & CSTAT_WALL_ROTATE_90) { - auto& w = wall[i]; auto& tile = RotTile(w.picnum + animateoffs(w.picnum, 16384)); if (tile.newtile == -1 && tile.owner == -1) diff --git a/source/core/gamefuncs.h b/source/core/gamefuncs.h index 3e774bf87..2efc91eb6 100644 --- a/source/core/gamefuncs.h +++ b/source/core/gamefuncs.h @@ -277,16 +277,6 @@ inline int32_t getangle(walltype* wal) wal->point2Wall()->y - wal->y); } -inline TArrayView sectors() -{ - return TArrayView(§or[0], numsectors); -} - -inline TArrayView walls() -{ - return TArrayView(&wall[0], numwalls); -} - inline TArrayView wallsofsector(const sectortype* sec) { return TArrayView(sec->firstWall(), sec->wallnum); diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index 9b94ff3a5..14385255d 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -401,7 +401,7 @@ void allocateMapArrays(int numsprites) void fixSectors() { - for(auto& sect : sectors()) + for(auto& sect: sector) { // Fix maps which do not set their wallptr to the first wall of the sector. Lo Wang In Time's map 11 is such a case. auto wp = sect.firstWall(); @@ -536,7 +536,7 @@ void loadMapBackup(const char* filename) void setWallSectors() { int i = 0; - for (auto& wal : walls()) + for (auto& wal : wall) { wal.sector = -1; wal.lengthflags = 3; @@ -588,7 +588,7 @@ void setWallSectors() } } - for(auto& sect : sectors()) + for(auto& sect: sector) { sect.dirty = EDirty::AllDirty; sect.exflags = 0; @@ -612,7 +612,7 @@ void setWallSectors() } // validate 'nextsector' fields. Some maps have these wrong which can cause render glitches and occasionally even crashes. - for (auto& wal : walls()) + for (auto& wal : wall) { if (validWallIndex(wal.nextwall)) { @@ -634,7 +634,7 @@ void MarkMap() GC::Mark(stat.firstEntry); GC::Mark(stat.lastEntry); } - for (auto& sect : sectors()) + for (auto& sect: sector) { GC::Mark(sect.firstEntry); GC::Mark(sect.lastEntry); diff --git a/source/core/maptypes.h b/source/core/maptypes.h index a1242e65f..3d41dd369 100644 --- a/source/core/maptypes.h +++ b/source/core/maptypes.h @@ -645,7 +645,7 @@ inline walltype* walltype::lastWall() const if (index > 0 && wall[index - 1].point2 == index) return &wall[index - 1]; int check = index; - for (int i = 0; i < numwalls; i++) + for (int i = 0; i < 16384; i++) // don't run endlessly in case of malformed sectors. { int next = wall[check].point2; if (next == index) return &wall[check]; diff --git a/source/games/blood/src/db.cpp b/source/games/blood/src/db.cpp index 75ec06cb1..4638535bc 100644 --- a/source/games/blood/src/db.cpp +++ b/source/games/blood/src/db.cpp @@ -682,7 +682,7 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, sect switch (header.version & 0xff) { case 0: - for (auto& sect : sectors()) + for (auto& sect: sector) { sectortype* pSector = § if (pSector->hasX()) @@ -706,7 +706,7 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, sect } [[fallthrough]]; case 1: - for (auto& sect : sectors()) + for (auto& sect: sector) { sectortype* pSector = § if (pSector->hasX()) diff --git a/source/games/blood/src/eventq.cpp b/source/games/blood/src/eventq.cpp index ab2075d94..ffa192a73 100644 --- a/source/games/blood/src/eventq.cpp +++ b/source/games/blood/src/eventq.cpp @@ -280,7 +280,7 @@ void evInit(TArray& actors) memset(rxBucket, 0, sizeof(rxBucket)); // add all the tags to the bucket array - for(auto& sect : sectors()) + for(auto& sect: sector) { if (sect.hasX() && sect.xs().rxID > 0) { @@ -290,7 +290,7 @@ void evInit(TArray& actors) } } - for(auto& wal: walls()) + for(auto& wal: wall) { if (wal.hasX() && wal.xw().rxID > 0) { diff --git a/source/games/blood/src/gameutil.cpp b/source/games/blood/src/gameutil.cpp index b9e3ed827..a196c1d5a 100644 --- a/source/games/blood/src/gameutil.cpp +++ b/source/games/blood/src/gameutil.cpp @@ -60,7 +60,7 @@ bool FindSector(int nX, int nY, int nZ, sectortype** pSector) } } } - for(auto& sec : sectors()) + for(auto& sec: sector) { if (inside(nX, nY, &sec)) { @@ -91,7 +91,7 @@ bool FindSector(int nX, int nY, sectortype** pSector) return 1; } } - for (auto& sec : sectors()) + for (auto& sec: sector) { if (inside(nX, nY, &sec)) { diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 8e013e345..d6a262417 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -825,7 +825,7 @@ void nnExtInitModernStuff(TArray& actors) pCond->obj[count++].cmd = (uint8_t)pXSpr->command; } - for (auto& sect : sectors()) + for (auto& sect: sector) { if (!sect.hasX() || sect.xs().txID != pXSprite->rxID) continue; else if (count >= kMaxTracedObjects) @@ -835,7 +835,7 @@ void nnExtInitModernStuff(TArray& actors) pCond->obj[count++].cmd = sect.xs().command; } - for(auto& wal : walls()) + for(auto& wal : wall) { if (!wal.hasX() || wal.xw().txID != pXSprite->rxID) continue; @@ -2854,7 +2854,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe pXLower = &aLower->x(); // must be sure we found exact same upper link - for (auto& sec : sectors()) + for (auto& sec: sector) { auto aUpper = barrier_cast(sec.upperLink); if (aUpper == nullptr || aUpper->x().data1 != pXLower->data1) continue; @@ -3026,7 +3026,7 @@ void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor) if (aLink) { // must be sure we found exact same upper link - for(auto& sec : sectors()) + for(auto& sec: sector) { auto aUpper = barrier_cast(sec.upperLink); if (aUpper == nullptr || aUpper->x().data1 != aLink->x().data1) continue; diff --git a/source/games/blood/src/preload.cpp b/source/games/blood/src/preload.cpp index 1ca57b8d5..3019ae840 100644 --- a/source/games/blood/src/preload.cpp +++ b/source/games/blood/src/preload.cpp @@ -246,14 +246,14 @@ void PreloadCache() if (!r_precache) return; int skyTile = -1; // Fonts - for(auto& sect : sectors()) + for(auto& sect: sector) { tilePrecacheTile(sect.floorpicnum, 0, sect.floorpal); tilePrecacheTile(sect.ceilingpicnum, 0, sect.ceilingpal); if ((sect.ceilingstat & CSTAT_SECTOR_SKY) != 0 && skyTile == -1) skyTile = sect.ceilingpicnum; } - for(auto& wal : walls()) + for(auto& wal : wall) { tilePrecacheTile(wal.picnum, 0, wal.pal); if (wal.overpicnum >= 0) diff --git a/source/games/blood/src/sectorfx.cpp b/source/games/blood/src/sectorfx.cpp index b776cc3db..f73f9a5f4 100644 --- a/source/games/blood/src/sectorfx.cpp +++ b/source/games/blood/src/sectorfx.cpp @@ -196,7 +196,7 @@ void DoSectorLighting(void) void UndoSectorLighting(void) { - for (auto& sect : sectors()) + for (auto& sect: sector) { if (sect.hasX()) { @@ -307,7 +307,7 @@ void InitSectorFX(void) shadeList.Clear(); panList.Clear(); wallPanList.Clear(); - for (auto& sect : sectors()) + for (auto& sect: sector) { if (sect.hasX()) { @@ -332,7 +332,7 @@ void InitSectorFX(void) } } } - for(auto& wal : walls()) + for(auto& wal : wall) { if (wal.hasX()) { diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index 25fdbb26d..5d169d7d8 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -1817,7 +1817,7 @@ void trMessageSprite(DBloodActor* actor, EVENT event) void ProcessMotion(void) { - for(auto& sect : sectors()) + for(auto& sect: sector) { sectortype* pSector = § @@ -1892,7 +1892,7 @@ void ProcessMotion(void) void AlignSlopes(void) { - for(auto& sect : sectors()) + for(auto& sect: sector) { if (sect.slopewallofs) { @@ -1926,7 +1926,7 @@ int(*gBusyProc[])(sectortype*, unsigned int) = void trProcessBusy(void) { - for (auto& sect : sectors()) + for (auto& sect: sector) { sect.velCeil = sect.velFloor = 0; } @@ -1964,7 +1964,7 @@ void InitGenerator(DBloodActor*); void trInit(TArray& actors) { gBusy.Clear(); - for(auto& wal : walls()) + for(auto& wal : wall) for (int i = 0; i < numwalls; i++) { wal.baseWall.x = wal.x; @@ -1977,7 +1977,7 @@ void trInit(TArray& actors) spr->inittype = spr->type; actor->basePoint = spr->pos; } - for(auto& wal : walls()) + for(auto& wal : wall) { if (wal.hasX()) { @@ -1987,7 +1987,7 @@ void trInit(TArray& actors) } } - for(auto& sect : sectors()) + for(auto& sect: sector) { sectortype *pSector = § pSector->baseFloor = pSector->floorz; diff --git a/source/games/blood/src/warp.cpp b/source/games/blood/src/warp.cpp index f776bb33d..cde74a10a 100644 --- a/source/games/blood/src/warp.cpp +++ b/source/games/blood/src/warp.cpp @@ -38,7 +38,7 @@ ZONE gStartZone[8]; void validateLinks() { int snum = 0; - for (auto& sect : sectors()) + for (auto& sect: sector) { DCoreActor* upper = sect.upperLink; if (upper && !static_cast(upper)->GetOwner()) @@ -161,7 +161,7 @@ void warpInit(TArray& actors) } #endif - for(auto& sect : sectors()) + for(auto& sect: sector) { auto actor = barrier_cast(sect.upperLink); if (actor && actor->hasX()) @@ -169,7 +169,7 @@ void warpInit(TArray& actors) spritetype *pSprite = &actor->s(); XSPRITE *pXSprite = &actor->x(); int nLink = pXSprite->data1; - for(auto& sect : sectors()) + for(auto& sect: sector) { auto actor2 = barrier_cast(sect.lowerLink); if (actor2 && actor2->hasX()) diff --git a/source/games/duke/src/cheats.cpp b/source/games/duke/src/cheats.cpp index f177cbe29..4c00903d5 100644 --- a/source/games/duke/src/cheats.cpp +++ b/source/games/duke/src/cheats.cpp @@ -101,7 +101,7 @@ static const char *cheatGod(int myconnectindex, int state) static const char* cheatUnlock() { if (isShareware()) return nullptr; - for (auto§ : sectors()) + for (auto§: sector) { int j = sect.lotag; if (j == -1 || j == 32767) continue; diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index d608f08c5..223418d1c 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -686,7 +686,7 @@ void prelevel_common(int g) memset(ambienthitag, -1, sizeof(ambienthitag)); memset(ambientlotag, -1, sizeof(ambientlotag)); - for(auto&sec : sectors()) + for(auto&sec: sector) { auto sectp = &sec; sectp->extra = 256; @@ -819,7 +819,7 @@ void donewgame(MapRecord* map, int sk) static void SpawnPortals() { - for (auto& wal : walls()) + for (auto& wal : wall) { if (wal.overpicnum == TILE_MIRROR && (wal.cstat & CSTAT_WALL_1WAY)) wal.portalflags |= PORTAL_WALL_MIRROR; } @@ -1084,7 +1084,7 @@ void enterlevel(MapRecord *mi, int gamemode) setLevelStarted(mi); if (isRRRA() && ps[screenpeek].sea_sick_stat == 1) { - for (auto& wal : walls()) + for (auto& wal : wall) { if (wal.picnum == 7873 || wal.picnum == 7870) StartInterpolation(&wal, Interp_Wall_PanX); diff --git a/source/games/duke/src/premap_d.cpp b/source/games/duke/src/premap_d.cpp index 6451077d5..632f93158 100644 --- a/source/games/duke/src/premap_d.cpp +++ b/source/games/duke/src/premap_d.cpp @@ -236,14 +236,14 @@ void cacheit_d(void) cachegoodsprites(); - for (auto& wal : walls()) + for (auto& wal : wall) { tloadtile(wal.picnum, wal.pal); if (wal.overpicnum >= 0) tloadtile(wal.overpicnum, wal.pal); } - for (auto& sect : sectors()) + for (auto& sect: sector) { tloadtile(sect.floorpicnum, sect.floorpal); tloadtile(sect.ceilingpicnum, sect.ceilingpal); @@ -381,7 +381,7 @@ void prelevel_d(int g, TArray& actors) mirrorcnt = 0; - for (auto& wal : walls()) + for (auto& wal : wall) { if (wal.overpicnum == MIRROR && (wal.cstat & CSTAT_WALL_1WAY) != 0) { diff --git a/source/games/duke/src/premap_r.cpp b/source/games/duke/src/premap_r.cpp index 4c9aa069d..a3ab2d5d4 100644 --- a/source/games/duke/src/premap_r.cpp +++ b/source/games/duke/src/premap_r.cpp @@ -374,14 +374,14 @@ void cacheit_r(void) cachegoodsprites(); - for (auto& wal : walls()) + for (auto& wal : wall) { tloadtile(wal.picnum, wal.pal); if(wal.overpicnum >= 0) tloadtile(wal.overpicnum, wal.pal); } - for (auto& sect : sectors()) + for (auto& sect: sector) { tloadtile(sect.floorpicnum, sect.floorpal); tloadtile(sect.ceilingpicnum, sect.ceilingpal); @@ -454,7 +454,7 @@ void prelevel_r(int g, TArray& actors) } } - for (auto§ : sectors()) + for (auto§: sector) { auto sectp = § if (sectp->ceilingpicnum == RRTILE2577) @@ -481,7 +481,7 @@ void prelevel_r(int g, TArray& actors) deletesprite(act); } } - for(auto& osect : sectors()) + for(auto& osect: sector) { if (sectp->hitag == osect.hitag && &osect != sectp) { @@ -716,7 +716,7 @@ void prelevel_r(int g, TArray& actors) mirrorcnt = 0; - for (auto& wl : walls()) + for (auto& wl : wall) { walltype* wal = &wl; diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 06cc8c1a7..0ccc7e4df 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -417,7 +417,7 @@ bool checkhitswitch_d(int snum, walltype* wwal, DDukeActor *act) } } - for (auto& wal : walls()) + for (auto& wal : wall) { if (lotag == wal.lotag) switch (wal.picnum) diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 5bef29c80..7dd6267a8 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -202,7 +202,7 @@ void animatewalls_r(void) if (isRRRA() &&ps[screenpeek].sea_sick_stat == 1) { - for (auto& wal : walls()) + for (auto& wal : wall) { if (wal.picnum == RRTILE7873) wal.addxpan(6); @@ -601,7 +601,7 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act) } } - for (auto& wal : walls()) + for (auto& wal : wall) { if (lotag == wal.lotag) switch (wal.picnum) diff --git a/source/games/exhumed/src/enginesubs.cpp b/source/games/exhumed/src/enginesubs.cpp index 4027607e0..00cc52220 100644 --- a/source/games/exhumed/src/enginesubs.cpp +++ b/source/games/exhumed/src/enginesubs.cpp @@ -38,7 +38,7 @@ void precache() { if (!r_precache) return; - for (auto& sect: sectors()) + for (auto& sect: sector) { int j = sect.ceilingpicnum; markTileForPrecache(j, sect.ceilingpal); @@ -51,7 +51,7 @@ void precache() for (int k = 1; k <= picanm[j].num; k++) markTileForPrecache(j + k, sect.floorpal); } - for(auto& wal : walls()) + for(auto& wal : wall) { int j = wal.picnum; markTileForPrecache(j, wal.pal); diff --git a/source/games/exhumed/src/init.cpp b/source/games/exhumed/src/init.cpp index 8e31b6528..0149c5881 100644 --- a/source/games/exhumed/src/init.cpp +++ b/source/games/exhumed/src/init.cpp @@ -783,7 +783,7 @@ void LoadObjects(TArray& actors) InitElev(); InitWallFace(); - for (auto& sect : sectors()) + for (auto& sect: sector) { int hitag = sect.hitag; int lotag = sect.lotag; @@ -801,7 +801,7 @@ void LoadObjects(TArray& actors) } } - for (auto& wal : walls()) + for (auto& wal : wall) { wal.extra = -1; diff --git a/source/games/exhumed/src/map.cpp b/source/games/exhumed/src/map.cpp index 08982b920..3c7172ebd 100644 --- a/source/games/exhumed/src/map.cpp +++ b/source/games/exhumed/src/map.cpp @@ -32,7 +32,7 @@ bool bShowTowers = false; void GrabMap() { - for(auto&sec : sectors()) + for(auto&sec: sector) MarkSectorSeen(&sec); } diff --git a/source/games/exhumed/src/object.cpp b/source/games/exhumed/src/object.cpp index 2ba2300a5..20662e744 100644 --- a/source/games/exhumed/src/object.cpp +++ b/source/games/exhumed/src/object.cpp @@ -1490,7 +1490,7 @@ void DimLights() if (word_96786 == 0) return; - for (auto§ : sectors()) + for (auto§: sector) { if (sect.ceilingshade < 100) sect.ceilingshade++; @@ -1722,7 +1722,7 @@ void ExplodeEnergyBlock(DExhumedActor* pActor) lFinaleStart = lFinaleStart + 1; } - for(auto& sect : sectors()) + for(auto& sect: sector) { if (sect.ceilingpal == 1) { sect.ceilingpal = 0; @@ -2529,7 +2529,7 @@ void PostProcess() if (!(currentLevel->gameflags & LEVEL_EX_COUNTDOWN)) { - for (auto& sect : sectors()) + for (auto& sect: sector) { int var_20 = 30000; @@ -2540,7 +2540,7 @@ void PostProcess() } else { - for (auto& sectj : sectors()) + for (auto& sectj: sector) { // loc_23CA6: @@ -2562,7 +2562,7 @@ void PostProcess() } else // nMap == kMap20) { - for(auto& sect : sectors()) + for(auto& sect: sector) { sect.pSoundSect = § sect.Sound = StaticSound[kSound62]; diff --git a/source/games/exhumed/src/view.cpp b/source/games/exhumed/src/view.cpp index 5cbe84f2e..d0f006172 100644 --- a/source/games/exhumed/src/view.cpp +++ b/source/games/exhumed/src/view.cpp @@ -346,7 +346,7 @@ void DrawView(double smoothRatio, bool sceneonly) if (HavePLURemap()) { auto p = paldata.Data(); - for (auto& sect : sectors()) + for (auto& sect: sector) { uint8_t v; v = *p++ = sect.floorpal; @@ -354,7 +354,7 @@ void DrawView(double smoothRatio, bool sceneonly) v = *p++ = sect.ceilingpal; sect.ceilingpal = RemapPLU(v); } - for (auto& wal : walls()) + for (auto& wal : wall) { uint8_t v; v = *p++ = wal.pal; @@ -377,12 +377,12 @@ void DrawView(double smoothRatio, bool sceneonly) if (HavePLURemap()) { auto p = paldata.Data(); - for (auto& sect : sectors()) + for (auto& sect: sector) { sect.floorpal = *p++; sect.ceilingpal = *p++; } - for (auto& wal : walls()) + for (auto& wal : wall) { wal.pal = *p++; } diff --git a/source/games/sw/src/break.cpp b/source/games/sw/src/break.cpp index 4dca63f85..05090dee6 100644 --- a/source/games/sw/src/break.cpp +++ b/source/games/sw/src/break.cpp @@ -1034,7 +1034,7 @@ void DoWallBreakMatch(int match) int x,y,z; int wall_ang; - for(auto& wal : walls()) + for(auto& wal : wall) { if (wal.hitag == match) { diff --git a/source/games/sw/src/cache.cpp b/source/games/sw/src/cache.cpp index 05a5a376c..574c05696 100644 --- a/source/games/sw/src/cache.cpp +++ b/source/games/sw/src/cache.cpp @@ -77,7 +77,7 @@ void precacheMap(void) WALLp wp; SPRITEp sp; - for(auto& sec : sectors()) + for(auto& sec: sector) { j = sec.ceilingpicnum; markTileForPrecache(j, sec.ceilingpal); @@ -104,7 +104,7 @@ void precacheMap(void) } - for (auto& wal : walls()) + for (auto& wal : wall) { j = wal.picnum; diff --git a/source/games/sw/src/cheats.cpp b/source/games/sw/src/cheats.cpp index d297e76bc..e749ddc1a 100644 --- a/source/games/sw/src/cheats.cpp +++ b/source/games/sw/src/cheats.cpp @@ -239,7 +239,7 @@ static void ItemCheat(int player) PlayerUpdateInventory(p, p->InventoryNum); - for (auto& sect : sectors()) + for (auto& sect: sector) { if (sect.hasU() && sect.stag == SECT_LOCK_DOOR) sect.number = 0; // unlock all doors of this type diff --git a/source/games/sw/src/jsector.cpp b/source/games/sw/src/jsector.cpp index 0c8609d48..64cf28703 100644 --- a/source/games/sw/src/jsector.cpp +++ b/source/games/sw/src/jsector.cpp @@ -224,7 +224,7 @@ void JS_SpriteSetup(void) } } // Check for certain walls to make sounds - for(auto& wal : walls()) + for(auto& wal : wall) { int picnum = wal.picnum; @@ -279,7 +279,7 @@ void JS_InitMirrors(void) mirror[i].ismagic = false; } - for(auto& wal : walls()) + for(auto& wal : wall) { if (wal.twoSided() && (wal.overpicnum == MIRROR) && (wal.cstat & CSTAT_WALL_1WAY)) { diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index cd3997b7a..4bb4cae81 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -3918,7 +3918,7 @@ int GetOverlapSector(int x, int y, sectortype** over, sectortype** under) // if nothing was found, check them all if (found == 0) { - for (auto& sect : sectors()) + for (auto& sect: sector) { if (inside(x, y, §)) { diff --git a/source/games/sw/src/rooms.cpp b/source/games/sw/src/rooms.cpp index d6fbd1610..d3257cf1f 100644 --- a/source/games/sw/src/rooms.cpp +++ b/source/games/sw/src/rooms.cpp @@ -617,7 +617,7 @@ void GetUpperLowerSector(short match, int x, int y, sectortype** upper, sectorty int sln = 0; SPRITEp sp; - for(auto& sect : sectors()) + for(auto& sect: sector) { if (inside(x, y, §) == 1) { diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index 85a7b0f75..c4b56a0ce 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -126,7 +126,7 @@ void WallSetupDontMove(void) if (spu->lotag == spl->lotag) { - for(auto& wal : walls()) + for(auto& wal : wall) { if (wal.x < spl->x && wal.x > spu->x && wal.y < spl->y && wal.y > spu->y) { @@ -169,7 +169,7 @@ void WallSetup(void) extern int x_min_bound, y_min_bound, x_max_bound, y_max_bound; - for (auto& wal : walls()) + for (auto& wal : wall) { auto wp = &wal; if (wp->picnum == FAF_PLACE_MIRROR_PIC) @@ -392,7 +392,7 @@ void SectorSetup(void) LevelSecrets = 0; - for(auto§ : sectors()) + for(auto§: sector) { auto const sectp = § tag = sectp->lotag; @@ -1589,7 +1589,7 @@ int OperateSprite(DSWActor* actor, short player_is_operating) key_num = sp->hitag; if (pp->HasKey[key_num - 1]) { - for(auto& sect : sectors()) + for(auto& sect: sector) { if (sect.hasU() && sect.stag == SECT_LOCK_DOOR && sect.number == key_num) sect.number = 0; // unlock all doors of this type diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 78e4946e7..ebe31e860 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -1606,7 +1606,7 @@ void SpriteSetup(void) // Clear Sprite Extension structure // Clear all extra bits - they are set by sprites - for(auto& sect : sectors()) + for(auto& sect: sector) { sect.extra = 0; } diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index e1b16aa02..b261031ee 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -781,7 +781,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECTp sop) // look through all sectors for whole sectors that are IN bounds - for (auto&sec : sectors()) + for (auto&sec: sector) { auto sect = &sec; @@ -2197,7 +2197,7 @@ void CallbackSOsink(ANIMp ap, void *data) tgt_depth = FixedToInt(srcsect->depth_fixed); - for(auto& sect : sectors()) + for(auto& sect: sector) { if (§ == destsect) { diff --git a/source/games/sw/src/wallmove.cpp b/source/games/sw/src/wallmove.cpp index 0435f7f67..70d777ba3 100644 --- a/source/games/sw/src/wallmove.cpp +++ b/source/games/sw/src/wallmove.cpp @@ -102,7 +102,7 @@ int DoWallMove(DSWActor* actor) nx = MulScale(dist, bcos(ang), 14); ny = MulScale(dist, bsin(ang), 14); - for(auto& wal : walls()) + for(auto& wal : wall) { if (wal.x == sp->x && wal.y == sp->y) {