Use GP difficulty str values instead of hardcoded "Master" exception

This commit is contained in:
toaster 2022-10-11 16:41:48 +01:00
parent 44eb099cfb
commit dbc067f87a
2 changed files with 22 additions and 39 deletions

View file

@ -1801,29 +1801,20 @@ void D_SRB2Main(void)
INT16 newskill = -1;
const char *sskill = M_GetNextParm();
const char *masterstr = "Master";
if (!strcasecmp(masterstr, sskill))
for (j = 0; gpdifficulty_cons_t[j].strvalue; j++)
{
newskill = KARTGP_MASTER;
if (!strcasecmp(gpdifficulty_cons_t[j].strvalue, sskill))
{
newskill = (INT16)gpdifficulty_cons_t[j].value;
break;
}
}
else
{
for (j = 0; kartspeed_cons_t[j].strvalue; j++)
{
if (!strcasecmp(kartspeed_cons_t[j].strvalue, sskill))
{
newskill = (INT16)kartspeed_cons_t[j].value;
break;
}
}
if (!kartspeed_cons_t[j].strvalue) // reached end of the list with no match
{
j = atoi(sskill); // assume they gave us a skill number, which is okay too
if (j >= KARTSPEED_EASY && j <= KARTGP_MASTER)
newskill = (INT16)j;
}
if (!gpdifficulty_cons_t[j].strvalue) // reached end of the list with no match
{
j = atoi(sskill); // assume they gave us a skill number, which is okay too
if (j >= KARTSPEED_EASY && j <= KARTGP_MASTER)
newskill = (INT16)j;
}
if (grandprixinfo.gp == true)

View file

@ -2967,32 +2967,24 @@ static void Command_Map_f(void)
if (option_skill)
{
const char *masterstr = "Master";
const char *skillname = COM_Argv(option_skill + 1);
INT32 newskill = -1;
INT32 j;
if (!strcasecmp(masterstr, skillname))
for (j = 0; gpdifficulty_cons_t[j].strvalue; j++)
{
newskill = KARTGP_MASTER;
if (!strcasecmp(gpdifficulty_cons_t[j].strvalue, skillname))
{
newskill = (INT16)gpdifficulty_cons_t[j].value;
break;
}
}
else
{
for (j = 0; kartspeed_cons_t[j].strvalue; j++)
{
if (!strcasecmp(kartspeed_cons_t[j].strvalue, skillname))
{
newskill = (INT16)kartspeed_cons_t[j].value;
break;
}
}
if (!kartspeed_cons_t[j].strvalue) // reached end of the list with no match
{
INT32 num = atoi(COM_Argv(option_skill + 1)); // assume they gave us a skill number, which is okay too
if (num >= KARTSPEED_EASY && num <= KARTGP_MASTER)
newskill = (INT16)num;
}
if (!gpdifficulty_cons_t[j].strvalue) // reached end of the list with no match
{
INT32 num = atoi(COM_Argv(option_skill + 1)); // assume they gave us a skill number, which is okay too
if (num >= KARTSPEED_EASY && num <= KARTGP_MASTER)
newskill = (INT16)num;
}
if (newskill != -1)