From 0d68e1d4a92158aa3b7cc80402d224416848a340 Mon Sep 17 00:00:00 2001 From: terminx Date: Tue, 30 Sep 2014 04:03:30 +0000 Subject: [PATCH] Allow old version savegames to "load" by just starting a new game on the volume, level and skill written in the savegame header. git-svn-id: https://svn.eduke32.com/eduke32@4596 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/savegame.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index 8badf3ebd..9f1ca11e7 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -242,7 +242,7 @@ int32_t G_LoadPlayer(int32_t spot) ready2send = 0; i = sv_loadheader(fil, spot, &h); - if (i || h.numplayers!=ud.multimode) + if (i && i != 2 || h.numplayers!=ud.multimode) { if (i == 2 || i == 3) P_DoQuote(QUOTE_SAVE_BAD_VERSION, g_player[myconnectindex].ps); @@ -306,16 +306,22 @@ int32_t G_LoadPlayer(int32_t spot) Bmemcpy(currentboardfilename, boardfilename, BMAX_PATH); - // read the rest... - i = sv_loadsnapshot(fil, spot, &h); - if (i) + if (i == 2) { - // in theory, we could load into an initial dump first and trivially - // recover if things go wrong... - Bsprintf(tempbuf, "Loading save game file \"%s\" failed (code %d), cannot recover.", fn, i); - G_GameExit(tempbuf); + G_NewGame_EnterLevel(); + } + else + { + // read the rest... + i = sv_loadsnapshot(fil, spot, &h); + if (i) + { + // in theory, we could load into an initial dump first and trivially + // recover if things go wrong... + Bsprintf(tempbuf, "Loading save game file \"%s\" failed (code %d), cannot recover.", fn, i); + G_GameExit(tempbuf); + } } - sv_postudload(); // ud.m_XXX = ud.XXX VM_OnEvent(EVENT_LOADGAME, g_player[myconnectindex].ps->i, myconnectindex, -1, 0);