mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 15:52:55 +01:00
Read and write version field of .park
This commit is contained in:
@@ -250,6 +250,7 @@ class Object
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
std::string _identifier;
|
std::string _identifier;
|
||||||
|
std::string _version;
|
||||||
ObjectEntryDescriptor _descriptor{};
|
ObjectEntryDescriptor _descriptor{};
|
||||||
StringTable _stringTable;
|
StringTable _stringTable;
|
||||||
ImageTable _imageTable;
|
ImageTable _imageTable;
|
||||||
@@ -363,6 +364,14 @@ public:
|
|||||||
|
|
||||||
const std::vector<std::string>& GetAuthors() const;
|
const std::vector<std::string>& GetAuthors() const;
|
||||||
void SetAuthors(std::vector<std::string>&& authors);
|
void SetAuthors(std::vector<std::string>&& authors);
|
||||||
|
const std::string& GetVersion() const
|
||||||
|
{
|
||||||
|
return _version;
|
||||||
|
}
|
||||||
|
void SetVersion(const std::string& version)
|
||||||
|
{
|
||||||
|
_version = version;
|
||||||
|
}
|
||||||
|
|
||||||
const ImageTable& GetImageTable() const
|
const ImageTable& GetImageTable() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -521,6 +521,7 @@ namespace ObjectFactory
|
|||||||
if (id == OpenRCT2::Audio::AudioObjectIdentifiers::Rct2cBase)
|
if (id == OpenRCT2::Audio::AudioObjectIdentifiers::Rct2cBase)
|
||||||
id = OpenRCT2::Audio::AudioObjectIdentifiers::Rct2Base;
|
id = OpenRCT2::Audio::AudioObjectIdentifiers::Rct2Base;
|
||||||
|
|
||||||
|
auto version = Json::GetString(jRoot["version"]);
|
||||||
ObjectEntryDescriptor descriptor;
|
ObjectEntryDescriptor descriptor;
|
||||||
auto originalId = Json::GetString(jRoot["originalId"]);
|
auto originalId = Json::GetString(jRoot["originalId"]);
|
||||||
if (originalId.length() == 8 + 1 + 8 + 1 + 8)
|
if (originalId.length() == 8 + 1 + 8 + 1 + 8)
|
||||||
@@ -539,8 +540,9 @@ namespace ObjectFactory
|
|||||||
{
|
{
|
||||||
descriptor = ObjectEntryDescriptor(objectType, id);
|
descriptor = ObjectEntryDescriptor(objectType, id);
|
||||||
}
|
}
|
||||||
|
descriptor.Version = version;
|
||||||
result = CreateObject(objectType);
|
result = CreateObject(objectType);
|
||||||
|
result->SetVersion(version);
|
||||||
result->SetIdentifier(id);
|
result->SetIdentifier(id);
|
||||||
result->SetDescriptor(descriptor);
|
result->SetDescriptor(descriptor);
|
||||||
result->MarkAsJsonObject();
|
result->MarkAsJsonObject();
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ public:
|
|||||||
item.Generation = object->GetGeneration();
|
item.Generation = object->GetGeneration();
|
||||||
item.Identifier = object->GetIdentifier();
|
item.Identifier = object->GetIdentifier();
|
||||||
item.ObjectEntry = object->GetObjectEntry();
|
item.ObjectEntry = object->GetObjectEntry();
|
||||||
|
item.Version = object->GetVersion();
|
||||||
item.Path = path;
|
item.Path = path;
|
||||||
item.Name = object->GetName();
|
item.Name = object->GetName();
|
||||||
item.Authors = object->GetAuthors();
|
item.Authors = object->GetAuthors();
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ struct ObjectRepositoryItem
|
|||||||
rct_object_entry ObjectEntry;
|
rct_object_entry ObjectEntry;
|
||||||
std::string Path;
|
std::string Path;
|
||||||
std::string Name;
|
std::string Name;
|
||||||
|
std::string Version;
|
||||||
std::vector<std::string> Authors;
|
std::vector<std::string> Authors;
|
||||||
std::vector<ObjectSourceGame> Sources;
|
std::vector<ObjectSourceGame> Sources;
|
||||||
std::shared_ptr<Object> LoadedObject{};
|
std::shared_ptr<Object> LoadedObject{};
|
||||||
|
|||||||
@@ -388,7 +388,7 @@ namespace OpenRCT2
|
|||||||
{
|
{
|
||||||
cs.Write(DESCRIPTOR_JSON);
|
cs.Write(DESCRIPTOR_JSON);
|
||||||
cs.Write(entry.Identifier);
|
cs.Write(entry.Identifier);
|
||||||
cs.Write(""); // reserved for version
|
cs.Write(entry.Version);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user