From 9c7b5d50a4f87a357258a6e4f3cb2848511581b1 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 29 Jun 2023 13:15:52 +0100 Subject: [PATCH] Guard several things in P_DoPlayerExit from being executed during demo.playback Resolves #567, and issues with player profile wins as well --- src/p_user.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index ed8c06116..b6750eed8 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1464,30 +1464,33 @@ void P_DoPlayerExit(player_t *player, pflags_t flags) } } - if (modeattacking) + if (demo.playback == false) { - G_UpdateRecords(); - } - - if (!losing) - { - profile_t *pr = PR_GetPlayerProfile(player); - if (pr != NULL) + if (modeattacking == true) { - pr->wins++; - PR_SaveProfiles(); + G_UpdateRecords(); } - if (P_IsLocalPlayer(player) && player->skin < numskins) + if (!losing) { - skins[player->skin].records.wins++; + profile_t *pr = PR_GetPlayerProfile(player); + if (pr != NULL) + { + pr->wins++; + PR_SaveProfiles(); + } + + if (P_IsLocalPlayer(player) && player->skin < numskins) + { + skins[player->skin].records.wins++; + } } + + if (player == &players[consoleplayer]) + demo.savebutton = leveltime; } player->karthud[khud_cardanimation] = 0; // srb2kart: reset battle animation - - if (player == &players[consoleplayer]) - demo.savebutton = leveltime; } //