mirror of https://github.com/OpenRCT2/OpenRCT2.git
Write tiles
This commit is contained in:
parent
9ba375f23b
commit
c264bc7b72
|
@ -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<uint32_t>(gMapSize);
|
||||
WriteValue<uint32_t>(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,
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace OpenRCT2
|
|||
uint32_t NumChunks{};
|
||||
uint64_t UncompressedSize{};
|
||||
uint32_t Compression{};
|
||||
std::array<uint8_t, 20> Sha1;
|
||||
std::array<uint8_t, 20> Sha1{};
|
||||
};
|
||||
|
||||
struct ChunkEntry
|
||||
|
@ -61,5 +61,6 @@ namespace OpenRCT2
|
|||
void WriteAuthoringChunk();
|
||||
void WriteObjectsChunk();
|
||||
void WriteGeneralChunk();
|
||||
void WriteTilesChunk();
|
||||
};
|
||||
} // namespace OpenRCT2
|
||||
|
|
Loading…
Reference in New Issue