Torr_Samaho avatar Torr_Samaho committed 210e3c3

Fixed: Clients could crash after the server instructed them to add NOBLOCKMAP to an actor.

Comments (0)

Files changed (2)

docs/zandronum-history.txt

 -	- Fixed: Joining a server with a cumulative PWAD name exceeding 255 characters using the internal server browser caused the game to crash or freeze. [Torr Samaho]
 -	- Fixed: With "sv_maprotation 1", "sv_randommaprotation 1" and only one map in the rotation the server froze when exiting the map. [Torr Samaho]
 -	- Fixed: A_MStaffTrack could cause the clients to crash in online games. [Torr Samaho]
+-	- Fixed: Clients could crash after the server instructed them to add NOBLOCKMAP to an actor. [Torr Samaho]
 !	- sv_coop_damagefactor is not archived in the config file anymore, but reset to its default value when the game starts. [Torr Samaho]
 
 
 	switch ( ulFlagSet )
 	{
 	case FLAGSET_FLAGS:
-
-		pActor->flags = ulFlags;
+		{
+			// [BB] Before adding MF_NOBLOCKMAP, we have to unlink the actor from all blocks.
+			const bool relinkActor = ( ( ulFlags & MF_NOBLOCKMAP ) && ( ( pActor->flags & MF_NOBLOCKMAP ) == false ) );
+			// [BB] Unlink based on the old flags.
+			if ( relinkActor )
+				pActor->UnlinkFromWorld ();
+
+			pActor->flags = ulFlags;
+
+			// [BB] Link based on the new flags.
+			if ( relinkActor )
+				pActor->LinkToWorld ();
+		}
 		break;
 	case FLAGSET_FLAGS2:
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.