- saved the wrong version.

This commit is contained in:
Christoph Oelckers 2017-04-25 21:05:36 +02:00
parent 090502b243
commit f866e0f02f
1 changed files with 11 additions and 5 deletions

View File

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