Store cheats in save file

This commit is contained in:
Matt 2020-02-08 12:30:12 +01:00 committed by Ted John
parent a802dce8d8
commit 79d1f06447
1 changed files with 13 additions and 0 deletions

View File

@ -7,12 +7,14 @@
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include "Cheats.h"
#include "Context.h"
#include "GameState.h"
#include "OpenRCT2.h"
#include "ParkImporter.h"
#include "Version.h"
#include "core/Crypt.h"
#include "core/DataSerialiser.h"
#include "core/OrcaStream.hpp"
#include "drawing/Drawing.h"
#include "interface/Viewport.h"
@ -73,6 +75,7 @@ namespace OpenRCT2
constexpr uint32_t BANNERS = 0x33;
constexpr uint32_t ANIMATIONS = 0x34;
constexpr uint32_t STAFF = 0x35;
constexpr uint32_t CHEATS = 0x36;
constexpr uint32_t DERIVED = 0x50;
// clang-format on
@ -108,6 +111,7 @@ namespace OpenRCT2
ReadWriteResearchChunk(os);
ReadWriteNotificationsChunk(os);
ReadWriteInterfaceChunk(os);
ReadWriteCheatsChunk(os);
// Initial cash will eventually be removed
gInitialCash = gCash;
@ -139,6 +143,7 @@ namespace OpenRCT2
ReadWriteResearchChunk(os);
ReadWriteNotificationsChunk(os);
ReadWriteInterfaceChunk(os);
ReadWriteCheatsChunk(os);
}
private:
@ -294,6 +299,14 @@ namespace OpenRCT2
});
}
void ReadWriteCheatsChunk(OrcaStream& os)
{
os.ReadWriteChunk(ParkFileChunkType::CHEATS, [](OrcaStream::ChunkStream& cs) {
DataSerialiser ds(cs.GetMode() == OrcaStream::Mode::WRITING, cs.GetStream());
CheatsSerialise(ds);
});
}
void ReadWriteClimateChunk(OrcaStream& os)
{
os.ReadWriteChunk(ParkFileChunkType::CLIMATE, [](OrcaStream::ChunkStream& cs) {