- replaced P_FindSectorFromTag with an FSectorTagIterator class.

This is done to encapsulate the gory details of tag search in one place so that the implementation of multiple tags per sector remains contained to a few isolated spots in the code.
This also moves the special 'tag == 0 -> activate backsector' handling into the iterator class.
This commit is contained in:
Christoph Oelckers 2015-04-14 22:39:57 +02:00
commit 425e5b9ffc
18 changed files with 354 additions and 329 deletions

View file

@ -300,9 +300,10 @@ static AActor *SelectTeleDest (int tid, int tag, bool norandom)
if (tag != 0)
{
int secnum = -1;
int secnum;
while ((secnum = P_FindSectorFromTag (tag, secnum)) >= 0)
FSectorTagIterator itr(tag);
while ((secnum = itr.Next()) >= 0)
{
// Scanning the snext links of things in the sector will not work, because
// TeleportDests have MF_NOSECTOR set. So you have to search *everything*.
@ -726,7 +727,8 @@ bool EV_TeleportSector (int tag, int source_tid, int dest_tid, bool fog, int gro
int secnum;
secnum = -1;
while ((secnum = P_FindSectorFromTag (tag, secnum)) >= 0)
FSectorTagIterator itr(tag);
while ((secnum = itr.Next()) >= 0)
{
msecnode_t *node;
const sector_t * const sec = &sectors[secnum];