- fixed: array clamping may only be done when reading a savegame.

- fixed generation of savegame names for level snapshots.
This commit is contained in:
Christoph Oelckers 2016-09-22 11:51:29 +02:00
parent e01965b747
commit 68dc75bf9e
2 changed files with 7 additions and 4 deletions

View file

@ -1571,7 +1571,7 @@ void G_WriteSnapshots(TArray<FString> &filenames, TArray<FCompressedBuffer> &buf
{ {
if (wadlevelinfos[i].Snapshot.mCompressedSize > 0) if (wadlevelinfos[i].Snapshot.mCompressedSize > 0)
{ {
filename << wadlevelinfos[i].MapName << ".map.json"; filename.Format("%s.map.json", wadlevelinfos[i].MapName.GetChars());
filename.ToLower(); filename.ToLower();
filenames.Push(filename); filenames.Push(filename);
buffers.Push(wadlevelinfos[i].Snapshot); buffers.Push(wadlevelinfos[i].Snapshot);
@ -1579,7 +1579,7 @@ void G_WriteSnapshots(TArray<FString> &filenames, TArray<FCompressedBuffer> &buf
} }
if (TheDefaultLevelInfo.Snapshot.mCompressedSize > 0) if (TheDefaultLevelInfo.Snapshot.mCompressedSize > 0)
{ {
filename << TheDefaultLevelInfo.MapName << ".mapd.json"; filename.Format("%s.mapd.json", TheDefaultLevelInfo.MapName.GetChars());
filename.ToLower(); filename.ToLower();
filenames.Push(filename); filenames.Push(filename);
buffers.Push(TheDefaultLevelInfo.Snapshot); buffers.Push(TheDefaultLevelInfo.Snapshot);

View file

@ -110,9 +110,12 @@ public:
} }
if (BeginArray(key)) if (BeginArray(key))
{
if (isReading())
{ {
int max = ArraySize(); int max = ArraySize();
if (max < count) count = max; if (max < count) count = max;
}
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
Serialize(*this, nullptr, obj[i], (T*)nullptr); Serialize(*this, nullptr, obj[i], (T*)nullptr);