- Fixed: The conversion of the strings in wbstartstruct_t to FStrings

caused crashes when reloading the hub data.


SVN r1181 (trunk)
This commit is contained in:
Christoph Oelckers 2008-08-21 19:06:17 +00:00
parent 72fe857acb
commit 39bb50376a
3 changed files with 32 additions and 6 deletions

View file

@ -1,4 +1,6 @@
August 21, 2008 (Changes by Graf Zahl) August 21, 2008 (Changes by Graf Zahl)
- Fixed: The conversion of the strings in wbstartstruct_t to FStrings
caused crashes when reloading the hub data.
- Replaced WALLF_AUTOCONTRAST with WALLF_NOFAKECONTRAST so that the - Replaced WALLF_AUTOCONTRAST with WALLF_NOFAKECONTRAST so that the
default setting for the flags is 0. default setting for the flags is 0.
- Added: doom2day's smoothlighting - Added: doom2day's smoothlighting

View file

@ -50,7 +50,31 @@
// //
//========================================================================== //==========================================================================
TArray<wbstartstruct_t> hubdata; struct FHubInfo
{
int finished_ep;
int maxkills;
int maxitems;
int maxsecret;
int maxfrags;
wbplayerstruct_s plyr[MAXPLAYERS];
FHubInfo &operator=(const wbstartstruct_t &wbs)
{
finished_ep = wbs.finished_ep;
maxkills = wbs.maxkills;
maxsecret= wbs.maxsecret;
maxitems = wbs.maxitems;
maxfrags = wbs.maxfrags;
memcpy(plyr, wbs.plyr, sizeof(plyr));
return *this;
}
};
TArray<FHubInfo> hubdata;
void G_LeavingHub(int mode, cluster_info_t * cluster, wbstartstruct_t * wbs) void G_LeavingHub(int mode, cluster_info_t * cluster, wbstartstruct_t * wbs)
{ {
@ -68,13 +92,13 @@ void G_LeavingHub(int mode, cluster_info_t * cluster, wbstartstruct_t * wbs)
} }
if (i==hubdata.Size()) if (i==hubdata.Size())
{ {
hubdata.Push(*wbs); hubdata[hubdata.Reserve(1)] = *wbs;
} }
hubdata[i].finished_ep=level.levelnum; hubdata[i].finished_ep=level.levelnum;
if (!multiplayer && !deathmatch) if (!multiplayer && !deathmatch)
{ {
// The player counters don't work in hubs! // The player counters don't work in hubs
hubdata[i].plyr[0].skills=level.killed_monsters; hubdata[i].plyr[0].skills=level.killed_monsters;
hubdata[i].plyr[0].sitems=level.found_items; hubdata[i].plyr[0].sitems=level.found_items;
hubdata[i].plyr[0].ssecret=level.found_secrets; hubdata[i].plyr[0].ssecret=level.found_secrets;
@ -131,11 +155,11 @@ static void G_SerializeHub(FArchive & arc)
arc << i; arc << i;
if (i>0) if (i>0)
{ {
if (arc.IsStoring()) arc.Write(&hubdata[0], i * sizeof(wbstartstruct_t)); if (arc.IsStoring()) arc.Write(&hubdata[0], i * sizeof(FHubInfo));
else else
{ {
hubdata.Resize(i); hubdata.Resize(i);
arc.Read(&hubdata[0], i * sizeof(wbstartstruct_t)); arc.Read(&hubdata[0], i * sizeof(FHubInfo));
} }
} }
else hubdata.Clear(); else hubdata.Clear();

View file

@ -75,7 +75,7 @@
// SAVESIG should match SAVEVER. // SAVESIG should match SAVEVER.
// MINSAVEVER is the minimum level snapshot version that can be loaded. // MINSAVEVER is the minimum level snapshot version that can be loaded.
#define MINSAVEVER 1179 #define MINSAVEVER 1181
#if SVN_REVISION_NUMBER < MINSAVEVER #if SVN_REVISION_NUMBER < MINSAVEVER
// Never write a savegame with a version lower than what we need // Never write a savegame with a version lower than what we need