diff --git a/src/g_level.cpp b/src/g_level.cpp index ad83a2a05..4139362c3 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -86,6 +86,7 @@ #include "serializer.h" #include "vm.h" #include "events.h" +#include "dobjgc.h" #include "gi.h" @@ -1019,7 +1020,7 @@ void G_DoLoadLevel (int position, bool autosave) level.starttime = gametic; G_UnSnapshotLevel (!savegamerestore); // [RH] Restore the state of the level. - G_FinishTravel (); + int pnumerr = G_FinishTravel (); // For each player, if they are viewing through a player, make sure it is themselves. for (int ii = 0; ii < MAXPLAYERS; ++ii) { @@ -1061,6 +1062,10 @@ void G_DoLoadLevel (int position, bool autosave) { DAutosaver GCCNOWARN *dummy = Create(); } + if (pnumerr > 0) + { + I_Error("no start for player %d found.", pnumerr); + } } @@ -1224,13 +1229,14 @@ void G_StartTravel () // //========================================================================== -void G_FinishTravel () +int G_FinishTravel () { TThinkerIterator it (STAT_TRAVELLING); APlayerPawn *pawn, *pawndup, *oldpawn, *next; AInventory *inv; FPlayerStart *start; int pnum; + int failnum = 0; // APlayerPawn* pawns[MAXPLAYERS]; @@ -1257,8 +1263,7 @@ void G_FinishTravel () else { // Could not find a start for this player at all. This really should never happen but if it does, let's better abort. - DThinker::DestroyThinkersInList(STAT_TRAVELLING); - I_Error ("No player %d start to travel to!\n", pnum + 1); + if (failnum == 0) failnum = pnum + 1; } } oldpawn = pawndup; @@ -1286,7 +1291,7 @@ void G_FinishTravel () pawn->Floorclip = pawndup->Floorclip; pawn->waterlevel = pawndup->waterlevel; } - else + else if (failnum == 0) // In the failure case this may run into some undefined data. { P_FindFloorCeiling(pawn); } @@ -1336,6 +1341,7 @@ void G_FinishTravel () // Since this list is excluded from regular thinker cleaning, anything that may survive through here // will endlessly multiply and severely break the following savegames or just simply crash on broken pointers. DThinker::DestroyThinkersInList(STAT_TRAVELLING); + return failnum; } //==========================================================================