diff --git a/src/k_menufunc.c b/src/k_menufunc.c index b37825586..a09ddadda 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -5507,19 +5507,21 @@ static void M_EraseProfileResponse(INT32 choice) { if (choice == MA_YES) { + const boolean current = (optionsmenu.eraseprofilen == cv_currprofile.value); // has to be grabbed before deletion S_StartSound(NULL, sfx_itrole); // bweh heh heh PR_DeleteProfile(optionsmenu.eraseprofilen); - if (optionsmenu.eraseprofilen == cv_currprofile.value) + if (current) { CV_StealthSetValue(&cv_currprofile, -1); - CV_StealthSetValue(&cv_ttlprofilen, 0); F_StartIntro(); M_ClearMenus(true); } else if (optionsmenu.eraseprofilen > PR_GetNumProfiles()-1) + { optionsmenu.eraseprofilen--; + } } } diff --git a/src/k_profiles.c b/src/k_profiles.c index 19c39d502..34648268a 100644 --- a/src/k_profiles.c +++ b/src/k_profiles.c @@ -114,10 +114,11 @@ boolean PR_DeleteProfile(INT32 num) profilesList[i] = profilesList[i+1]; } - // Make sure to move cv_lastprofile values as well! - for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) + // Make sure to move cv_lastprofile (and title profile) values as well! + for (i = 0; i < MAXSPLITSCREENPLAYERS+1; i++) { - INT32 profileset = cv_lastprofile[i].value; + consvar_t *cv = (i == MAXSPLITSCREENPLAYERS) ? &cv_ttlprofilen : &cv_lastprofile[i]; + INT32 profileset = cv->value; if (profileset < num) { @@ -136,7 +137,7 @@ boolean PR_DeleteProfile(INT32 num) profileset = PROFILE_GUEST; } - CV_StealthSetValue(&cv_lastprofile[i], profileset); + CV_StealthSetValue(cv, profileset); } }