From 3d5e6ea932956e409c92ff45901cb8feb73f6301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Wed, 5 Jul 2023 22:34:29 +0300 Subject: [PATCH] Replace Equals with IEquals where appropriate --- src/openrct2-ui/input/ShortcutInput.cpp | 28 ++++++++++---------- src/openrct2-ui/interface/Theme.cpp | 2 +- src/openrct2/Context.cpp | 2 +- src/openrct2/FileClassifier.cpp | 20 +++++++------- src/openrct2/ParkImporter.cpp | 7 +++-- src/openrct2/TrackImporter.cpp | 2 +- src/openrct2/command_line/SpriteCommands.cpp | 4 +-- src/openrct2/config/ConfigEnum.hpp | 2 +- src/openrct2/config/IniReader.cpp | 2 +- src/openrct2/core/Path.cpp | 2 +- src/openrct2/localisation/LanguagePack.cpp | 4 +-- src/openrct2/network/NetworkBase.cpp | 2 +- src/openrct2/network/NetworkUser.cpp | 2 +- src/openrct2/network/ServerList.cpp | 2 +- src/openrct2/object/ImageTable.cpp | 2 +- src/openrct2/object/ObjectRepository.cpp | 8 +++--- src/openrct2/park/ParkFile.cpp | 4 +-- src/openrct2/platform/Platform.Posix.cpp | 2 +- src/openrct2/rct1/S4Importer.cpp | 4 +-- src/openrct2/rct1/T4Importer.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 18 ++++++------- src/openrct2/rct2/T6Importer.cpp | 2 +- src/openrct2/ride/TrackDesignRepository.cpp | 4 +-- src/openrct2/scenario/ScenarioRepository.cpp | 20 +++++++------- src/openrct2/scenario/ScenarioSources.cpp | 2 +- src/openrct2/title/TitleSequence.cpp | 4 +-- src/openrct2/title/TitleSequenceManager.cpp | 8 +++--- 27 files changed, 80 insertions(+), 81 deletions(-) diff --git a/src/openrct2-ui/input/ShortcutInput.cpp b/src/openrct2-ui/input/ShortcutInput.cpp index dd147ee40d..6c6502eb34 100644 --- a/src/openrct2-ui/input/ShortcutInput.cpp +++ b/src/openrct2-ui/input/ShortcutInput.cpp @@ -23,51 +23,51 @@ constexpr uint32_t UsefulModifiers = KMOD_SHIFT | KMOD_CTRL | KMOD_ALT | KMOD_GU static uint32_t ParseModifier(std::string_view text) { - if (String::Equals(text, "CTRL", true)) + if (String::IEquals(text, "CTRL")) { return KMOD_CTRL; } - if (String::Equals(text, "LCTRL", true)) + if (String::IEquals(text, "LCTRL")) { return KMOD_LCTRL; } - if (String::Equals(text, "RCTRL", true)) + if (String::IEquals(text, "RCTRL")) { return KMOD_RCTRL; } - if (String::Equals(text, "SHIFT", true)) + if (String::IEquals(text, "SHIFT")) { return KMOD_SHIFT; } - if (String::Equals(text, "LSHIFT", true)) + if (String::IEquals(text, "LSHIFT")) { return KMOD_LSHIFT; } - if (String::Equals(text, "RSHIFT", true)) + if (String::IEquals(text, "RSHIFT")) { return KMOD_RSHIFT; } - if (String::Equals(text, "ALT", true)) + if (String::IEquals(text, "ALT")) { return KMOD_ALT; } - if (String::Equals(text, "LALT", true)) + if (String::IEquals(text, "LALT")) { return KMOD_LALT; } - if (String::Equals(text, "RALT", true)) + if (String::IEquals(text, "RALT")) { return KMOD_RALT; } - if (String::Equals(text, "GUI", true)) + if (String::IEquals(text, "GUI")) { return KMOD_GUI; } - if (String::Equals(text, "LCTRL", true)) + if (String::IEquals(text, "LCTRL")) { return KMOD_LGUI; } - if (String::Equals(text, "RGUI", true)) + if (String::IEquals(text, "RGUI")) { return KMOD_RGUI; } @@ -167,13 +167,13 @@ ShortcutInput::ShortcutInput(std::string_view value) Button = *number - 1; } } - else if (String::Equals(rem, "LMB", true)) + else if (String::IEquals(rem, "LMB")) { Kind = InputDeviceKind::Mouse; Modifiers = modifiers; Button = 0; } - else if (String::Equals(rem, "RMB", true)) + else if (String::IEquals(rem, "RMB")) { Kind = InputDeviceKind::Mouse; Modifiers = modifiers; diff --git a/src/openrct2-ui/interface/Theme.cpp b/src/openrct2-ui/interface/Theme.cpp index c909e4e91e..868b450fae 100644 --- a/src/openrct2-ui/interface/Theme.cpp +++ b/src/openrct2-ui/interface/Theme.cpp @@ -721,7 +721,7 @@ size_t ThemeGetIndexForName(const utf8* name) for (size_t i = 0; i < count; i++) { const utf8* tn = ThemeManagerGetAvailableThemeName(i); - if (String::Equals(tn, name, true)) + if (String::IEquals(tn, name)) { return i; } diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index a1231638a0..c1f566f367 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -574,7 +574,7 @@ namespace OpenRCT2 try { - if (String::Equals(Path::GetExtension(path), ".sea", true)) + if (String::IEquals(Path::GetExtension(path), ".sea")) { auto data = DecryptSea(fs::u8path(path)); auto ms = MemoryStream(data.data(), data.size(), MEMORY_ACCESS::READ); diff --git a/src/openrct2/FileClassifier.cpp b/src/openrct2/FileClassifier.cpp index 7a36c865ed..2be3bdd2b1 100644 --- a/src/openrct2/FileClassifier.cpp +++ b/src/openrct2/FileClassifier.cpp @@ -197,25 +197,25 @@ static bool TryClassifyAsTD4_TD6(OpenRCT2::IStream* stream, ClassifiedFileInfo* FileExtension GetFileExtensionType(u8string_view path) { auto extension = Path::GetExtension(path); - if (String::Equals(extension, ".dat", true) || String::Equals(extension, ".pob", true)) + if (String::IEquals(extension, ".dat") || String::IEquals(extension, ".pob")) return FileExtension::DAT; - if (String::Equals(extension, ".sc4", true)) + if (String::IEquals(extension, ".sc4")) return FileExtension::SC4; - if (String::Equals(extension, ".sv4", true)) + if (String::IEquals(extension, ".sv4")) return FileExtension::SV4; - if (String::Equals(extension, ".td4", true)) + if (String::IEquals(extension, ".td4")) return FileExtension::TD4; - if (String::Equals(extension, ".sc6", true)) + if (String::IEquals(extension, ".sc6")) return FileExtension::SC6; - if (String::Equals(extension, ".sea", true)) + if (String::IEquals(extension, ".sea")) return FileExtension::SC6; - if (String::Equals(extension, ".sv6", true)) + if (String::IEquals(extension, ".sv6")) return FileExtension::SV6; - if (String::Equals(extension, ".sv7", true)) + if (String::IEquals(extension, ".sv7")) return FileExtension::SV6; - if (String::Equals(extension, ".td6", true)) + if (String::IEquals(extension, ".td6")) return FileExtension::TD6; - if (String::Equals(extension, ".park", true)) + if (String::IEquals(extension, ".park")) return FileExtension::PARK; return FileExtension::Unknown; } diff --git a/src/openrct2/ParkImporter.cpp b/src/openrct2/ParkImporter.cpp index d5719ceeea..91aba4b4ea 100644 --- a/src/openrct2/ParkImporter.cpp +++ b/src/openrct2/ParkImporter.cpp @@ -41,17 +41,16 @@ namespace ParkImporter bool ExtensionIsOpenRCT2ParkFile(std::string_view extension) { - return String::Equals(extension, ".park", true); + return String::IEquals(extension, ".park"); } bool ExtensionIsRCT1(std::string_view extension) { - return String::Equals(extension, ".sc4", true) || String::Equals(extension, ".sv4", true); + return String::IEquals(extension, ".sc4") || String::IEquals(extension, ".sv4"); } bool ExtensionIsScenario(std::string_view extension) { - return String::Equals(extension, ".sc4", true) || String::Equals(extension, ".sc6", true) - || String::Equals(extension, ".sea", true); + return String::IEquals(extension, ".sc4") || String::IEquals(extension, ".sc6") || String::IEquals(extension, ".sea"); } } // namespace ParkImporter diff --git a/src/openrct2/TrackImporter.cpp b/src/openrct2/TrackImporter.cpp index 3b0fc28a6e..3a3e02c8f5 100644 --- a/src/openrct2/TrackImporter.cpp +++ b/src/openrct2/TrackImporter.cpp @@ -33,6 +33,6 @@ namespace TrackImporter bool ExtensionIsRCT1(const std::string& extension) { - return String::Equals(extension, ".td4", true); + return String::IEquals(extension, ".td4"); } } // namespace TrackImporter diff --git a/src/openrct2/command_line/SpriteCommands.cpp b/src/openrct2/command_line/SpriteCommands.cpp index 8c6f6ef119..61a964fa6e 100644 --- a/src/openrct2/command_line/SpriteCommands.cpp +++ b/src/openrct2/command_line/SpriteCommands.cpp @@ -49,9 +49,9 @@ const CommandLineCommand CommandLine::SpriteCommands[] static exitcode_t HandleSprite(CommandLineArgEnumerator* argEnumerator) { - if (String::Equals(_mode, SZ_CLOSEST, true)) + if (String::IEquals(_mode, SZ_CLOSEST)) gSpriteMode = ImportMode::Closest; - else if (String::Equals(_mode, SZ_DITHERING, true)) + else if (String::IEquals(_mode, SZ_DITHERING)) gSpriteMode = ImportMode::Dithering; Memory::Free(_mode); diff --git a/src/openrct2/config/ConfigEnum.hpp b/src/openrct2/config/ConfigEnum.hpp index 302626ac48..39cd501857 100644 --- a/src/openrct2/config/ConfigEnum.hpp +++ b/src/openrct2/config/ConfigEnum.hpp @@ -61,7 +61,7 @@ public: { for (const auto& entry : _entries) { - if (String::Equals(entry.Key, key, true)) + if (String::IEquals(entry.Key, key)) { return entry.Value; } diff --git a/src/openrct2/config/IniReader.cpp b/src/openrct2/config/IniReader.cpp index 46fbbc783d..025e054ac9 100644 --- a/src/openrct2/config/IniReader.cpp +++ b/src/openrct2/config/IniReader.cpp @@ -133,7 +133,7 @@ public: std::string value; if (TryGetString(name, &value)) { - result = String::Equals(value, "true", true); + result = String::IEquals(value, "true"); } return result; } diff --git a/src/openrct2/core/Path.cpp b/src/openrct2/core/Path.cpp index d7287e3fcb..77e4f50ae0 100644 --- a/src/openrct2/core/Path.cpp +++ b/src/openrct2/core/Path.cpp @@ -108,7 +108,7 @@ namespace Path bool Equals(u8string_view a, u8string_view b) { - return String::Equals(a, b, Platform::ShouldIgnoreCase()); + return Platform::ShouldIgnoreCase() ? String::IEquals(a,b) : String::Equals(a, b); } u8string ResolveCasing(u8string_view path) diff --git a/src/openrct2/localisation/LanguagePack.cpp b/src/openrct2/localisation/LanguagePack.cpp index 44a57b5038..ecfc250eb0 100644 --- a/src/openrct2/localisation/LanguagePack.cpp +++ b/src/openrct2/localisation/LanguagePack.cpp @@ -162,7 +162,7 @@ public: int32_t ooIndex = 0; for (const ScenarioOverride& scenarioOverride : _scenarioOverrides) { - if (String::Equals(scenarioOverride.filename.c_str(), scenarioFilename, true)) + if (String::IEquals(scenarioOverride.filename.c_str(), scenarioFilename)) { if (scenarioOverride.strings[index].empty()) { @@ -181,7 +181,7 @@ private: { for (auto& so : _scenarioOverrides) { - if (String::Equals(so.strings[0], scenarioIdentifier.c_str(), true)) + if (String::IEquals(so.strings[0], scenarioIdentifier)) { return &so; } diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index 2aafdafe62..3f388033f4 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -2113,7 +2113,7 @@ std::string NetworkBase::MakePlayerNameUnique(const std::string& name) // Check if there is already a player with this name in the server for (const auto& player : player_list) { - if (String::Equals(player->Name.c_str(), new_name.c_str(), true)) + if (String::IEquals(player->Name.c_str(), new_name.c_str())) { unique = false; break; diff --git a/src/openrct2/network/NetworkUser.cpp b/src/openrct2/network/NetworkUser.cpp index 2ce300f5f3..d47bbed40c 100644 --- a/src/openrct2/network/NetworkUser.cpp +++ b/src/openrct2/network/NetworkUser.cpp @@ -186,7 +186,7 @@ const NetworkUser* NetworkUserManager::GetUserByName(const std::string& name) co for (const auto& kvp : _usersByHash) { const auto& networkUser = kvp.second; - if (String::Equals(name.c_str(), networkUser->Name.c_str(), true)) + if (String::IEquals(name.c_str(), networkUser->Name.c_str())) { return networkUser.get(); } diff --git a/src/openrct2/network/ServerList.cpp b/src/openrct2/network/ServerList.cpp index c50d418d93..ff9726b8c2 100644 --- a/src/openrct2/network/ServerList.cpp +++ b/src/openrct2/network/ServerList.cpp @@ -118,7 +118,7 @@ void ServerList::Sort() [](const ServerListEntry& a, const ServerListEntry& b) { if (a.Favourite == b.Favourite) { - return String::Equals(a.Address, b.Address, true); + return String::IEquals(a.Address, b.Address); } return false; }), diff --git a/src/openrct2/object/ImageTable.cpp b/src/openrct2/object/ImageTable.cpp index 794ca748be..7de80fa092 100644 --- a/src/openrct2/object/ImageTable.cpp +++ b/src/openrct2/object/ImageTable.cpp @@ -416,7 +416,7 @@ std::string ImageTable::FindLegacyObject(const std::string& name) while (scanner->Next()) { auto currentName = Path::GetFileName(scanner->GetPathRelative()); - if (String::Equals(currentName, name, true) || String::Equals(currentName, altName, true)) + if (String::IEquals(currentName, name) || String::IEquals(currentName, altName)) { objectPath = scanner->GetPath(); break; diff --git a/src/openrct2/object/ObjectRepository.cpp b/src/openrct2/object/ObjectRepository.cpp index b723b9d120..d0c7aa9dfb 100644 --- a/src/openrct2/object/ObjectRepository.cpp +++ b/src/openrct2/object/ObjectRepository.cpp @@ -101,11 +101,11 @@ public: { std::unique_ptr object; auto extension = Path::GetExtension(path); - if (String::Equals(extension, ".json", true)) + if (String::IEquals(extension, ".json")) { object = ObjectFactory::CreateObjectFromJsonFile(_objectRepository, path, false); } - else if (String::Equals(extension, ".parkobj", true)) + else if (String::IEquals(extension, ".parkobj")) { object = ObjectFactory::CreateObjectFromZipFile(_objectRepository, path, false); } @@ -267,11 +267,11 @@ public: Guard::ArgumentNotNull(ori, GUARD_LINE); auto extension = Path::GetExtension(ori->Path); - if (String::Equals(extension, ".json", true)) + if (String::IEquals(extension, ".json")) { return ObjectFactory::CreateObjectFromJsonFile(*this, ori->Path, !gOpenRCT2NoGraphics); } - if (String::Equals(extension, ".parkobj", true)) + if (String::IEquals(extension, ".parkobj")) { return ObjectFactory::CreateObjectFromZipFile(*this, ori->Path, !gOpenRCT2NoGraphics); } diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index bfc5e3ca34..45b290f02d 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -745,12 +745,12 @@ namespace OpenRCT2 for (const auto* ori : ExportObjectsList) { auto extension = Path::GetExtension(ori->Path); - if (String::Equals(extension, ".dat", true)) + if (String::IEquals(extension, ".dat")) { cs.Write(DESCRIPTOR_DAT); cs.Write(&ori->ObjectEntry, sizeof(RCTObjectEntry)); } - else if (String::Equals(extension, ".parkobj", true)) + else if (String::IEquals(extension, ".parkobj")) { cs.Write(DESCRIPTOR_PARKOBJ); cs.Write(ori->Identifier); diff --git a/src/openrct2/platform/Platform.Posix.cpp b/src/openrct2/platform/Platform.Posix.cpp index 88c229fc33..eeb804af18 100644 --- a/src/openrct2/platform/Platform.Posix.cpp +++ b/src/openrct2/platform/Platform.Posix.cpp @@ -223,7 +223,7 @@ namespace Platform // Find a file which matches by name (case insensitive) for (int32_t i = 0; i < count; i++) { - if (String::Equals(files[i]->d_name, fileName.c_str(), true)) + if (String::IEquals(files[i]->d_name, fileName.c_str())) { result = Path::Combine(directory, std::string(files[i]->d_name)); break; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 1db52f6259..a40003c398 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -129,11 +129,11 @@ namespace RCT1 ParkLoadResult Load(const u8string& path) override { const auto extension = Path::GetExtension(path); - if (String::Equals(extension, ".sc4", true)) + if (String::IEquals(extension, ".sc4")) { return LoadScenario(path); } - if (String::Equals(extension, ".sv4", true)) + if (String::IEquals(extension, ".sv4")) { return LoadSavedGame(path); } diff --git a/src/openrct2/rct1/T4Importer.cpp b/src/openrct2/rct1/T4Importer.cpp index 333739ef04..4838cdd56f 100644 --- a/src/openrct2/rct1/T4Importer.cpp +++ b/src/openrct2/rct1/T4Importer.cpp @@ -40,7 +40,7 @@ namespace RCT1 bool Load(const utf8* path) override { const auto extension = Path::GetExtension(path); - if (String::Equals(extension, ".td4", true)) + if (String::IEquals(extension, ".td4")) { _name = GetNameFromTrackPath(path); auto fs = OpenRCT2::FileStream(path, OpenRCT2::FILE_MODE_OPEN); diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index b7c77b55f5..8cf091931d 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -110,11 +110,11 @@ namespace RCT2 ParkLoadResult Load(const u8string& path) override { const auto extension = Path::GetExtension(path); - if (String::Equals(extension, ".sc6", true)) + if (String::IEquals(extension, ".sc6")) { return LoadScenario(path); } - if (String::Equals(extension, ".sv6", true)) + if (String::IEquals(extension, ".sv6")) { return LoadSavedGame(path); } @@ -586,8 +586,8 @@ namespace RCT2 // clang-format on } else if ( - String::Equals(gScenarioFileName, "Six Flags Magic Mountain.SC6", true) - || String::Equals(gScenarioFileName, "six flags magic mountain.sea", true)) + String::IEquals(gScenarioFileName, "Six Flags Magic Mountain.SC6") + || String::IEquals(gScenarioFileName, "six flags magic mountain.sea")) { // clang-format off FixLandOwnershipTilesWithOwnership( @@ -611,8 +611,8 @@ namespace RCT2 OWNERSHIP_OWNED); } else if ( - String::Equals(gScenarioFileName, "N America - Extreme Hawaiian Island.SC6", true) - || String::Equals(gScenarioFileName, "n america - extreme hawaiian island.sea", true)) + String::IEquals(gScenarioFileName, "N America - Extreme Hawaiian Island.SC6") + || String::IEquals(gScenarioFileName, "n america - extreme hawaiian island.sea")) { FixLandOwnershipTilesWithOwnership( { @@ -647,8 +647,8 @@ namespace RCT2 { return; } - if (String::Equals(_s6.ScenarioFilename, "Infernal Views.SC6", true) - || String::Equals(_s6.ScenarioFilename, "infernal views.sea", true)) + if (String::IEquals(_s6.ScenarioFilename, "Infernal Views.SC6") + || String::IEquals(_s6.ScenarioFilename, "infernal views.sea")) { auto surfaceElement = MapGetSurfaceElementAt(TileCoordsXY{ 45, 62 }); @@ -656,7 +656,7 @@ namespace RCT2 } else if ( String::Equals(_s6.ScenarioFilename, "Six Flags Holland.SC6") - || String::Equals(_s6.ScenarioFilename, "six flags holland.sea", true)) + || String::IEquals(_s6.ScenarioFilename, "six flags holland.sea")) { auto surfaceElement = MapGetSurfaceElementAt(TileCoordsXY{ 126, 73 }); diff --git a/src/openrct2/rct2/T6Importer.cpp b/src/openrct2/rct2/T6Importer.cpp index bf13650ef2..5a767f0357 100644 --- a/src/openrct2/rct2/T6Importer.cpp +++ b/src/openrct2/rct2/T6Importer.cpp @@ -44,7 +44,7 @@ namespace RCT2 bool Load(const utf8* path) override { const auto extension = Path::GetExtension(path); - if (String::Equals(extension, ".td6", true)) + if (String::IEquals(extension, ".td6")) { _name = GetNameFromTrackPath(path); auto fs = OpenRCT2::FileStream(path, OpenRCT2::FILE_MODE_OPEN); diff --git a/src/openrct2/ride/TrackDesignRepository.cpp b/src/openrct2/ride/TrackDesignRepository.cpp index ea7fa3064f..167b1fa8f6 100644 --- a/src/openrct2/ride/TrackDesignRepository.cpp +++ b/src/openrct2/ride/TrackDesignRepository.cpp @@ -157,7 +157,7 @@ public: entryIsNotSeparate = true; } - if (entryIsNotSeparate || String::Equals(item.ObjectEntry, entry, true)) + if (entryIsNotSeparate || String::IEquals(item.ObjectEntry, entry)) { count++; } @@ -191,7 +191,7 @@ public: entryIsNotSeparate = true; } - if (entryIsNotSeparate || String::Equals(item.ObjectEntry, entry, true)) + if (entryIsNotSeparate || String::IEquals(item.ObjectEntry, entry)) { TrackDesignFileRef ref; ref.name = GetNameFromTrackPath(item.Path); diff --git a/src/openrct2/scenario/ScenarioRepository.cpp b/src/openrct2/scenario/ScenarioRepository.cpp index c7371d49ef..1c2934c51b 100644 --- a/src/openrct2/scenario/ScenarioRepository.cpp +++ b/src/openrct2/scenario/ScenarioRepository.cpp @@ -173,7 +173,7 @@ protected: private: static std::unique_ptr GetStreamFromRCT2Scenario(const std::string& path) { - if (String::Equals(Path::GetExtension(path), ".sea", true)) + if (String::IEquals(Path::GetExtension(path), ".sea")) { auto data = DecryptSea(fs::u8path(path)); auto ms = std::make_unique(); @@ -196,7 +196,7 @@ private: try { std::string extension = Path::GetExtension(path); - if (String::Equals(extension, ".park", true)) + if (String::IEquals(extension, ".park")) { // OpenRCT2 park bool result = false; @@ -218,7 +218,7 @@ private: return result; } - if (String::Equals(extension, ".sc4", true)) + if (String::IEquals(extension, ".sc4")) { // RCT1 scenario bool result = false; @@ -389,7 +389,7 @@ public: const auto scenarioFilename = Path::GetFileName(scenario.Path); // Note: this is always case insensitive search for cross platform consistency - if (String::Equals(filename, scenarioFilename, true)) + if (String::IEquals(filename, scenarioFilename)) { return &scenario; } @@ -407,7 +407,7 @@ public: continue; // Note: this is always case insensitive search for cross platform consistency - if (String::Equals(name, scenario->InternalName, true)) + if (String::IEquals(name, scenario->InternalName)) { return &_scenarios[i]; } @@ -441,18 +441,18 @@ public: const std::string scenarioExtension = Path::GetExtension(scenarioFileName); // Check if this is an RCTC scenario that corresponds to a known RCT1/2 scenario or vice versa, see #12626 - if (String::Equals(scenarioExtension, ".sea", true)) + if (String::IEquals(scenarioExtension, ".sea")) { // Get scenario using RCT2 style name of RCTC scenario scenario = GetByFilename((scenarioBaseName + ".sc6").c_str()); } - else if (String::Equals(scenarioExtension, ".sc6", true)) + else if (String::IEquals(scenarioExtension, ".sc6")) { // Get scenario using RCTC style name of RCT2 scenario scenario = GetByFilename((scenarioBaseName + ".sea").c_str()); } // gScenarioFileName .Park scenarios is the full file path instead of just , so need to convert - else if (String::Equals(scenarioExtension, ".park", true)) + else if (String::IEquals(scenarioExtension, ".park")) { scenario = GetByFilename((scenarioBaseName + ".park").c_str()); } @@ -496,7 +496,7 @@ private: const auto scenarioFilename = Path::GetFileName(scenario.Path); // Note: this is always case insensitive search for cross platform consistency - if (String::Equals(filename, scenarioFilename, true)) + if (String::IEquals(filename, scenarioFilename)) { return &scenario; } @@ -681,7 +681,7 @@ private: bool notFound = true; for (auto& highscore : _highscores) { - if (String::Equals(scBasic.Path, highscore->fileName, true)) + if (String::IEquals(scBasic.Path, highscore->fileName)) { notFound = false; diff --git a/src/openrct2/scenario/ScenarioSources.cpp b/src/openrct2/scenario/ScenarioSources.cpp index 3183d94448..73c69e8d11 100644 --- a/src/openrct2/scenario/ScenarioSources.cpp +++ b/src/openrct2/scenario/ScenarioSources.cpp @@ -368,7 +368,7 @@ namespace ScenarioSources for (size_t j = 0; j < ScenarioTitlesBySource[i].count; j++) { const ScenarioTitleDescriptor* desc = &ScenarioTitlesBySource[i].titles[j]; - if (String::Equals(name, desc->Title, true)) + if (String::IEquals(name, desc->Title)) { outDesc->title = desc->Title; outDesc->id = desc->Id; diff --git a/src/openrct2/title/TitleSequence.cpp b/src/openrct2/title/TitleSequence.cpp index 69261a2e0f..a6812ec23d 100644 --- a/src/openrct2/title/TitleSequence.cpp +++ b/src/openrct2/title/TitleSequence.cpp @@ -320,7 +320,7 @@ namespace OpenRCT2::Title { auto name = zip->GetFileName(i); auto ext = Path::GetExtension(name); - if (String::Equals(ext, ".sv6", true) || String::Equals(ext, ".sc6", true) || String::Equals(ext, ".park", true)) + if (String::IEquals(ext, ".sv6") || String::IEquals(ext, ".sc6") || String::IEquals(ext, ".park")) { saves.push_back(std::move(name)); } @@ -348,7 +348,7 @@ namespace OpenRCT2::Title const std::string relativePath = parts[1].data(); for (size_t i = 0; i < saves.size(); i++) { - if (String::Equals(relativePath, saves[i], true)) + if (String::IEquals(relativePath, saves[i])) { saveIndex = static_cast(i); break; diff --git a/src/openrct2/title/TitleSequenceManager.cpp b/src/openrct2/title/TitleSequenceManager.cpp index acb7e2e5f7..18ab3c9ae5 100644 --- a/src/openrct2/title/TitleSequenceManager.cpp +++ b/src/openrct2/title/TitleSequenceManager.cpp @@ -169,7 +169,7 @@ namespace TitleSequenceManager auto filename = Path::GetFileName(path); for (size_t i = 0; i < std::size(PredefinedSequences); i++) { - if (String::Equals(filename, PredefinedSequences[i].Filename, true)) + if (String::IEquals(filename, PredefinedSequences[i].Filename)) { return i; } @@ -217,7 +217,7 @@ namespace TitleSequenceManager { TitleSequenceManagerItem item{}; - if (String::Equals(Path::GetExtension(scanPath), u8".txt", true)) + if (String::IEquals(Path::GetExtension(scanPath), u8".txt")) { // If we are given a .txt file, set the path to the containing directory item.Path = Path::GetDirectory(scanPath); @@ -270,7 +270,7 @@ namespace TitleSequenceManager { for (const auto& pseq : TitleSequenceManager::PredefinedSequences) { - if (String::Equals(name, pseq.ConfigId, true)) + if (String::IEquals(name, pseq.ConfigId)) { return true; } @@ -315,7 +315,7 @@ const utf8* TitleSequenceManagerGetConfigID(size_t index) const auto filename = Path::GetFileName(item->Path); for (const auto& pseq : TitleSequenceManager::PredefinedSequences) { - if (String::Equals(filename, pseq.Filename, true)) + if (String::IEquals(filename, pseq.Filename)) { return pseq.ConfigId; }