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:
Simon Jarrett committed 2020-09-16 20:18:53 +01:00
1 parent 1b821c1059
commit 5f17554c25
13 files changed
+537 -619

No files matched your search

+15
View File
@@ -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();