From 9ab0164b6f8f6a6a24a8b4e28910beefd94f09b7 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Tue, 5 Dec 2017 13:35:39 +0100 Subject: [PATCH] Fix compiling and loading on macOS, load description --- src/openrct2/object/ObjectFactory.cpp | 2 +- src/openrct2/object/RideObject.cpp | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/openrct2/object/ObjectFactory.cpp b/src/openrct2/object/ObjectFactory.cpp index fd3fbc3466..6039d01fc1 100644 --- a/src/openrct2/object/ObjectFactory.cpp +++ b/src/openrct2/object/ObjectFactory.cpp @@ -235,7 +235,7 @@ namespace ObjectFactory } catch (Exception) { - Console::Error::WriteLine("Unable to open or read '%s'", path); + Console::Error::WriteLine("Unable to open or read '%s'", path.c_str()); delete result; result = nullptr; diff --git a/src/openrct2/object/RideObject.cpp b/src/openrct2/object/RideObject.cpp index 840ea94f72..5cf2c6271c 100644 --- a/src/openrct2/object/RideObject.cpp +++ b/src/openrct2/object/RideObject.cpp @@ -540,16 +540,24 @@ void RideObject::ReadJson(IReadObjectContext * context, const json_t * root) _legacyType.category[0] = RIDE_CATEGORY_SHOP; auto stringTable = GetStringTable(); + auto jsonStrings = json_object_get(root, "strings"); + auto jsonDescription = json_object_get(jsonStrings, "description"); + auto enDescription = json_object_get(jsonDescription, "en-GB"); + stringTable->SetString(0, 0, "RCT1 toilets"); - stringTable->SetString(1, 0, "Desc"); + stringTable->SetString(1, 0, String::Duplicate(json_string_value(enDescription))); stringTable->SetString(2, 0, "Capacity"); stringTable->SetString(3, 0, "Vehicle"); auto imageTable = GetImageTable(); - auto g1 = *(gfx_get_g1_element(0x60000 + 64231)); - // auto g12 = gfx_get_g1_element(0x60000 + 64322); - // imageTable->AddImage(g1, (size_t)(g12->offset - g1->offset)); - g1.x_offset = 0; - g1.y_offset = 0; - imageTable->AddImage(&g1, 0x4000); + + if (is_csg_loaded()) + { + auto g1 = *(gfx_get_g1_element(0x60000 + 64231)); + // auto g12 = gfx_get_g1_element(0x60000 + 64322); + // imageTable->AddImage(g1, (size_t)(g12->offset - g1->offset)); + g1.x_offset = 0; + g1.y_offset = 0; + imageTable->AddImage(&g1, 0x4000); + } }