From 9e206d5528d6579ba735dec1cc2a73ae09d059d1 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Fri, 10 May 2024 21:14:05 +0200 Subject: [PATCH] Remove dependency on StringIds.h from Localisation.h (#22011) * Remove dependency on StringIds.h from Localisation.h * Include Language.h in UTF8.cpp for function declarations * Rename tests/Localisation.cpp to tests/LocalisationTest.cpp --- src/openrct2-ui/TextComposition.cpp | 3 ++- src/openrct2-ui/UiContext.Linux.cpp | 3 ++- src/openrct2-ui/interface/Graph.cpp | 2 +- src/openrct2-ui/interface/Objective.cpp | 2 +- src/openrct2-ui/windows/About.cpp | 2 -- src/openrct2-ui/windows/News.cpp | 2 +- src/openrct2-ui/windows/Research.cpp | 2 +- src/openrct2/config/Config.cpp | 1 + src/openrct2/localisation/Formatting.cpp | 2 ++ src/openrct2/localisation/Language.cpp | 1 + src/openrct2/localisation/Language.h | 3 +-- src/openrct2/localisation/LanguagePack.cpp | 1 + src/openrct2/localisation/Localisation.cpp | 3 ++- src/openrct2/localisation/Localisation.h | 4 ---- src/openrct2/localisation/UTF8.cpp | 1 + src/openrct2/scenes/title/TitleSequenceManager.cpp | 2 +- src/openrct2/util/Util.cpp | 1 + src/openrct2/world/Banner.cpp | 1 + test/tests/CMakeLists.txt | 2 +- test/tests/{Localisation.cpp => LocalisationTest.cpp} | 3 +-- test/tests/tests.vcxproj | 2 +- 21 files changed, 23 insertions(+), 20 deletions(-) rename test/tests/{Localisation.cpp => LocalisationTest.cpp} (97%) diff --git a/src/openrct2-ui/TextComposition.cpp b/src/openrct2-ui/TextComposition.cpp index cadf06829b..f50224eee6 100644 --- a/src/openrct2-ui/TextComposition.cpp +++ b/src/openrct2-ui/TextComposition.cpp @@ -18,7 +18,8 @@ #include #include #include -#include +#include +#include #ifdef __MACOSX__ // macOS uses COMMAND rather than CTRL for many keyboard shortcuts diff --git a/src/openrct2-ui/UiContext.Linux.cpp b/src/openrct2-ui/UiContext.Linux.cpp index 7dfa271b1b..975737ab5c 100644 --- a/src/openrct2-ui/UiContext.Linux.cpp +++ b/src/openrct2-ui/UiContext.Linux.cpp @@ -18,7 +18,8 @@ # include # include # include -# include +# include +# include # include # include # include diff --git a/src/openrct2-ui/interface/Graph.cpp b/src/openrct2-ui/interface/Graph.cpp index 803ab4c9a8..c7039a79ad 100644 --- a/src/openrct2-ui/interface/Graph.cpp +++ b/src/openrct2-ui/interface/Graph.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include namespace Graph { diff --git a/src/openrct2-ui/interface/Objective.cpp b/src/openrct2-ui/interface/Objective.cpp index 0e48b81c95..76c12071d5 100644 --- a/src/openrct2-ui/interface/Objective.cpp +++ b/src/openrct2-ui/interface/Objective.cpp @@ -10,8 +10,8 @@ #include "Objective.h" #include +#include #include -#include #include #include #include diff --git a/src/openrct2-ui/windows/About.cpp b/src/openrct2-ui/windows/About.cpp index aa6f6ec439..83cfb29f30 100644 --- a/src/openrct2-ui/windows/About.cpp +++ b/src/openrct2-ui/windows/About.cpp @@ -14,8 +14,6 @@ #include #include #include -#include -#include #include #include diff --git a/src/openrct2-ui/windows/News.cpp b/src/openrct2-ui/windows/News.cpp index 11ccc0c555..09a01e066b 100644 --- a/src/openrct2-ui/windows/News.cpp +++ b/src/openrct2-ui/windows/News.cpp @@ -16,8 +16,8 @@ #include #include #include +#include #include -#include #include #include #include diff --git a/src/openrct2-ui/windows/Research.cpp b/src/openrct2-ui/windows/Research.cpp index 1d7144d7d0..692620b7ee 100644 --- a/src/openrct2-ui/windows/Research.cpp +++ b/src/openrct2-ui/windows/Research.cpp @@ -14,8 +14,8 @@ #include #include #include +#include #include -#include #include #include #include diff --git a/src/openrct2/config/Config.cpp b/src/openrct2/config/Config.cpp index fb259a60b6..0e1ad04060 100644 --- a/src/openrct2/config/Config.cpp +++ b/src/openrct2/config/Config.cpp @@ -10,6 +10,7 @@ #include "Config.h" #include "../Context.h" +#include "../Date.h" #include "../OpenRCT2.h" #include "../PlatformEnvironment.h" #include "../core/Console.hpp" diff --git a/src/openrct2/localisation/Formatting.cpp b/src/openrct2/localisation/Formatting.cpp index 7ffeabdab4..1209b27a11 100644 --- a/src/openrct2/localisation/Formatting.cpp +++ b/src/openrct2/localisation/Formatting.cpp @@ -12,6 +12,8 @@ #include "../config/Config.h" #include "../util/Util.h" #include "Currency.h" +#include "Date.h" +#include "FormatCodes.h" #include "Formatter.h" #include "Localisation.h" #include "StringIds.h" diff --git a/src/openrct2/localisation/Language.cpp b/src/openrct2/localisation/Language.cpp index 4bf4e9ada2..4114c85a64 100644 --- a/src/openrct2/localisation/Language.cpp +++ b/src/openrct2/localisation/Language.cpp @@ -18,6 +18,7 @@ #include "LanguagePack.h" #include "Localisation.h" #include "LocalisationService.h" +#include "StringIds.h" #include diff --git a/src/openrct2/localisation/Language.h b/src/openrct2/localisation/Language.h index 0a2368f3db..1dff93dc8a 100644 --- a/src/openrct2/localisation/Language.h +++ b/src/openrct2/localisation/Language.h @@ -11,6 +11,7 @@ #include "../common.h" #include "../drawing/Font.h" +#include "../interface/FontFamilies.h" #include #include @@ -68,8 +69,6 @@ enum class RCT2LanguageId End = 255 }; -#include "../interface/FontFamilies.h" - struct LanguageDescriptor { const char* locale; diff --git a/src/openrct2/localisation/LanguagePack.cpp b/src/openrct2/localisation/LanguagePack.cpp index 703dafb078..ee35870610 100644 --- a/src/openrct2/localisation/LanguagePack.cpp +++ b/src/openrct2/localisation/LanguagePack.cpp @@ -20,6 +20,7 @@ #include "Language.h" #include "Localisation.h" #include "LocalisationService.h" +#include "StringIds.h" #include #include diff --git a/src/openrct2/localisation/Localisation.cpp b/src/openrct2/localisation/Localisation.cpp index b350c7be57..24fa2a2b7a 100644 --- a/src/openrct2/localisation/Localisation.cpp +++ b/src/openrct2/localisation/Localisation.cpp @@ -23,12 +23,13 @@ #include "../config/Config.h" #include "../core/Guard.hpp" #include "../core/String.hpp" -#include "../management/Marketing.h" #include "../ride/Ride.h" #include "../util/Util.h" #include "Currency.h" #include "Date.h" +#include "FormatCodes.h" #include "Formatting.h" +#include "Language.h" #include "Localisation.h" #include diff --git a/src/openrct2/localisation/Localisation.h b/src/openrct2/localisation/Localisation.h index e057f595be..12c863b897 100644 --- a/src/openrct2/localisation/Localisation.h +++ b/src/openrct2/localisation/Localisation.h @@ -10,10 +10,6 @@ #pragma once #include "../management/Marketing.h" -#include "Date.h" -#include "FormatCodes.h" -#include "Language.h" -#include "StringIds.h" #include diff --git a/src/openrct2/localisation/UTF8.cpp b/src/openrct2/localisation/UTF8.cpp index 6eab29376b..bd5df3326f 100644 --- a/src/openrct2/localisation/UTF8.cpp +++ b/src/openrct2/localisation/UTF8.cpp @@ -7,6 +7,7 @@ * OpenRCT2 is licensed under the GNU General Public License version 3. *****************************************************************************/ +#include "Language.h" #include "Localisation.h" #include diff --git a/src/openrct2/scenes/title/TitleSequenceManager.cpp b/src/openrct2/scenes/title/TitleSequenceManager.cpp index ccbd9131e9..abce274104 100644 --- a/src/openrct2/scenes/title/TitleSequenceManager.cpp +++ b/src/openrct2/scenes/title/TitleSequenceManager.cpp @@ -18,7 +18,7 @@ #include "../../core/Memory.hpp" #include "../../core/Path.hpp" #include "../../core/String.hpp" -#include "../../localisation/Localisation.h" +#include "../../localisation/StringIds.h" #include "../../platform/Platform.h" #include "TitleSequence.h" diff --git a/src/openrct2/util/Util.cpp b/src/openrct2/util/Util.cpp index 7265f42b66..f3dc9cf320 100644 --- a/src/openrct2/util/Util.cpp +++ b/src/openrct2/util/Util.cpp @@ -13,6 +13,7 @@ #include "../core/Guard.hpp" #include "../core/Path.hpp" #include "../interface/Window.h" +#include "../localisation/Language.h" #include "../localisation/Localisation.h" #include "../platform/Platform.h" #include "../scenes/title/TitleScene.h" diff --git a/src/openrct2/world/Banner.cpp b/src/openrct2/world/Banner.cpp index e7412cf981..ff93b80f59 100644 --- a/src/openrct2/world/Banner.cpp +++ b/src/openrct2/world/Banner.cpp @@ -15,6 +15,7 @@ #include "../core/Memory.hpp" #include "../core/String.hpp" #include "../interface/Window.h" +#include "../localisation/FormatCodes.h" #include "../localisation/Formatter.h" #include "../localisation/Localisation.h" #include "../management/Finance.h" diff --git a/test/tests/CMakeLists.txt b/test/tests/CMakeLists.txt index 76adadcc0a..3681c890df 100644 --- a/test/tests/CMakeLists.txt +++ b/test/tests/CMakeLists.txt @@ -19,7 +19,7 @@ set(test_files "${CMAKE_CURRENT_SOURCE_DIR}/IniReaderTest.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/IniWriterTest.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/LanguagePackTest.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/Localisation.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/LocalisationTest.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/MultiLaunch.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Pathfinding.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Platform.cpp" diff --git a/test/tests/Localisation.cpp b/test/tests/LocalisationTest.cpp similarity index 97% rename from test/tests/Localisation.cpp rename to test/tests/LocalisationTest.cpp index f17a811cef..04a0859183 100644 --- a/test/tests/Localisation.cpp +++ b/test/tests/LocalisationTest.cpp @@ -7,9 +7,8 @@ * OpenRCT2 is licensed under the GNU General Public License version 3. *****************************************************************************/ -#include "openrct2/localisation/Localisation.h" - #include "helpers/StringHelpers.hpp" +#include "openrct2/localisation/Language.h" #include diff --git a/test/tests/tests.vcxproj b/test/tests/tests.vcxproj index cc9e4aa593..1a37d58ab8 100644 --- a/test/tests/tests.vcxproj +++ b/test/tests/tests.vcxproj @@ -89,7 +89,7 @@ - +