mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- fixed some errors with parsing globals.json. It looks like this file is being processed correctly now.
This commit is contained in:
parent
d9dbf26f63
commit
c22e8c50af
4 changed files with 38 additions and 34 deletions
|
@ -1926,11 +1926,11 @@ void G_DoLoadGame ()
|
|||
// we are done with info.json.
|
||||
arc.Close();
|
||||
|
||||
info = resfile->FindLump("global.json");
|
||||
info = resfile->FindLump("globals.json");
|
||||
if (info == nullptr)
|
||||
{
|
||||
delete resfile;
|
||||
Printf("'%s' is not a valid savegame: Missing 'global.json'.\n", savename.GetChars());
|
||||
Printf("'%s' is not a valid savegame: Missing 'globals.json'.\n", savename.GetChars());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1948,14 +1948,15 @@ void G_DoLoadGame ()
|
|||
|
||||
bglobal.RemoveAllBots (true);
|
||||
|
||||
arc("importantcvars", map);
|
||||
if (!map.IsEmpty())
|
||||
FString cvar;
|
||||
arc("importantcvars",cvar);
|
||||
if (!cvar.IsEmpty())
|
||||
{
|
||||
BYTE *vars_p = (BYTE *)map.GetChars();
|
||||
BYTE *vars_p = (BYTE *)cvar.GetChars();
|
||||
C_ReadCVars (&vars_p);
|
||||
}
|
||||
|
||||
DWORD time[2] = { 0,1 };
|
||||
DWORD time[2] = { 1,0 };
|
||||
|
||||
arc("ticrate", time[0])
|
||||
("leveltime", time[1]);
|
||||
|
@ -1970,7 +1971,6 @@ void G_DoLoadGame ()
|
|||
bool demoplaybacksave = demoplayback;
|
||||
G_InitNew (map, false);
|
||||
demoplayback = demoplaybacksave;
|
||||
delete[] map;
|
||||
savegamerestore = false;
|
||||
|
||||
STAT_Serialize(arc);
|
||||
|
@ -1981,7 +1981,8 @@ void G_DoLoadGame ()
|
|||
NextSkill = -1;
|
||||
arc("nextskill", NextSkill);
|
||||
|
||||
level.info->Snapshot.Clean();
|
||||
if (level.info != nullptr)
|
||||
level.info->Snapshot.Clean();
|
||||
|
||||
BackupSaveName = savename;
|
||||
|
||||
|
|
|
@ -353,8 +353,8 @@ void FRandom::StaticReadRNGState(FSerializer &arc)
|
|||
}
|
||||
arc.EndObject();
|
||||
}
|
||||
arc.EndArray();
|
||||
}
|
||||
arc.EndArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -725,36 +725,39 @@ void ACSStringPool::ReadStrings(FSerializer &file, const char *key)
|
|||
{
|
||||
Clear();
|
||||
|
||||
int poolsize;
|
||||
if (file.BeginObject(key))
|
||||
{
|
||||
int poolsize = 0;
|
||||
|
||||
file("poolsize", poolsize);
|
||||
Pool.Resize(poolsize);
|
||||
for (auto &p : Pool)
|
||||
{
|
||||
p.Next = FREE_ENTRY;
|
||||
p.LockCount = 0;
|
||||
}
|
||||
if (file.BeginArray("pool"))
|
||||
{
|
||||
int j = file.ArraySize();
|
||||
for (int i = 0; i < j; i++)
|
||||
file("poolsize", poolsize);
|
||||
Pool.Resize(poolsize);
|
||||
for (auto &p : Pool)
|
||||
{
|
||||
if (file.BeginObject(nullptr))
|
||||
p.Next = FREE_ENTRY;
|
||||
p.LockCount = 0;
|
||||
}
|
||||
if (file.BeginArray("pool"))
|
||||
{
|
||||
int j = file.ArraySize();
|
||||
for (int i = 0; i < j; i++)
|
||||
{
|
||||
unsigned ii = UINT_MAX;
|
||||
file("index", ii);
|
||||
if (ii < Pool.Size())
|
||||
if (file.BeginObject(nullptr))
|
||||
{
|
||||
file("string", Pool[ii].Str)
|
||||
("lockcount", Pool[ii].LockCount);
|
||||
unsigned ii = UINT_MAX;
|
||||
file("index", ii);
|
||||
if (ii < Pool.Size())
|
||||
{
|
||||
file("string", Pool[ii].Str)
|
||||
("lockcount", Pool[ii].LockCount);
|
||||
|
||||
unsigned h = SuperFastHash(Pool[ii].Str, Pool[ii].Str.Len());
|
||||
unsigned bucketnum = h % NUM_BUCKETS;
|
||||
Pool[ii].Hash = h;
|
||||
Pool[ii].Next = PoolBuckets[bucketnum];
|
||||
PoolBuckets[bucketnum] = i;
|
||||
unsigned h = SuperFastHash(Pool[ii].Str, Pool[ii].Str.Len());
|
||||
unsigned bucketnum = h % NUM_BUCKETS;
|
||||
Pool[ii].Hash = h;
|
||||
Pool[ii].Next = PoolBuckets[bucketnum];
|
||||
PoolBuckets[bucketnum] = i;
|
||||
}
|
||||
file.EndObject();
|
||||
}
|
||||
file.EndObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,6 @@ struct FJSONObject
|
|||
else if (v->IsArray())
|
||||
{
|
||||
mIndex = 0;
|
||||
mIterator = v->MemberEnd();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -717,6 +716,7 @@ unsigned FSerializer::GetSize(const char *group)
|
|||
const char *FSerializer::GetKey()
|
||||
{
|
||||
if (isWriting()) return nullptr; // we do not know this when writing.
|
||||
if (!r->mObjects.Last().mObject->IsObject()) return nullptr; // non-objects do not have keys.
|
||||
auto &it = r->mObjects.Last().mIterator;
|
||||
if (it == r->mObjects.Last().mObject->MemberEnd()) return nullptr;
|
||||
return it->name.GetString();
|
||||
|
|
Loading…
Reference in a new issue