- added a little utility that allows iterating over the walls of a sector with C++ for's.

This commit is contained in:
Christoph Oelckers 2021-11-07 17:27:05 +01:00
parent 4b0ffe5443
commit 59df3b0e19
2 changed files with 16 additions and 6 deletions

View file

@ -160,3 +160,12 @@ inline int32_t getangle(walltype* wal)
wall[wal->point2].y - wal->y);
}
inline TArrayView<walltype> wallsofsector(sectortype* sec)
{
return TArrayView<walltype>(sec->firstWall(), sec->wallnum);
}
inline TArrayView<walltype> wallsofsector(int sec)
{
return wallsofsector(&sector[sec]);
}

View file

@ -331,16 +331,17 @@ void movecyclers(void)
c->lotag += sect->extra;
if (c->state)
{
auto wal = sect->firstWall();
for (int x = sect->wallnum; x > 0; x--, wal++)
if (wal->hitag != 1)
for (auto& wal : wallsofsector(sect))
{
if (wal.hitag != 1)
{
wal->shade = j;
wal.shade = j;
if ((wal->cstat & CSTAT_WALL_BOTTOM_SWAP) && wal->nextwall >= 0)
wal->nextWall()->shade = j;
if ((wal.cstat & CSTAT_WALL_BOTTOM_SWAP) && wal.nextwall >= 0)
wal.nextWall()->shade = j;
}
}
sect->floorshade = sect->ceilingshade = j;
}
}