mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-17 12:03:07 +01:00
Split identifier and legacyIdentifier on Object
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Copyright (c) 2014-2019 OpenRCT2 developers
|
||||
* Copyright (c) 2014-2020 OpenRCT2 developers
|
||||
*
|
||||
* For a complete list of all authors, please refer to contributors.md
|
||||
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
||||
@@ -87,7 +87,7 @@ private:
|
||||
IObjectRepository& _objectRepository;
|
||||
const IFileDataRetriever* _fileDataRetriever;
|
||||
|
||||
std::string _objectName;
|
||||
std::string _identifier;
|
||||
bool _loadImages;
|
||||
std::string _basePath;
|
||||
bool _wasWarning = false;
|
||||
@@ -104,15 +104,20 @@ public:
|
||||
}
|
||||
|
||||
ReadObjectContext(
|
||||
IObjectRepository& objectRepository, const std::string& objectName, bool loadImages,
|
||||
IObjectRepository& objectRepository, const std::string& identifier, bool loadImages,
|
||||
const IFileDataRetriever* fileDataRetriever)
|
||||
: _objectRepository(objectRepository)
|
||||
, _fileDataRetriever(fileDataRetriever)
|
||||
, _objectName(objectName)
|
||||
, _identifier(identifier)
|
||||
, _loadImages(loadImages)
|
||||
{
|
||||
}
|
||||
|
||||
std::string_view GetObjectIdentifier() override
|
||||
{
|
||||
return _identifier;
|
||||
}
|
||||
|
||||
IObjectRepository& GetObjectRepository() override
|
||||
{
|
||||
return _objectRepository;
|
||||
@@ -138,7 +143,7 @@ public:
|
||||
|
||||
if (!String::IsNullOrEmpty(text))
|
||||
{
|
||||
Console::Error::WriteLine("[%s] Warning (%d): %s", _objectName.c_str(), code, text);
|
||||
Console::Error::WriteLine("[%s] Warning (%d): %s", _identifier.c_str(), code, text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +153,7 @@ public:
|
||||
|
||||
if (!String::IsNullOrEmpty(text))
|
||||
{
|
||||
Console::Error::WriteLine("[%s] Error (%d): %s", _objectName.c_str(), code, text);
|
||||
Console::Error::WriteLine("[%s] Error (%d): %s", _identifier.c_str(), code, text);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -429,6 +434,7 @@ namespace ObjectFactory
|
||||
std::memcpy(entry.name, originalName.c_str(), minLength);
|
||||
|
||||
result = CreateObject(entry);
|
||||
result->SetIdentifier(id);
|
||||
result->MarkAsJsonObject();
|
||||
auto readContext = ReadObjectContext(objectRepository, id, !gOpenRCT2NoGraphics, fileRetriever);
|
||||
result->ReadJson(&readContext, jRoot);
|
||||
|
||||
Reference in New Issue
Block a user