From 4b7b95663ed074d32ae49db2a74dd6364c76ac68 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 25 Nov 2006 04:26:04 +0000 Subject: [PATCH] - Fixed: When P_SpawnPlayer() calls DObject::PointerSubstitution() to redirect player pointers, it affects the bodyque too. That meant that in multiplayer games, once the bodyque filled up, anybody was in danger of being rudely destroyed the next time somebody respawned. SVN r386 (trunk) --- docs/rh-log.txt | 6 ++++++ src/p_mobj.cpp | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 669f1ab0f8..e5513148bf 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,9 @@ +November 24, 2006 +- Fixed: When P_SpawnPlayer() calls DObject::PointerSubstitution() to + redirect player pointers, it affects the bodyque too. That meant that in + multiplayer games, once the bodyque filled up, anybody was in danger of + being rudely destroyed the next time somebody respawned. + November 22, 2006 - Added a manifest with a trustinfo section to updaterevision.exe so that the build process can run uninterrupted under Vista. diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index e19701baf6..e754d79ee8 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -53,6 +53,7 @@ #include "a_keys.h" #include "p_conversation.h" #include "thingdef.h" +#include "g_game.h" // MACROS ------------------------------------------------------------------ @@ -3556,6 +3557,10 @@ void P_SpawnPlayer (mapthing2_t *mthing, bool tempplayer) { assert (oldactor != NULL); DObject::PointerSubstitution (oldactor, p->mo); + // PointerSubstitution() will also affect the bodyque, so undo that now. + for (int ii=0; ii < BODYQUESIZE; ++ii) + if (bodyque[ii] == p->mo) + bodyque[ii] = oldactor; FBehavior::StaticStartTypedScripts (SCRIPT_Respawn, p->mo, true); } }