From 326b118a20c89a7f5c7c535ee84de5bbeb645564 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Tue, 26 Feb 2019 17:09:24 -0600 Subject: [PATCH] Fix players crashing when joining netgames with active followers --- src/doomdef.h | 2 +- src/p_saveg.c | 7 +++++++ src/p_user.c | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index 5e7b7657..ab863c6f 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -140,7 +140,7 @@ extern FILE *logstream; #endif -#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3 +//#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3 #ifdef DEVELOP #define VERSION 0 // Game version #define SUBVERSION 0 // more precise version number diff --git a/src/p_saveg.c b/src/p_saveg.c index ae568fab..54628083 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -3105,6 +3105,13 @@ static void P_RelinkPointers(void) if (!P_SetTarget(&mobj->player->awayviewmobj, P_FindNewPosition(temp))) CONS_Debug(DBG_GAMELOGIC, "awayviewmobj not found on %d\n", mobj->type); } + if (mobj->player && mobj->player->follower) + { + temp = (UINT32)(size_t)mobj->player->follower; + mobj->player->follower = NULL; + if (!P_SetTarget(&mobj->player->follower, P_FindNewPosition(temp))) + CONS_Debug(DBG_GAMELOGIC, "follower not found on %d\n", mobj->type); + } } } } diff --git a/src/p_user.c b/src/p_user.c index c2e75916..7ee0c2d6 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8948,7 +8948,7 @@ static void P_SetFollowerState(mobj_t *f, INT32 state) } // -//P_HandleFllower +//P_HandleFollower // //Handle the follower's spawning and moving along with the player. Do note that some of the stuff like the removal if a player doesn't exist anymore is handled in MT_FOLLOWER's thinker. static void P_HandleFollower(player_t *player)