From a516dc507ed7dc2d302e34136add7d2eeca50904 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sat, 7 Jan 2023 15:41:38 +0100 Subject: [PATCH] Replace str_is_null_or_empty() with String::IsNullOrEmpty() --- src/openrct2-ui/windows/LoadSave.cpp | 2 +- src/openrct2-ui/windows/ScenarioSelect.cpp | 4 ++-- src/openrct2-ui/windows/TextInput.cpp | 2 +- src/openrct2/util/Util.cpp | 5 ----- src/openrct2/util/Util.h | 2 -- 5 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index cc9bfaa744..34d707cd7e 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -589,7 +589,7 @@ public: } // Disable the Up button if the current directory is the root directory - if (str_is_null_or_empty(_parentDirectory) && !drives) + if (String::IsNullOrEmpty(_parentDirectory) && !drives) disabled_widgets |= (1uLL << WIDX_UP); else disabled_widgets &= ~(1uLL << WIDX_UP); diff --git a/src/openrct2-ui/windows/ScenarioSelect.cpp b/src/openrct2-ui/windows/ScenarioSelect.cpp index 54d1ecf325..3721819041 100644 --- a/src/openrct2-ui/windows/ScenarioSelect.cpp +++ b/src/openrct2-ui/windows/ScenarioSelect.cpp @@ -540,7 +540,7 @@ static void WindowScenarioselectPaint(rct_window* w, rct_drawpixelinfo* dpi) { // TODO: Should probably be translatable const utf8* completedByName = "???"; - if (!str_is_null_or_empty(scenario->highscore->name)) + if (!String::IsNullOrEmpty(scenario->highscore->name)) { completedByName = scenario->highscore->name; } @@ -624,7 +624,7 @@ static void WindowScenarioselectScrollpaint(rct_window* w, rct_drawpixelinfo* dp // Draw completion score const utf8* completedByName = "???"; - if (!str_is_null_or_empty(scenario->highscore->name)) + if (!String::IsNullOrEmpty(scenario->highscore->name)) { completedByName = scenario->highscore->name; } diff --git a/src/openrct2-ui/windows/TextInput.cpp b/src/openrct2-ui/windows/TextInput.cpp index a1fb750c25..b1e86f7e0b 100644 --- a/src/openrct2-ui/windows/TextInput.cpp +++ b/src/openrct2-ui/windows/TextInput.cpp @@ -290,7 +290,7 @@ public: } // IME composition - if (!str_is_null_or_empty(gTextInput->ImeBuffer)) + if (!String::IsNullOrEmpty(gTextInput->ImeBuffer)) { DrawIMEComposition(dpi, cursorX, cursorY); } diff --git a/src/openrct2/util/Util.cpp b/src/openrct2/util/Util.cpp index b7c26ba2c4..9b4b90bb4a 100644 --- a/src/openrct2/util/Util.cpp +++ b/src/openrct2/util/Util.cpp @@ -336,11 +336,6 @@ char* safe_strcat(char* destination, const char* source, size_t size) return result; } -bool str_is_null_or_empty(const char* str) -{ - return str == nullptr || str[0] == 0; -} - uint32_t util_rand() { thread_local std::mt19937 _prng(std::random_device{}()); diff --git a/src/openrct2/util/Util.h b/src/openrct2/util/Util.h index 6bacfaf440..0db2bf3fd8 100644 --- a/src/openrct2/util/Util.h +++ b/src/openrct2/util/Util.h @@ -34,8 +34,6 @@ int32_t strlogicalcmp(char const* a, char const* b); char* safe_strcpy(char* destination, const char* source, size_t num); char* safe_strcat(char* destination, const char* source, size_t size); -bool str_is_null_or_empty(const char* str); - uint32_t util_rand(); float util_rand_normal_distributed();