Fix special map usage

- Free header on `CLEAR LEVELS` even if it's `tutorialmap`
- `titlemap` infinite recursion prevention Z_Free's instead of leaking
This commit is contained in:
toaster 2022-09-23 20:59:02 +01:00
parent f5998c7624
commit fe2757cb44
3 changed files with 3 additions and 5 deletions

View file

@ -149,9 +149,6 @@ void clear_levels(void)
if (!mapheaderinfo[nummapheaders]) if (!mapheaderinfo[nummapheaders])
continue; continue;
if (strcmp(mapheaderinfo[nummapheaders]->lumpname, tutorialmap) == 0) // Sal: Is this needed...?
continue;
// Custom map header info // Custom map header info
// (no need to set num to 0, we're freeing the entire header shortly) // (no need to set num to 0, we're freeing the entire header shortly)
Z_Free(mapheaderinfo[nummapheaders]->customopts); Z_Free(mapheaderinfo[nummapheaders]->customopts);

View file

@ -1865,7 +1865,7 @@ void F_StartTitleScreen(void)
globalweather = mapheaderinfo[titleMapNum]->weather; globalweather = mapheaderinfo[titleMapNum]->weather;
G_DoLoadLevel(true); G_DoLoadLevel(true);
if (!titleMapNum) if (!titlemap)
return; return;
players[displayplayers[0]].playerstate = PST_DEAD; // Don't spawn the player in dummy (I'm still a filthy cheater) players[displayplayers[0]].playerstate = PST_DEAD; // Don't spawn the player in dummy (I'm still a filthy cheater)

View file

@ -1336,7 +1336,8 @@ void G_DoLoadLevel(boolean resetplayer)
//if (W_CheckNumForName(G_BuildMapName(gamemap)) == LUMPERROR) //if (W_CheckNumForName(G_BuildMapName(gamemap)) == LUMPERROR)
if (gamemap < 1 || gamemap > nummapheaders) if (gamemap < 1 || gamemap > nummapheaders)
{ {
titlemap = 0; // let's not infinite recursion ok Z_Free(titlemap);
titlemap = NULL; // let's not infinite recursion ok
Command_ExitGame_f(); Command_ExitGame_f();
return; return;
} }