diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp index 64e16f9893..b790d1d088 100644 --- a/src/openrct2-ui/windows/Cheats.cpp +++ b/src/openrct2-ui/windows/Cheats.cpp @@ -978,10 +978,10 @@ 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, 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..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 - PEEP_MIN_ENERGY, PEEP_MAX_ENERGY - PEEP_MIN_ENERGY, 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-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/actions/CheatSetAction.cpp b/src/openrct2/actions/CheatSetAction.cpp index fb5d15ca81..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 }, - { PEEP_MIN_ENERGY, 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 98590f0d46..aed97e083e 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -838,16 +838,16 @@ void Guest::Loc68FA89() } else { - newEnergy = std::min(PEEP_MAX_ENERGY_TARGET, newEnergy + 4); + newEnergy = std::min(kPeepMaxEnergyTarget, newEnergy + 4); if (newEnergy > newTargetEnergy) 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); + newEnergy = std::min(kPeepMaxEnergy, newEnergy); if (newEnergy != Energy) { @@ -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 794103dac7..2ad9e98f99 100644 --- a/src/openrct2/entity/Peep.h +++ b/src/openrct2/entity/Peep.h @@ -21,9 +21,9 @@ #include #include -#define PEEP_MIN_ENERGY 32 -#define PEEP_MAX_ENERGY 128 -#define PEEP_MAX_ENERGY_TARGET 255 // Oddly, this differs from max energy! +constexpr uint8_t kPeepMinEnergy = 32; +constexpr uint8_t kPeepMaxEnergy = 128; +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 2b967786ab..0189d69472 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() @@ -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; @@ -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..e55a8fbeed 100644 --- a/src/openrct2/interface/Chat.h +++ b/src/openrct2/interface/Chat.h @@ -14,10 +14,10 @@ #include -#define CHAT_HISTORY_SIZE 10 -#define CHAT_INPUT_SIZE 1024 -#define CHAT_MAX_MESSAGE_LENGTH 200 -#define CHAT_MAX_WINDOW_WIDTH 600 +constexpr int8_t kChatHistorySize = 10; +constexpr int16_t kChatInputSize = 1024; +constexpr uint8_t kChatMaxMessageLength = 200; +constexpr int16_t kChatMaxWindowWidth = 600; struct DrawPixelInfo; struct ScreenCoordsXY;