ACS_SectorThingCounter: fix infinite loop in touching iterator

This commit is contained in:
James R 2023-08-14 18:11:33 -07:00
parent ae7325cbc3
commit eff895178b

View file

@ -381,10 +381,9 @@ static bool ACS_ActivatorIsLocal(ACSVM::Thread *thread)
--------------------------------------------------*/ --------------------------------------------------*/
static UINT32 ACS_SectorThingCounter(sector_t *sec, mtag_t thingTag, bool (*filter)(mobj_t *)) static UINT32 ACS_SectorThingCounter(sector_t *sec, mtag_t thingTag, bool (*filter)(mobj_t *))
{ {
msecnode_t *node = sec->touching_thinglist; // things touching this sector
UINT32 count = 0; UINT32 count = 0;
while (node) for (msecnode_t *node = sec->touching_thinglist; node; node = node->m_thinglist_next) // things touching this sector
{ {
mobj_t *mo = node->m_thing; mobj_t *mo = node->m_thing;
@ -403,8 +402,6 @@ static UINT32 ACS_SectorThingCounter(sector_t *sec, mtag_t thingTag, bool (*filt
{ {
count++; count++;
} }
node = node->m_thinglist_next;
} }
return count; return count;