From 7f6c98f04684fce3e334a803f5f674237c23ce2e Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 5 Dec 2019 13:42:08 +0000 Subject: [PATCH 1/2] Fix clearing maps making the Tutorial option on the SP menu crash. --- src/d_clisrv.c | 7 ++++--- src/dehacked.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 635bd7ee9..734c3a35a 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1301,7 +1301,7 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime) M_Memcpy(netbuffer->u.serverinfo.mapmd5, mapmd5, 16); - if (*mapheaderinfo[gamemap-1]->lvlttl) + if (mapheaderinfo[gamemap-1] && *mapheaderinfo[gamemap-1]->lvlttl) { char *read = mapheaderinfo[gamemap-1]->lvlttl, *writ = netbuffer->u.serverinfo.maptitle; while (writ < (netbuffer->u.serverinfo.maptitle+32) && *read != '\0') @@ -1321,12 +1321,13 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime) netbuffer->u.serverinfo.maptitle[32] = '\0'; - if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE)) + if (mapheaderinfo[gamemap-1] && !(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE)) netbuffer->u.serverinfo.iszone = 1; else netbuffer->u.serverinfo.iszone = 0; - netbuffer->u.serverinfo.actnum = mapheaderinfo[gamemap-1]->actnum; + if (mapheaderinfo[gamemap-1]) + netbuffer->u.serverinfo.actnum = mapheaderinfo[gamemap-1]->actnum; p = PutFileNeeded(); diff --git a/src/dehacked.c b/src/dehacked.c index 40ba0abca..6b790016c 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -286,7 +286,7 @@ static void clear_levels(void) // we may as well try to save some memory, right? for (i = 0; i < NUMMAPS; ++i) { - if (!mapheaderinfo[i]) + if (!mapheaderinfo[i] || i == (tutorialmap-1)) continue; // Custom map header info From 7bd5d291cee7bfa0795c32da94627d2585635b04 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 5 Dec 2019 18:40:30 +0000 Subject: [PATCH 2/2] Fix unlockable checklist literally hanging if any unlockables are cleared. --- src/m_menu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/m_menu.c b/src/m_menu.c index edba61f30..bd96b5d0d 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -6686,7 +6686,10 @@ static void M_DrawChecklist(void) { if (unlockables[i].name[0] == 0 //|| unlockables[i].nochecklist || !unlockables[i].conditionset || unlockables[i].conditionset > MAXCONDITIONSETS) + { + i += 1; continue; + } V_DrawString(currentMenu->x, y, ((unlockables[i].unlocked) ? V_GREENMAP : V_TRANSLUCENT)|V_ALLOWLOWERCASE, ((unlockables[i].unlocked || !unlockables[i].nochecklist) ? unlockables[i].name : M_CreateSecretMenuOption(unlockables[i].name)));