mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 12:31:54 +00:00
Fixed fresh profiles being able to have duplicate names after deleting other Profiles
This commit is contained in:
parent
df64ea9ce6
commit
c58624bca2
2 changed files with 26 additions and 2 deletions
|
|
@ -4579,7 +4579,7 @@ boolean M_ProfileControlsInputs(INT32 ch)
|
||||||
optionsmenu.profile->kickstartaccel = cv_dummyprofilekickstart.value; // Make sure to save kickstart accel.
|
optionsmenu.profile->kickstartaccel = cv_dummyprofilekickstart.value; // Make sure to save kickstart accel.
|
||||||
|
|
||||||
// Reapply player 1's real profile.
|
// Reapply player 1's real profile.
|
||||||
if (cv_currprofile.value)
|
if (cv_currprofile.value > -1)
|
||||||
PR_ApplyProfile(cv_lastprofile[0].value, 0);
|
PR_ApplyProfile(cv_lastprofile[0].value, 0);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -108,8 +108,32 @@ void PR_InitNewProfile(void)
|
||||||
{
|
{
|
||||||
char pname[PROFILENAMELEN+1] = "PRF";
|
char pname[PROFILENAMELEN+1] = "PRF";
|
||||||
profile_t *dprofile;
|
profile_t *dprofile;
|
||||||
|
UINT8 usenum = numprofiles-1;
|
||||||
|
UINT8 i;
|
||||||
|
boolean nameok = false;
|
||||||
|
|
||||||
strcpy(pname, va("PRF%c", 'A'+numprofiles-1));
|
// When deleting profile, it's possible to do some pretty wacko stuff that would lead a new fresh profile to share the same name as another profile we have never changed the name of.
|
||||||
|
while (!nameok)
|
||||||
|
{
|
||||||
|
strcpy(pname, va("PRF%c", 'A'+usenum-1));
|
||||||
|
|
||||||
|
for (i = 0; i < numprofiles; i++)
|
||||||
|
{
|
||||||
|
profile_t *pr = PR_GetProfile(i);
|
||||||
|
if (!strcmp(pr->profilename, pname))
|
||||||
|
{
|
||||||
|
usenum++;
|
||||||
|
if (usenum > 'Z' -1)
|
||||||
|
usenum = 'A';
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we got here, then it means the name is okay!
|
||||||
|
if (i == numprofiles-1)
|
||||||
|
nameok = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dprofile = PR_MakeProfile(pname, PROFILEDEFAULTPNAME, PROFILEDEFAULTSKIN, PROFILEDEFAULTCOLOR, PROFILEDEFAULTFOLLOWER, PROFILEDEFAULTFOLLOWERCOLOR, gamecontroldefault);
|
dprofile = PR_MakeProfile(pname, PROFILEDEFAULTPNAME, PROFILEDEFAULTSKIN, PROFILEDEFAULTCOLOR, PROFILEDEFAULTFOLLOWER, PROFILEDEFAULTFOLLOWERCOLOR, gamecontroldefault);
|
||||||
PR_AddProfile(dprofile);
|
PR_AddProfile(dprofile);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue