diff --git a/src/b_game.cpp b/src/b_game.cpp index beed7f3b3..0f6b69911 100644 --- a/src/b_game.cpp +++ b/src/b_game.cpp @@ -447,8 +447,7 @@ void FCajunMaster::RemoveAllBots (FLevelLocals *Level, bool fromlist) } // [ZZ] run event hook E_PlayerDisconnected(i); - // - level.Behaviors.StartTypedScripts (SCRIPT_Disconnect, players[i].mo, true, i, true); + Level->Behaviors.StartTypedScripts (SCRIPT_Disconnect, players[i].mo, true, i, true); ClearPlayer (i, !fromlist); } } diff --git a/src/g_game.cpp b/src/g_game.cpp index 09732db19..c0ba5398d 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1691,22 +1691,23 @@ void G_DoPlayerPop(int playernum) } // [RH] Make the player disappear - level.Behaviors.StopMyScripts(players[playernum].mo); + auto mo = players[playernum].mo; + mo->Level->Behaviors.StopMyScripts(mo); // [ZZ] fire player disconnect hook E_PlayerDisconnected(playernum); // [RH] Let the scripts know the player left - level.Behaviors.StartTypedScripts(SCRIPT_Disconnect, players[playernum].mo, true, playernum, true); - if (players[playernum].mo != NULL) + mo->Level->Behaviors.StartTypedScripts(SCRIPT_Disconnect, mo, true, playernum, true); + if (mo != NULL) { - P_DisconnectEffect(players[playernum].mo); - players[playernum].mo->player = NULL; - players[playernum].mo->Destroy(); + P_DisconnectEffect(mo); + mo->player = NULL; + mo->Destroy(); if (!(players[playernum].mo->ObjectFlags & OF_EuthanizeMe)) { // We just destroyed a morphed player, so now the original player // has taken their place. Destroy that one too. players[playernum].mo->Destroy(); } - players[playernum].mo = NULL; + players[playernum].mo = nullptr; players[playernum].camera = nullptr; } @@ -2033,14 +2034,15 @@ void G_DoAutoSave () file = G_BuildSaveName ("auto", nextautosave); - if (!(level.flags2 & LEVEL2_NOAUTOSAVEHINT)) + // The hint flag is only relevant on the primary level. + if (!(currentUILevel->flags2 & LEVEL2_NOAUTOSAVEHINT)) { nextautosave = (nextautosave + 1) % count; } else { // This flag can only be used once per level - level.flags2 &= ~LEVEL2_NOAUTOSAVEHINT; + currentUILevel->flags2 &= ~LEVEL2_NOAUTOSAVEHINT; } readableTime = myasctime ();