From 2e618915dbfa53d9051745f8c987c78607fc2cc2 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Tue, 27 Jun 2023 22:16:44 -0300 Subject: [PATCH] Minor changes --- src/d_netcmd.c | 2 +- src/g_game.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 1905afa0f..0019bc953 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1848,7 +1848,7 @@ void D_AddWorld(INT32 mapnum) char buf[MAX_WADPATH+1]; char *buf_p = buf; - CONS_Debug(DBG_GAMELOGIC, "Map change: mapnum=%d\n", mapnum); + CONS_Debug(DBG_GAMELOGIC, "New world: mapnum=%d\n", mapnum); I_Assert(W_CheckNumForName(mapname) != LUMPERROR); diff --git a/src/g_game.c b/src/g_game.c index 270561eee..ed6479f5b 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -5107,29 +5107,32 @@ boolean G_LoadWorld(const char *mapname) INT16 mapnum = (INT16)M_MapNumber(mapname[3], mapname[4]); // get xx out of MAPxx - LUA_HookInt(mapnum, HOOK(MapChange)); - // gamemap changed; we assume that its map header is always valid, // so make it so if(!mapheaderinfo[mapnum-1]) P_AllocMapHeader(mapnum-1); + LUA_HookInt(mapnum, HOOK(MapChange)); + nextmapheader = mapheaderinfo[mapnum-1]; worldmapheader = nextmapheader; + world_t *curworld = world; + if (!P_LoadWorld(mapnum, false)) { + P_SetWorld(curworld); // Change world back to the previous one CONS_Alert(CONS_ERROR, "G_LoadWorld: Could not load map '%s'\n", mapname); return false; } + // Change world back to the previous one + P_SetWorld(curworld); + #ifdef PARANOIA Z_CheckHeap(-2); #endif - // change world back to yours, for consistency - P_SetWorld(localworld); - return true; }