Minor changes

This commit is contained in:
Lactozilla 2023-06-27 22:16:44 -03:00
parent cb002c0fa6
commit 2e618915db
2 changed files with 9 additions and 6 deletions

View file

@ -1848,7 +1848,7 @@ void D_AddWorld(INT32 mapnum)
char buf[MAX_WADPATH+1]; char buf[MAX_WADPATH+1];
char *buf_p = buf; 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); I_Assert(W_CheckNumForName(mapname) != LUMPERROR);

View file

@ -5107,29 +5107,32 @@ boolean G_LoadWorld(const char *mapname)
INT16 mapnum = (INT16)M_MapNumber(mapname[3], mapname[4]); // get xx out of MAPxx 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, // gamemap changed; we assume that its map header is always valid,
// so make it so // so make it so
if(!mapheaderinfo[mapnum-1]) if(!mapheaderinfo[mapnum-1])
P_AllocMapHeader(mapnum-1); P_AllocMapHeader(mapnum-1);
LUA_HookInt(mapnum, HOOK(MapChange));
nextmapheader = mapheaderinfo[mapnum-1]; nextmapheader = mapheaderinfo[mapnum-1];
worldmapheader = nextmapheader; worldmapheader = nextmapheader;
world_t *curworld = world;
if (!P_LoadWorld(mapnum, false)) 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); CONS_Alert(CONS_ERROR, "G_LoadWorld: Could not load map '%s'\n", mapname);
return false; return false;
} }
// Change world back to the previous one
P_SetWorld(curworld);
#ifdef PARANOIA #ifdef PARANOIA
Z_CheckHeap(-2); Z_CheckHeap(-2);
#endif #endif
// change world back to yours, for consistency
P_SetWorld(localworld);
return true; return true;
} }