Fix osdcmd_changelevel

git-svn-id: https://svn.eduke32.com/eduke32@8397 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-12-07 23:52:13 +00:00 committed by Christoph Oelckers
parent 0b2f550f09
commit f5e3b4bb5a

View file

@ -39,41 +39,29 @@ struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat = { -1, 0, 0 };
static int osdcmd_changelevel(osdcmdptr_t parm)
{
int32_t volume=0,level;
char *p;
int volume = 0;
int level;
if (!VOLUMEONE)
{
if (parm->numparms != 2) return OSDCMD_SHOWHELP;
volume = strtol(parm->parms[0], &p, 10) - 1;
if (p[0]) return OSDCMD_SHOWHELP;
level = strtol(parm->parms[1], &p, 10) - 1;
if (p[0]) return OSDCMD_SHOWHELP;
volume = strtol(parm->parms[0], NULL, 10) - 1;
level = strtol(parm->parms[1], NULL, 10) - 1;
}
else
{
if (parm->numparms != 1) return OSDCMD_SHOWHELP;
level = strtol(parm->parms[0], &p, 10) - 1;
if (p[0]) return OSDCMD_SHOWHELP;
level = strtol(parm->parms[0], NULL, 10) - 1;
}
if (volume < 0) return OSDCMD_SHOWHELP;
if (level < 0) return OSDCMD_SHOWHELP;
if (volume < 0 || level < 0)
return OSDCMD_SHOWHELP;
if (!VOLUMEONE)
if (level > MAXLEVELS || g_mapInfo[volume * MAXLEVELS + level].filename == NULL)
{
if (volume > g_volumeCnt)
{
OSD_Printf("changelevel: invalid volume number (range 1-%d)\n",g_volumeCnt);
return OSDCMD_OK;
}
}
if (level > MAXLEVELS || g_mapInfo[volume *MAXLEVELS+level].filename == NULL)
{
OSD_Printf("changelevel: invalid level number\n");
OSD_Printf("changelevel: no map defined for episode %d level %d\n", volume + 1, level + 1);
return OSDCMD_SHOWHELP;
}
@ -81,6 +69,7 @@ static int osdcmd_changelevel(osdcmdptr_t parm)
{
return OSDCMD_OK;
}
if (g_player[myconnectindex].ps->gm & MODE_GAME)
{
// in-game behave like a cheat