From 2a6061001b7f6774984b8fb0c9c38e07680403f2 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Fri, 12 Jul 2024 23:50:59 +0200 Subject: [PATCH] Move kObjectiveNames to Objective unit --- src/openrct2-ui/interface/Objective.cpp | 15 +++++++++++++++ src/openrct2-ui/interface/Objective.h | 3 +++ src/openrct2-ui/windows/Park.cpp | 2 +- src/openrct2-ui/windows/ScenarioSelect.cpp | 2 +- src/openrct2/localisation/Localisation.cpp | 15 --------------- src/openrct2/localisation/Localisation.h | 1 - 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/openrct2-ui/interface/Objective.cpp b/src/openrct2-ui/interface/Objective.cpp index c970dd6398..564c77c211 100644 --- a/src/openrct2-ui/interface/Objective.cpp +++ b/src/openrct2-ui/interface/Objective.cpp @@ -16,6 +16,21 @@ #include #include +const StringId kObjectiveNames[] = { + STR_OBJECTIVE_NONE, + STR_OBJECTIVE_GUESTS_BY, + STR_OBJECTIVE_PARK_VALUE_BY, + STR_OBJECTIVE_HAVE_FUN, + STR_OBJECTIVE_BUILD_THE_BEST, + STR_OBJECTIVE_10_ROLLERCOASTERS, + STR_OBJECTIVE_GUESTS_AND_RATING, + STR_OBJECTIVE_MONTHLY_RIDE_INCOME, + STR_OBJECTIVE_10_ROLLERCOASTERS_LENGTH, + STR_OBJECTIVE_FINISH_5_ROLLERCOASTERS, + STR_OBJECTIVE_REPLAY_LOAN_AND_PARK_VALUE, + STR_OBJECTIVE_MONTHLY_FOOD_INCOME, +}; + void formatObjective(Formatter& ft, Objective objective) { if (objective.Type == OBJECTIVE_BUILD_THE_BEST) diff --git a/src/openrct2-ui/interface/Objective.h b/src/openrct2-ui/interface/Objective.h index d7cf2da51f..6fdaa7e0ac 100644 --- a/src/openrct2-ui/interface/Objective.h +++ b/src/openrct2-ui/interface/Objective.h @@ -10,8 +10,11 @@ #pragma once #include +#include class Formatter; struct Objective; void formatObjective(Formatter& ft, Objective objective); + +extern const StringId kObjectiveNames[12]; diff --git a/src/openrct2-ui/windows/Park.cpp b/src/openrct2-ui/windows/Park.cpp index 3faeea96eb..b88970157e 100644 --- a/src/openrct2-ui/windows/Park.cpp +++ b/src/openrct2-ui/windows/Park.cpp @@ -1125,7 +1125,7 @@ static constexpr WindowParkAward _parkAwards[] = { ft = Formatter(); formatObjective(ft, gameState.ScenarioObjective); - screenCoords.y += DrawTextWrapped(dpi, screenCoords, 221, ObjectiveNames[gameState.ScenarioObjective.Type], ft); + screenCoords.y += DrawTextWrapped(dpi, screenCoords, 221, kObjectiveNames[gameState.ScenarioObjective.Type], ft); screenCoords.y += 5; // Objective outcome diff --git a/src/openrct2-ui/windows/ScenarioSelect.cpp b/src/openrct2-ui/windows/ScenarioSelect.cpp index f64b54b693..62d47abde6 100644 --- a/src/openrct2-ui/windows/ScenarioSelect.cpp +++ b/src/openrct2-ui/windows/ScenarioSelect.cpp @@ -256,7 +256,7 @@ static Widget _scenarioSelectWidgets[] = { .Currency = scenario->ObjectiveArg2 }; ft = Formatter(); - ft.Add(ObjectiveNames[scenario->ObjectiveType]); + ft.Add(kObjectiveNames[scenario->ObjectiveType]); formatObjective(ft, objective); screenPos.y += DrawTextWrapped(dpi, screenPos, 170, STR_OBJECTIVE, ft) + 5; diff --git a/src/openrct2/localisation/Localisation.cpp b/src/openrct2/localisation/Localisation.cpp index 306c711012..dc12e91a82 100644 --- a/src/openrct2/localisation/Localisation.cpp +++ b/src/openrct2/localisation/Localisation.cpp @@ -29,21 +29,6 @@ using namespace OpenRCT2; thread_local char gCommonStringFormatBuffer[CommonTextBufferSize]; // clang-format off -const StringId ObjectiveNames[] = { - STR_OBJECTIVE_NONE, - STR_OBJECTIVE_GUESTS_BY, - STR_OBJECTIVE_PARK_VALUE_BY, - STR_OBJECTIVE_HAVE_FUN, - STR_OBJECTIVE_BUILD_THE_BEST, - STR_OBJECTIVE_10_ROLLERCOASTERS, - STR_OBJECTIVE_GUESTS_AND_RATING, - STR_OBJECTIVE_MONTHLY_RIDE_INCOME, - STR_OBJECTIVE_10_ROLLERCOASTERS_LENGTH, - STR_OBJECTIVE_FINISH_5_ROLLERCOASTERS, - STR_OBJECTIVE_REPLAY_LOAN_AND_PARK_VALUE, - STR_OBJECTIVE_MONTHLY_FOOD_INCOME, -}; - const StringId ResearchFundingLevelNames[] = { STR_RESEARCH_FUNDING_NONE, STR_RESEARCH_FUNDING_MINIMUM, diff --git a/src/openrct2/localisation/Localisation.h b/src/openrct2/localisation/Localisation.h index 33f8a8f64e..a996d4a3fb 100644 --- a/src/openrct2/localisation/Localisation.h +++ b/src/openrct2/localisation/Localisation.h @@ -23,7 +23,6 @@ constexpr size_t CommonTextBufferSize = 512; extern thread_local char gCommonStringFormatBuffer[CommonTextBufferSize]; -extern const StringId ObjectiveNames[12]; extern const StringId ResearchFundingLevelNames[4]; extern const StringId MarketingCampaignNames[ADVERTISING_CAMPAIGN_COUNT][3]; extern const StringId RideInspectionIntervalNames[];