diff --git a/src/g_level.cpp b/src/g_level.cpp index 43e2cdef1..a66ed99a9 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 1592d41e0..17d8c970e 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);