I suppose it's probably a good idea not to crash when someone tries telling the game to warp to an undefined map

git-svn-id: https://svn.eduke32.com/eduke32@382 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-12-04 22:22:07 +00:00
parent 57042cd9a7
commit 44e9f75e48

View file

@ -1491,7 +1491,8 @@ void dofrontscreens(char *statustext)
else else
{ {
menutext(160,90,0,0,"ENTERING"); menutext(160,90,0,0,"ENTERING");
menutext(160,90+16+8,0,0,level_names[(ud.volume_number*MAXLEVELS) + ud.level_number]); if (level_names[(ud.volume_number*MAXLEVELS) + ud.level_number] != NULL)
menutext(160,90+16+8,0,0,level_names[(ud.volume_number*MAXLEVELS) + ud.level_number]);
} }
if (statustext) gametext(160,180,statustext,0,2+8+16); if (statustext) gametext(160,180,statustext,0,2+8+16);
@ -1611,13 +1612,6 @@ int enterlevel(char g)
if (VOLUMEALL) Bsprintf(tempbuf,HEAD2); if (VOLUMEALL) Bsprintf(tempbuf,HEAD2);
else Bsprintf(tempbuf,HEAD); else Bsprintf(tempbuf,HEAD);
if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0)
{
Bstrcpy(levname, boardfilename);
Bsprintf(apptitle," - %s",levname);
}
else Bsprintf(apptitle," - %s",level_names[(ud.volume_number*MAXLEVELS)+ud.level_number]);
Bstrcat(tempbuf,apptitle); Bstrcat(tempbuf,apptitle);
wm_setapptitle(tempbuf); wm_setapptitle(tempbuf);
@ -1625,12 +1619,25 @@ int enterlevel(char g)
clearsoundlocks(); clearsoundlocks();
FX_SetReverb(0); FX_SetReverb(0);
if (level_names[(ud.volume_number*MAXLEVELS)+ud.level_number] == NULL || level_file_names[(ud.volume_number*MAXLEVELS)+ud.level_number] == NULL)
{
initprintf("Map E%ldL%ld not defined!\n",ud.volume_number+1,ud.level_number+1);
return 1;
}
i = ud.screen_size; i = ud.screen_size;
ud.screen_size = 0; ud.screen_size = 0;
dofrontscreens(NULL); dofrontscreens(NULL);
vscrn(); vscrn();
ud.screen_size = i; ud.screen_size = i;
if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0)
{
Bstrcpy(levname, boardfilename);
Bsprintf(apptitle," - %s",levname);
}
else Bsprintf(apptitle," - %s",level_names[(ud.volume_number*MAXLEVELS)+ud.level_number]);
if (!VOLUMEONE) if (!VOLUMEONE)
{ {
if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0) if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0)