From bc0f6c44894a509530decd46107a6b4bed34e79f Mon Sep 17 00:00:00 2001 From: AuraSpecs Date: Mon, 8 Jul 2024 22:21:38 +0200 Subject: [PATCH] Hide author info in the scenery window unless debug tools are active (#22251) --- distribution/changelog.txt | 1 + src/openrct2-ui/windows/Scenery.cpp | 35 ++++++++++++++++------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index f6b303ae4e..dc1c0b0c73 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -4,6 +4,7 @@ - Feature: [#20832] The ride music tab now shows a track listing for the current music style. - Feature: [#22172] [Plugin] Expose ride satisfaction ratings to the plugin API. - Feature: [#22213] [Plugin] Allow plugins to focus on textboxes in custom windows. +- Change: [#22251] Hide author info in the scenery window unless debug tools are active. 0.4.12 (2024-07-07) ------------------------------------------------------------------------ diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 36eec93baf..d81dcbeb4c 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -816,26 +817,30 @@ static Widget WindowSceneryBaseWidgets[] = { ft.Add(name); DrawTextEllipsised(dpi, { windowPos.x + 3, windowPos.y + height - 23 }, width - 19, STR_BLACK_STRING, ft); - auto sceneryObjectType = GetObjectTypeFromSceneryType(selectedSceneryEntry.SceneryType); - auto& objManager = GetContext()->GetObjectManager(); - auto sceneryObject = objManager.GetLoadedObject(sceneryObjectType, selectedSceneryEntry.EntryIndex); - if (sceneryObject != nullptr && sceneryObject->GetAuthors().size() > 0) + // Draw object author(s) if debugging tools are active + if (Config::Get().general.DebuggingTools) { - std::string authorsString; - const auto& authors = sceneryObject->GetAuthors(); - for (size_t i = 0; i < authors.size(); ++i) + auto sceneryObjectType = GetObjectTypeFromSceneryType(selectedSceneryEntry.SceneryType); + auto& objManager = GetContext()->GetObjectManager(); + auto sceneryObject = objManager.GetLoadedObject(sceneryObjectType, selectedSceneryEntry.EntryIndex); + if (sceneryObject != nullptr && sceneryObject->GetAuthors().size() > 0) { - if (i > 0) + std::string authorsString; + const auto& authors = sceneryObject->GetAuthors(); + for (size_t i = 0; i < authors.size(); ++i) { - authorsString.append(", "); + if (i > 0) + { + authorsString.append(", "); + } + authorsString.append(authors[i]); } - authorsString.append(authors[i]); + ft = Formatter(); + ft.Add(authorsString.c_str()); + DrawTextEllipsised( + dpi, windowPos + ScreenCoordsXY{ 3, height - 13 }, width - 19, + (sceneryObject->GetAuthors().size() == 1 ? STR_SCENERY_AUTHOR : STR_SCENERY_AUTHOR_PLURAL), ft); } - ft = Formatter(); - ft.Add(authorsString.c_str()); - DrawTextEllipsised( - dpi, windowPos + ScreenCoordsXY{ 3, height - 13 }, width - 19, - (sceneryObject->GetAuthors().size() == 1 ? STR_SCENERY_AUTHOR : STR_SCENERY_AUTHOR_PLURAL), ft); } }