From 04ca18b7c6d3f423b541dd1471fd1ba632ba6a83 Mon Sep 17 00:00:00 2001 From: Harry-Hopkinson Date: Mon, 15 Apr 2024 15:12:21 +0000 Subject: [PATCH 1/7] Rename PEEP_MIN_ENERGY to kPeepMinEnergy --- src/openrct2-ui/windows/Cheats.cpp | 2 +- src/openrct2-ui/windows/Guest.cpp | 2 +- src/openrct2/actions/CheatSetAction.cpp | 2 +- src/openrct2/entity/Guest.cpp | 4 ++-- src/openrct2/entity/Peep.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp index 64e16f9893..4782a8b21c 100644 --- a/src/openrct2-ui/windows/Cheats.cpp +++ b/src/openrct2-ui/windows/Cheats.cpp @@ -981,7 +981,7 @@ static StringId window_cheats_page_titles[] = { CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_ENERGY, PEEP_MAX_ENERGY); break; case WIDX_GUEST_ENERGY_MIN: - CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_ENERGY, PEEP_MIN_ENERGY); + CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_ENERGY, kPeepMinEnergy); break; case WIDX_GUEST_HUNGER_MAX: CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_HUNGER, 0); diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index 5b94850956..9670182296 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -1101,7 +1101,7 @@ static_assert(_guestWindowPageWidgets.size() == WINDOW_GUEST_PAGE_COUNT); screenCoords.y += LIST_ROW_HEIGHT; DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_ENERGY_LABEL); - int32_t energy = NormalizeGuestStatValue(peep->Energy - PEEP_MIN_ENERGY, PEEP_MAX_ENERGY - PEEP_MIN_ENERGY, 10); + int32_t energy = NormalizeGuestStatValue(peep->Energy - kPeepMinEnergy, PEEP_MAX_ENERGY - kPeepMinEnergy, 10); barColour = COLOUR_BRIGHT_GREEN; barBlink = energy < 50; StatsBarsDraw(energy, screenCoords, dpi, barColour, barBlink); diff --git a/src/openrct2/actions/CheatSetAction.cpp b/src/openrct2/actions/CheatSetAction.cpp index fb5d15ca81..eac814f7bc 100644 --- a/src/openrct2/actions/CheatSetAction.cpp +++ b/src/openrct2/actions/CheatSetAction.cpp @@ -353,7 +353,7 @@ ParametersRange CheatSetAction::GetParameterRange(CheatType cheatType) const { 0, kPeepMaxHappiness } }; case GUEST_PARAMETER_ENERGY: return { { GUEST_PARAMETER_HAPPINESS, GUEST_PARAMETER_PREFERRED_RIDE_INTENSITY }, - { PEEP_MIN_ENERGY, PEEP_MAX_ENERGY } }; + { kPeepMinEnergy, PEEP_MAX_ENERGY } }; case GUEST_PARAMETER_HUNGER: return { { GUEST_PARAMETER_HAPPINESS, GUEST_PARAMETER_PREFERRED_RIDE_INTENSITY }, { 0, kPeepMaxHunger } }; case GUEST_PARAMETER_THIRST: diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index 98590f0d46..16ecbca191 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -843,8 +843,8 @@ void Guest::Loc68FA89() newEnergy = newTargetEnergy; } - if (newEnergy < PEEP_MIN_ENERGY) - newEnergy = PEEP_MIN_ENERGY; + if (newEnergy < kPeepMinEnergy) + newEnergy = kPeepMinEnergy; /* Previous code here suggested maximum energy is 128. */ newEnergy = std::min(static_cast(PEEP_MAX_ENERGY), newEnergy); diff --git a/src/openrct2/entity/Peep.h b/src/openrct2/entity/Peep.h index 794103dac7..41007a593e 100644 --- a/src/openrct2/entity/Peep.h +++ b/src/openrct2/entity/Peep.h @@ -21,7 +21,7 @@ #include #include -#define PEEP_MIN_ENERGY 32 +constexpr int8_t kPeepMinEnergy = 32; #define PEEP_MAX_ENERGY 128 #define PEEP_MAX_ENERGY_TARGET 255 // Oddly, this differs from max energy! From cf50b4c8a398af482fd15a398a9ae8a9ad3678bc Mon Sep 17 00:00:00 2001 From: Harry-Hopkinson Date: Mon, 15 Apr 2024 15:21:49 +0000 Subject: [PATCH 2/7] Rename PEEP_MAX_ENERGY to kPeepMaxEnergy --- src/openrct2-ui/windows/Cheats.cpp | 2 +- src/openrct2-ui/windows/Guest.cpp | 2 +- src/openrct2/actions/CheatSetAction.cpp | 2 +- src/openrct2/entity/Guest.cpp | 2 +- src/openrct2/entity/Peep.h | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp index 4782a8b21c..b790d1d088 100644 --- a/src/openrct2-ui/windows/Cheats.cpp +++ b/src/openrct2-ui/windows/Cheats.cpp @@ -978,7 +978,7 @@ static StringId window_cheats_page_titles[] = { CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_HAPPINESS, 0); break; case WIDX_GUEST_ENERGY_MAX: - CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_ENERGY, PEEP_MAX_ENERGY); + CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_ENERGY, kPeepMaxEnergy); break; case WIDX_GUEST_ENERGY_MIN: CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_ENERGY, kPeepMinEnergy); diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index 9670182296..a2be99c93f 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -1101,7 +1101,7 @@ static_assert(_guestWindowPageWidgets.size() == WINDOW_GUEST_PAGE_COUNT); screenCoords.y += LIST_ROW_HEIGHT; DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_ENERGY_LABEL); - int32_t energy = NormalizeGuestStatValue(peep->Energy - kPeepMinEnergy, PEEP_MAX_ENERGY - kPeepMinEnergy, 10); + int32_t energy = NormalizeGuestStatValue(peep->Energy - kPeepMinEnergy, kPeepMaxEnergy - kPeepMinEnergy, 10); barColour = COLOUR_BRIGHT_GREEN; barBlink = energy < 50; StatsBarsDraw(energy, screenCoords, dpi, barColour, barBlink); diff --git a/src/openrct2/actions/CheatSetAction.cpp b/src/openrct2/actions/CheatSetAction.cpp index eac814f7bc..479303da3a 100644 --- a/src/openrct2/actions/CheatSetAction.cpp +++ b/src/openrct2/actions/CheatSetAction.cpp @@ -353,7 +353,7 @@ ParametersRange CheatSetAction::GetParameterRange(CheatType cheatType) const { 0, kPeepMaxHappiness } }; case GUEST_PARAMETER_ENERGY: return { { GUEST_PARAMETER_HAPPINESS, GUEST_PARAMETER_PREFERRED_RIDE_INTENSITY }, - { kPeepMinEnergy, PEEP_MAX_ENERGY } }; + { kPeepMinEnergy, kPeepMaxEnergy } }; case GUEST_PARAMETER_HUNGER: return { { GUEST_PARAMETER_HAPPINESS, GUEST_PARAMETER_PREFERRED_RIDE_INTENSITY }, { 0, kPeepMaxHunger } }; case GUEST_PARAMETER_THIRST: diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index 16ecbca191..991fe38702 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -847,7 +847,7 @@ void Guest::Loc68FA89() newEnergy = kPeepMinEnergy; /* Previous code here suggested maximum energy is 128. */ - newEnergy = std::min(static_cast(PEEP_MAX_ENERGY), newEnergy); + newEnergy = std::min(kPeepMaxEnergy, newEnergy); if (newEnergy != Energy) { diff --git a/src/openrct2/entity/Peep.h b/src/openrct2/entity/Peep.h index 41007a593e..f88deae7b3 100644 --- a/src/openrct2/entity/Peep.h +++ b/src/openrct2/entity/Peep.h @@ -21,8 +21,8 @@ #include #include -constexpr int8_t kPeepMinEnergy = 32; -#define PEEP_MAX_ENERGY 128 +constexpr uint8_t kPeepMinEnergy = 32; +constexpr uint8_t kPeepMaxEnergy = 128; #define PEEP_MAX_ENERGY_TARGET 255 // Oddly, this differs from max energy! constexpr auto PEEP_CLEARANCE_HEIGHT = 4 * COORDS_Z_STEP; From ba1f0667105f7cce6c8b580779687a936d86e905 Mon Sep 17 00:00:00 2001 From: Harry-Hopkinson Date: Mon, 15 Apr 2024 15:26:10 +0000 Subject: [PATCH 3/7] Rename PEEP_MAX_ENERGY_TARGET to kPeepMaxEnergyTarget --- src/openrct2/entity/Guest.cpp | 4 ++-- src/openrct2/entity/Peep.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index 991fe38702..dd1c91a639 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -838,7 +838,7 @@ void Guest::Loc68FA89() } else { - newEnergy = std::min(PEEP_MAX_ENERGY_TARGET, newEnergy + 4); + newEnergy = std::min(kPeepMaxEnergyTarget, newEnergy + 4); if (newEnergy > newTargetEnergy) newEnergy = newTargetEnergy; } @@ -3035,7 +3035,7 @@ static void PeepUpdateHunger(Guest* peep) { peep->Hunger -= 2; - peep->EnergyTarget = std::min(peep->EnergyTarget + 2, PEEP_MAX_ENERGY_TARGET); + peep->EnergyTarget = std::min(peep->EnergyTarget + 2, kPeepMaxEnergyTarget); peep->Toilet = std::min(peep->Toilet + 1, 255); } } diff --git a/src/openrct2/entity/Peep.h b/src/openrct2/entity/Peep.h index f88deae7b3..c46704c53e 100644 --- a/src/openrct2/entity/Peep.h +++ b/src/openrct2/entity/Peep.h @@ -23,7 +23,7 @@ constexpr uint8_t kPeepMinEnergy = 32; constexpr uint8_t kPeepMaxEnergy = 128; -#define PEEP_MAX_ENERGY_TARGET 255 // Oddly, this differs from max energy! +constexpr int kPeepMaxEnergyTarget = 255; // Oddly, this differs from max energy! constexpr auto PEEP_CLEARANCE_HEIGHT = 4 * COORDS_Z_STEP; From c264ec107767c5bd727b6e21a75eb09016a8ee78 Mon Sep 17 00:00:00 2001 From: Harry-Hopkinson Date: Mon, 15 Apr 2024 15:28:51 +0000 Subject: [PATCH 4/7] Rename CHAT_HISTORY_SIZE to kChatHistorySize --- src/openrct2/interface/Chat.cpp | 4 ++-- src/openrct2/interface/Chat.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openrct2/interface/Chat.cpp b/src/openrct2/interface/Chat.cpp index 2b967786ab..984ec3b2a8 100644 --- a/src/openrct2/interface/Chat.cpp +++ b/src/openrct2/interface/Chat.cpp @@ -158,7 +158,7 @@ void ChatDraw(DrawPixelInfo& dpi, uint8_t chatBackgroundColor) int32_t stringHeight = 0; // Draw chat history - for (size_t i = 0; i < CHAT_HISTORY_SIZE; i++, screenCoords.y -= stringHeight) + for (size_t i = 0; i < kChatHistorySize; i++, screenCoords.y -= stringHeight) { if (i >= _chatHistory.size()) break; @@ -220,7 +220,7 @@ void ChatAddHistory(std::string_view s) std::string buffer = timeBuffer; buffer += s; - if (_chatHistory.size() >= CHAT_HISTORY_SIZE) + if (_chatHistory.size() >= kChatHistorySize) { _chatHistory.pop_back(); _chatHistoryTime.pop_back(); diff --git a/src/openrct2/interface/Chat.h b/src/openrct2/interface/Chat.h index 4103025e1e..6d97565364 100644 --- a/src/openrct2/interface/Chat.h +++ b/src/openrct2/interface/Chat.h @@ -14,7 +14,7 @@ #include -#define CHAT_HISTORY_SIZE 10 +constexpr int8_t kChatHistorySize = 10; #define CHAT_INPUT_SIZE 1024 #define CHAT_MAX_MESSAGE_LENGTH 200 #define CHAT_MAX_WINDOW_WIDTH 600 From 140e17029de9b06e6b16f48eeeb510142d79d052 Mon Sep 17 00:00:00 2001 From: Harry-Hopkinson Date: Mon, 15 Apr 2024 15:30:37 +0000 Subject: [PATCH 5/7] Rename CHAT_INPUT_SIZE to kChatInputSize --- src/openrct2-ui/windows/ServerStart.cpp | 4 ++-- src/openrct2/interface/Chat.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openrct2-ui/windows/ServerStart.cpp b/src/openrct2-ui/windows/ServerStart.cpp index 24dbb0081c..7c1eae78d8 100644 --- a/src/openrct2-ui/windows/ServerStart.cpp +++ b/src/openrct2-ui/windows/ServerStart.cpp @@ -104,7 +104,7 @@ static Widget _windowServerStartWidgets[] = { WindowStartTextbox(*this, widgetIndex, STR_STRING, _description, MAX_SERVER_DESCRIPTION_LENGTH); break; case WIDX_GREETING_INPUT: - WindowStartTextbox(*this, widgetIndex, STR_STRING, _greeting, CHAT_INPUT_SIZE); + WindowStartTextbox(*this, widgetIndex, STR_STRING, _greeting, kChatInputSize); break; case WIDX_PASSWORD_INPUT: WindowStartTextbox(*this, widgetIndex, STR_STRING, _password, 32); @@ -259,7 +259,7 @@ static Widget _windowServerStartWidgets[] = { char _port[7]; char _name[65]; char _description[MAX_SERVER_DESCRIPTION_LENGTH]; - char _greeting[CHAT_INPUT_SIZE]; + char _greeting[kChatInputSize]; char _password[33]; static void ScenarioSelectCallback(const utf8* path) { diff --git a/src/openrct2/interface/Chat.h b/src/openrct2/interface/Chat.h index 6d97565364..3963da6f3b 100644 --- a/src/openrct2/interface/Chat.h +++ b/src/openrct2/interface/Chat.h @@ -15,7 +15,7 @@ #include constexpr int8_t kChatHistorySize = 10; -#define CHAT_INPUT_SIZE 1024 +constexpr int16_t kChatInputSize = 1024; #define CHAT_MAX_MESSAGE_LENGTH 200 #define CHAT_MAX_WINDOW_WIDTH 600 From 337f9ca549cbefa7a4ef94724c55af6d9eb13d17 Mon Sep 17 00:00:00 2001 From: Harry-Hopkinson Date: Mon, 15 Apr 2024 15:35:00 +0000 Subject: [PATCH 6/7] Rename CHAT_MAX_MESSAGE_LENGTH to kChatMaxMessageLength --- src/openrct2/interface/Chat.cpp | 2 +- src/openrct2/interface/Chat.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openrct2/interface/Chat.cpp b/src/openrct2/interface/Chat.cpp index 984ec3b2a8..f51abf981b 100644 --- a/src/openrct2/interface/Chat.cpp +++ b/src/openrct2/interface/Chat.cpp @@ -53,7 +53,7 @@ bool ChatAvailable() void ChatOpen() { gChatOpen = true; - _chatTextInputSession = ContextStartTextInput(_chatCurrentLine, CHAT_MAX_MESSAGE_LENGTH); + _chatTextInputSession = ContextStartTextInput(_chatCurrentLine, kChatMaxMessageLength); } void ChatClose() diff --git a/src/openrct2/interface/Chat.h b/src/openrct2/interface/Chat.h index 3963da6f3b..6d9b1d8c85 100644 --- a/src/openrct2/interface/Chat.h +++ b/src/openrct2/interface/Chat.h @@ -16,7 +16,7 @@ constexpr int8_t kChatHistorySize = 10; constexpr int16_t kChatInputSize = 1024; -#define CHAT_MAX_MESSAGE_LENGTH 200 +constexpr int kChatMaxMessageLength = 200; #define CHAT_MAX_WINDOW_WIDTH 600 struct DrawPixelInfo; From 47939567c4c4c496d0ac61f600837939a2e642d2 Mon Sep 17 00:00:00 2001 From: Harry-Hopkinson Date: Mon, 15 Apr 2024 15:36:43 +0000 Subject: [PATCH 7/7] Rename CHAT_MAX_WINDOW_WIDTH - kChatMaxWindowWidth --- src/openrct2/entity/Guest.cpp | 4 ++-- src/openrct2/entity/Peep.h | 2 +- src/openrct2/interface/Chat.cpp | 2 +- src/openrct2/interface/Chat.h | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index dd1c91a639..aed97e083e 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -838,7 +838,7 @@ void Guest::Loc68FA89() } else { - newEnergy = std::min(kPeepMaxEnergyTarget, newEnergy + 4); + newEnergy = std::min(kPeepMaxEnergyTarget, newEnergy + 4); if (newEnergy > newTargetEnergy) newEnergy = newTargetEnergy; } @@ -3035,7 +3035,7 @@ static void PeepUpdateHunger(Guest* peep) { peep->Hunger -= 2; - peep->EnergyTarget = std::min(peep->EnergyTarget + 2, kPeepMaxEnergyTarget); + peep->EnergyTarget = std::min(peep->EnergyTarget + 2, kPeepMaxEnergyTarget); peep->Toilet = std::min(peep->Toilet + 1, 255); } } diff --git a/src/openrct2/entity/Peep.h b/src/openrct2/entity/Peep.h index c46704c53e..2ad9e98f99 100644 --- a/src/openrct2/entity/Peep.h +++ b/src/openrct2/entity/Peep.h @@ -23,7 +23,7 @@ constexpr uint8_t kPeepMinEnergy = 32; constexpr uint8_t kPeepMaxEnergy = 128; -constexpr int kPeepMaxEnergyTarget = 255; // Oddly, this differs from max energy! +constexpr uint8_t kPeepMaxEnergyTarget = 255; // Oddly, this differs from max energy! constexpr auto PEEP_CLEARANCE_HEIGHT = 4 * COORDS_Z_STEP; diff --git a/src/openrct2/interface/Chat.cpp b/src/openrct2/interface/Chat.cpp index f51abf981b..0189d69472 100644 --- a/src/openrct2/interface/Chat.cpp +++ b/src/openrct2/interface/Chat.cpp @@ -97,7 +97,7 @@ void ChatDraw(DrawPixelInfo& dpi, uint8_t chatBackgroundColor) } _chatLeft = 10; - _chatRight = std::min((ContextGetWidth() - 10), CHAT_MAX_WINDOW_WIDTH); + _chatRight = std::min((ContextGetWidth() - 10), kChatMaxWindowWidth); _chatWidth = _chatRight - _chatLeft; _chatBottom = ContextGetHeight() - 45; _chatTop = _chatBottom - 10; diff --git a/src/openrct2/interface/Chat.h b/src/openrct2/interface/Chat.h index 6d9b1d8c85..e55a8fbeed 100644 --- a/src/openrct2/interface/Chat.h +++ b/src/openrct2/interface/Chat.h @@ -16,8 +16,8 @@ constexpr int8_t kChatHistorySize = 10; constexpr int16_t kChatInputSize = 1024; -constexpr int kChatMaxMessageLength = 200; -#define CHAT_MAX_WINDOW_WIDTH 600 +constexpr uint8_t kChatMaxMessageLength = 200; +constexpr int16_t kChatMaxWindowWidth = 600; struct DrawPixelInfo; struct ScreenCoordsXY;