1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-26 00:04:43 +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:
Simon Jarrett
2020-08-12 19:44:59 +01:00
parent 1b821c1059
commit 5f17554c25
13 changed files with 537 additions and 619 deletions

View File

@@ -10,6 +10,7 @@
#pragma once
#include "../common.h"
#include "../core/Json.hpp"
#include "../localisation/Language.h"
#include <string>
@@ -44,6 +45,7 @@ class StringTable
{
private:
std::vector<StringTableEntry> _strings;
static ObjectStringID ParseStringId(const std::string& s);
public:
StringTable() = default;
@@ -51,6 +53,10 @@ public:
StringTable& operator=(const StringTable&) = delete;
void Read(IReadObjectContext* context, OpenRCT2::IStream* stream, ObjectStringID id);
/**
* @note root is deliberately left non-const: json_t behaviour changes when const
*/
void ReadJson(json_t& root);
void Sort();
std::string GetString(ObjectStringID id) const;
std::string GetString(uint8_t language, ObjectStringID id) const;