mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-04 13:42:55 +01:00
Refactor ObjectJsonHelpers
Move functions in ObjectJsonHelpers to their relevant namespaces and classes - Move ParseColour to Colour::FromString - Move ParseCursor to Cursor::FromString - Move LoadStrings to StringTable::ReadJson - Move LoadImages to ImageTable::ReadJson - Move ParseObjectEntry to Object::ParseObjectEntry - Move GetString, etc. to Json::GetString, etc. - Delete ObjectJsonHelpers .cpp and .h files
This commit is contained in:
@@ -37,6 +37,21 @@ void Object::ReadLegacy(IReadObjectContext* context, OpenRCT2::IStream* stream)
|
||||
throw std::runtime_error("Not supported.");
|
||||
}
|
||||
|
||||
void Object::PopulateTablesFromJson(IReadObjectContext* context, json_t& root)
|
||||
{
|
||||
_stringTable.ReadJson(root);
|
||||
_imageTable.ReadJson(context, root);
|
||||
}
|
||||
|
||||
rct_object_entry Object::ParseObjectEntry(const std::string& s)
|
||||
{
|
||||
rct_object_entry entry = {};
|
||||
std::fill_n(entry.name, sizeof(entry.name), ' ');
|
||||
auto copyLen = std::min<size_t>(8, s.size());
|
||||
std::copy_n(s.c_str(), copyLen, entry.name);
|
||||
return entry;
|
||||
}
|
||||
|
||||
std::string Object::GetOverrideString(uint8_t index) const
|
||||
{
|
||||
auto legacyIdentifier = GetLegacyIdentifier();
|
||||
|
||||
Reference in New Issue
Block a user