- fixed crash in actor iterator

Level pointer should passed to FActorIterator contructor regardless of 'last look actor' because the latter can be null

https://forum.zdoom.org/viewtopic.php?t=63304
This commit is contained in:
alexey.lysiuk 2019-01-18 12:23:33 +02:00
parent 66d9ec00a7
commit 395d613912
2 changed files with 2 additions and 2 deletions

View file

@ -124,7 +124,7 @@ public:
FActorIterator (FLevelLocals *l, int i) : Level(l), base (nullptr), id (i)
{
}
FActorIterator (int i, AActor *start) : Level(start->Level), base (start), id (i)
FActorIterator (FLevelLocals *l, int i, AActor *start) : Level(l), base (start), id (i)
{
}
AActor *Next ()

View file

@ -1340,7 +1340,7 @@ int P_LookForTID (AActor *actor, INTBOOL allaround, FLookExParams *params)
actor->LastLookActor = nullptr;
}
FActorIterator iterator (actor->TIDtoHate, actor->LastLookActor);
FActorIterator iterator (actor->Level, actor->TIDtoHate, actor->LastLookActor);
int c = (pr_look3() & 31) + 7; // Look for between 7 and 38 hatees at a time
while ((other = iterator.Next()) != actor->LastLookActor)
{