Commits

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: