From 68dc75bf9e96e68e946a5f5aa9ee698b0f0f21b5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 22 Sep 2016 11:51:29 +0200 Subject: [PATCH] - fixed: array clamping may only be done when reading a savegame. - fixed generation of savegame names for level snapshots. --- src/g_level.cpp | 4 ++-- src/serializer.h | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/g_level.cpp b/src/g_level.cpp index 43e2cdef1c..a66ed99a9b 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1571,7 +1571,7 @@ void G_WriteSnapshots(TArray &filenames, TArray &buf { if (wadlevelinfos[i].Snapshot.mCompressedSize > 0) { - filename << wadlevelinfos[i].MapName << ".map.json"; + filename.Format("%s.map.json", wadlevelinfos[i].MapName.GetChars()); filename.ToLower(); filenames.Push(filename); buffers.Push(wadlevelinfos[i].Snapshot); @@ -1579,7 +1579,7 @@ void G_WriteSnapshots(TArray &filenames, TArray &buf } if (TheDefaultLevelInfo.Snapshot.mCompressedSize > 0) { - filename << TheDefaultLevelInfo.MapName << ".mapd.json"; + filename.Format("%s.mapd.json", TheDefaultLevelInfo.MapName.GetChars()); filename.ToLower(); filenames.Push(filename); buffers.Push(TheDefaultLevelInfo.Snapshot); diff --git a/src/serializer.h b/src/serializer.h index 1592d41e0d..17d8c970e5 100644 --- a/src/serializer.h +++ b/src/serializer.h @@ -111,8 +111,11 @@ public: if (BeginArray(key)) { - int max = ArraySize(); - if (max < count) count = max; + if (isReading()) + { + int max = ArraySize(); + if (max < count) count = max; + } for (int i = 0; i < count; i++) { Serialize(*this, nullptr, obj[i], (T*)nullptr);