From 656cdda39978f0788a83f9839ae6896b31a74091 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Mon, 26 Oct 2020 21:34:46 +0100 Subject: [PATCH] Add JSON identifier to object repository --- src/openrct2/object/ObjectRepository.cpp | 5 ++++- src/openrct2/object/ObjectRepository.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/openrct2/object/ObjectRepository.cpp b/src/openrct2/object/ObjectRepository.cpp index e0884aaecd..6cfbdce0d3 100644 --- a/src/openrct2/object/ObjectRepository.cpp +++ b/src/openrct2/object/ObjectRepository.cpp @@ -74,7 +74,7 @@ class ObjectFileIndex final : public FileIndex { private: static constexpr uint32_t MAGIC_NUMBER = 0x5844494F; // OIDX - static constexpr uint16_t VERSION = 21; + static constexpr uint16_t VERSION = 22; static constexpr auto PATTERN = "*.dat;*.pob;*.json;*.parkobj"; IObjectRepository& _objectRepository; @@ -111,6 +111,7 @@ public: if (object != nullptr) { ObjectRepositoryItem item = {}; + item.Identifier = object->GetIdentifier(); item.ObjectEntry = *object->GetObjectEntry(); item.Path = path; item.Name = object->GetName(); @@ -125,6 +126,7 @@ public: protected: void Serialise(IStream* stream, const ObjectRepositoryItem& item) const override { + stream->WriteValue(item.Identifier); stream->WriteValue(item.ObjectEntry); stream->WriteString(item.Path); stream->WriteString(item.Name); @@ -170,6 +172,7 @@ protected: { ObjectRepositoryItem item; + item.Identifier = stream->ReadStdString(); item.ObjectEntry = stream->ReadValue(); item.Path = stream->ReadStdString(); item.Name = stream->ReadStdString(); diff --git a/src/openrct2/object/ObjectRepository.h b/src/openrct2/object/ObjectRepository.h index 503e282d21..6670395e24 100644 --- a/src/openrct2/object/ObjectRepository.h +++ b/src/openrct2/object/ObjectRepository.h @@ -37,6 +37,7 @@ struct rct_drawpixelinfo; struct ObjectRepositoryItem { size_t Id; + std::string Identifier; // e.g. rct2.c3d rct_object_entry ObjectEntry; std::string Path; std::string Name;