From 8b40162871cc193bf7895f273a0d1b483cc3fb65 Mon Sep 17 00:00:00 2001 From: Ted John Date: Sat, 24 Apr 2021 17:25:52 +0100 Subject: [PATCH] Update title inspector for footpaths --- data/language/en-GB.txt | 2 ++ src/openrct2-ui/windows/TileInspector.cpp | 42 ++++++++++++++++++----- src/openrct2/localisation/StringIds.h | 2 ++ 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index 588b2b4ed1..d70553c4fc 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -3684,6 +3684,8 @@ STR_6441 :At least one footpath queue surface object must be selected. STR_6442 :At least one footpath railing object must be selected. STR_6443 :Footpath Surfaces STR_6444 :Footpath Railings +STR_6445 :{WINDOW_COLOUR_2}Surface name: {BLACK}{STRINGID} +STR_6446 :{WINDOW_COLOUR_2}Railing name: {BLACK}{STRINGID} ############# # Scenarios # diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index dcd4dc865a..c1ca934451 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -19,6 +19,8 @@ #include #include #include +#include +#include #include #include #include @@ -262,7 +264,7 @@ static rct_widget SurfaceWidgets[] = { constexpr int32_t PAT_GBPB = PADDING_BOTTOM; // Path group box properties bottom constexpr int32_t PAT_GBPT = PAT_GBPB + 16 + 5 * 21; // Path group box properties top constexpr int32_t PAT_GBDB = PAT_GBPT + GROUPBOX_PADDING; // Path group box info bottom -constexpr int32_t PAT_GBDT = PAT_GBDB + 20 + 2 * 11; // Path group box info top +constexpr int32_t PAT_GBDT = PAT_GBDB + 20 + 3 * 11; // Path group box info top static rct_widget PathWidgets[] = { MAIN_TILE_INSPECTOR_WIDGETS, SPINNER_WIDGETS (1, GBBL(1), GBBR(1), GBBT(WH - PAT_GBPT, 0) + 3, GBBB(WH - PAT_GBPT, 0) - 3, STR_NONE, STR_NONE), // WIDX_PATH_SPINNER_HEIGHT{,_INCREASE,_DECREASE} @@ -1813,13 +1815,35 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi) case TILE_ELEMENT_TYPE_PATH: { // Details - // Path name auto pathEl = tileElement->AsPath(); - auto surfaceObj = pathEl->GetSurfaceEntry(); - if (surfaceObj != nullptr) + auto footpathObj = pathEl->GetPathEntry(); + if (footpathObj == nullptr) { - rct_string_id pathNameId = surfaceObj->NameStringId; - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_PATH_NAME, &pathNameId, { COLOUR_WHITE }); + // Surface name + auto surfaceObj = pathEl->GetSurfaceEntry(); + if (surfaceObj != nullptr) + { + auto surfaceNameId = surfaceObj->NameStringId; + DrawTextBasic( + dpi, screenCoords, STR_TILE_INSPECTOR_FOOTPATH_SURFACE_NAME, &surfaceNameId, { COLOUR_WHITE }); + } + + // Railings name + auto railingsObj = pathEl->GetRailingEntry(); + if (railingsObj != nullptr) + { + auto railingNameId = railingsObj->NameStringId; + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_FOOTPATH_RAILINGS_NAME, + &railingNameId, { COLOUR_WHITE }); + } + } + else + { + // Legacy path name + auto footpathEntry = reinterpret_cast(footpathObj->GetLegacyData()); + auto footpathNameId = footpathEntry->string_idx; + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_PATH_NAME, &footpathNameId, { COLOUR_WHITE }); } // Path addition @@ -1831,13 +1855,15 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi) ? sceneryElement->name : static_cast(STR_UNKNOWN_OBJECT_TYPE); DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_PATH_ADDITIONS, &additionNameId, + dpi, screenCoords + ScreenCoordsXY{ 0, 2 * 11 }, STR_TILE_INSPECTOR_PATH_ADDITIONS, &additionNameId, { COLOUR_WHITE }); } else + { DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_PATH_ADDITIONS_NONE, {}, + dpi, screenCoords + ScreenCoordsXY{ 0, 2 * 11 }, STR_TILE_INSPECTOR_PATH_ADDITIONS_NONE, {}, { COLOUR_WHITE }); + } // Properties // Raise / lower label diff --git a/src/openrct2/localisation/StringIds.h b/src/openrct2/localisation/StringIds.h index 7048e4fbea..7e39722ada 100644 --- a/src/openrct2/localisation/StringIds.h +++ b/src/openrct2/localisation/StringIds.h @@ -3943,6 +3943,8 @@ enum STR_AT_LEAST_ONE_FOOTPATH_RAILING_OBJECT_MUST_BE_SELECTED = 6442, STR_OBJECT_SELECTION_FOOTPATH_SURFACES = 6443, STR_OBJECT_SELECTION_FOOTPATH_RAILINGS = 6444, + STR_TILE_INSPECTOR_FOOTPATH_SURFACE_NAME = 6445, + STR_TILE_INSPECTOR_FOOTPATH_RAILINGS_NAME = 6446, // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working /* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings