diff --git a/src/openrct2/ParkFile.cpp b/src/openrct2/ParkFile.cpp index 4445f192a8..ebec01b35d 100644 --- a/src/openrct2/ParkFile.cpp +++ b/src/openrct2/ParkFile.cpp @@ -63,6 +63,7 @@ void ParkFile::Save(const std::string_view& path) WriteAuthoringChunk(); WriteObjectsChunk(); WriteGeneralChunk(); + WriteTilesChunk(); // TODO avoid copying the buffer auto uncompressedData = _buffer.str(); @@ -217,6 +218,22 @@ void ParkFile::WriteGeneralChunk() EndChunk(); } +void ParkFile::WriteTilesChunk() +{ + BeginChunk(ParkFileChunkType::TILES); + WriteValue(gMapSize); + WriteValue(gMapSize); + BeginArray(); + auto numTiles = (size_t)gMapSize * gMapSize; + for (size_t i = 0; i < numTiles; i++) + { + WriteBuffer(&gTileElements[i], sizeof(gTileElements[i])); + NextArrayElement(); + } + EndArray(); + EndChunk(); +} + enum : uint32_t { S6_SAVE_FLAG_EXPORT = 1 << 0, diff --git a/src/openrct2/ParkFile.h b/src/openrct2/ParkFile.h index 8e599b20ec..fb8bb24084 100644 --- a/src/openrct2/ParkFile.h +++ b/src/openrct2/ParkFile.h @@ -22,7 +22,7 @@ namespace OpenRCT2 uint32_t NumChunks{}; uint64_t UncompressedSize{}; uint32_t Compression{}; - std::array Sha1; + std::array Sha1{}; }; struct ChunkEntry @@ -61,5 +61,6 @@ namespace OpenRCT2 void WriteAuthoringChunk(); void WriteObjectsChunk(); void WriteGeneralChunk(); + void WriteTilesChunk(); }; } // namespace OpenRCT2