Warn if the gametype is not valid at all!

This commit is contained in:
James R 2019-11-13 14:31:44 -08:00
parent 359d8a2c25
commit 7776c59cdd

View file

@ -1905,10 +1905,22 @@ static void Command_Map_f(void)
if (newgametype == -1) // reached end of the list with no match
{
d = atoi(gametypename);
// assume they gave us a gametype number, which is okay too
if (d >= 0 && d < NUMGAMETYPES)
newgametype = d;
/* Did they give us a gametype number? That's okay too! */
if (isdigit(gametypename[0]))
{
d = atoi(gametypename);
if (d >= 0 && d < NUMGAMETYPES)
newgametype = d;
}
else
{
CONS_Alert(CONS_ERROR,
"'%s' is not a gametype.\n",
gametypename);
Z_Free(realmapname);
Z_Free(mapname);
return;
}
}
}