mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-28 13:21:10 +00:00
Detect if -warp's parm is actually a valid map name (MAPxx or plain number), and print an "invalid map name" message if not
This commit is contained in:
parent
4321757df4
commit
4c4f124611
1 changed files with 4 additions and 3 deletions
|
@ -1060,10 +1060,11 @@ void D_SRB2Main(void)
|
||||||
if (M_CheckParm("-warp") && M_IsNextParm())
|
if (M_CheckParm("-warp") && M_IsNextParm())
|
||||||
{
|
{
|
||||||
const char *word = M_GetNextParm();
|
const char *word = M_GetNextParm();
|
||||||
if (fastncmp(word, "MAP", 3))
|
char ch; // use this with sscanf to catch non-digits with
|
||||||
|
if (fastncmp(word, "MAP", 3)) // MAPxx name
|
||||||
pstartmap = M_MapNumber(word[3], word[4]);
|
pstartmap = M_MapNumber(word[3], word[4]);
|
||||||
else
|
else if (sscanf(word, "%d%c", &pstartmap, &ch) != 1) // a plain number
|
||||||
pstartmap = atoi(word);
|
I_Error("Cannot warp to map %s (invalid map name)\n", word);
|
||||||
// Don't check if lump exists just yet because the wads haven't been loaded!
|
// Don't check if lump exists just yet because the wads haven't been loaded!
|
||||||
// Just do a basic range check here.
|
// Just do a basic range check here.
|
||||||
if (pstartmap < 1 || pstartmap > NUMMAPS)
|
if (pstartmap < 1 || pstartmap > NUMMAPS)
|
||||||
|
|
Loading…
Reference in a new issue