From 9e847c252bf47b0884037089addbb584d1dabb10 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 15 May 2016 23:24:30 +0200 Subject: [PATCH] - fixed: When linking an actor into the blockmap multiple portal groups, AActor::LinkToWorld would delete the links to the previous nodes for each new group. This was causing random crashes when the affected actor was deleted by the garbage collector. --- src/p_maputl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 552889c48..5fa8aa2f2 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -459,6 +459,8 @@ void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector) P_CollectConnectedGroups(Sector->PortalGroup, Pos(), Top(), radius, check); + BlockNode = NULL; + FBlockNode **alink = &this->BlockNode; for (int i = -1; i < (int)check.Size(); i++) { DVector3 pos = i==-1? Pos() : PosRelative(check[i] & ~FPortalGroupArray::FLAT); @@ -470,11 +472,9 @@ void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector) if (x1 >= bmapwidth || x2 < 0 || y1 >= bmapheight || y2 < 0) { // thing is off the map - BlockNode = NULL; } else { // [RH] Link into every block this actor touches, not just the center one - FBlockNode **alink = &this->BlockNode; x1 = MAX(0, x1); y1 = MAX(0, y1); x2 = MIN(bmapwidth - 1, x2);