1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

Hide author info in the scenery window unless debug tools are active (#22251)

This commit is contained in:
AuraSpecs
2024-07-08 22:21:38 +02:00
committed by GitHub
parent 940c348fa6
commit bc0f6c4489
2 changed files with 21 additions and 15 deletions

View File

@@ -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)
------------------------------------------------------------------------

View File

@@ -18,6 +18,7 @@
#include <openrct2/OpenRCT2.h>
#include <openrct2/actions/ScenerySetRestrictedAction.h>
#include <openrct2/audio/audio.h>
#include <openrct2/config/Config.h>
#include <openrct2/core/Guard.hpp>
#include <openrct2/localisation/Formatter.h>
#include <openrct2/localisation/Localisation.h>
@@ -816,26 +817,30 @@ static Widget WindowSceneryBaseWidgets[] = {
ft.Add<StringId>(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<const char*>(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<const char*>(authorsString.c_str());
DrawTextEllipsised(
dpi, windowPos + ScreenCoordsXY{ 3, height - 13 }, width - 19,
(sceneryObject->GetAuthors().size() == 1 ? STR_SCENERY_AUTHOR : STR_SCENERY_AUTHOR_PLURAL), ft);
}
}