diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index d9d3f1c62e..65cce78289 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -517,7 +517,7 @@ void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost) cost = -cost; msg = STR_INCOME_FLOAT_INCOME; } - AddTextEffect(GetEncodedString(msg, cost), pt.x, pt.y, Ticks::DAY_TICKS, TE_RISING); + AddTextEffect(GetEncodedString(msg, cost), pt.x, pt.y, Ticks::DAY_TICKS, TextEffectMode::Rising); } /** @@ -533,14 +533,14 @@ void ShowFeederIncomeAnimation(int x, int y, int z, Money transfer, Money income Point pt = RemapCoords(x, y, z); if (income == 0) { - AddTextEffect(GetEncodedString(STR_FEEDER, transfer), pt.x, pt.y, Ticks::DAY_TICKS, TE_RISING); + AddTextEffect(GetEncodedString(STR_FEEDER, transfer), pt.x, pt.y, Ticks::DAY_TICKS, TextEffectMode::Rising); } else { StringID msg = STR_FEEDER_COST; if (income < 0) { income = -income; msg = STR_FEEDER_INCOME; } - AddTextEffect(GetEncodedString(msg, transfer, income), pt.x, pt.y, Ticks::DAY_TICKS, TE_RISING); + AddTextEffect(GetEncodedString(msg, transfer, income), pt.x, pt.y, Ticks::DAY_TICKS, TextEffectMode::Rising); } } @@ -559,7 +559,7 @@ TextEffectID ShowFillingPercent(int x, int y, int z, uint8_t percent, StringID s assert(string != STR_NULL); - return AddTextEffect(GetEncodedString(string, percent), pt.x, pt.y, 0, TE_STATIC); + return AddTextEffect(GetEncodedString(string, percent), pt.x, pt.y, 0, TextEffectMode::Static); } /** diff --git a/src/texteff.cpp b/src/texteff.cpp index dee8c8befb..39925e6ede 100644 --- a/src/texteff.cpp +++ b/src/texteff.cpp @@ -22,7 +22,7 @@ /** Container for all information about a text effect */ struct TextEffect : public ViewportSign { TextEffectMode mode; ///< Type of text effect. - uint8_t duration; ///< How long the text effect should stay, in ticks (applies only when mode == TE_RISING) + uint8_t duration; ///< How long the text effect should stay, in ticks (applies only when mode == TextEffectMode::Rising) EncodedString msg; ///< Encoded message for text effect. /** Reset the text effect */ @@ -30,10 +30,10 @@ struct TextEffect : public ViewportSign { { this->MarkDirty(); this->width_normal = 0; - this->mode = TE_INVALID; + this->mode = TextEffectMode::Invalid; } - inline bool IsValid() const { return this->mode != TE_INVALID; } + inline bool IsValid() const { return this->mode != TextEffectMode::Invalid; } }; static std::vector _text_effects; ///< Text effects are stored there @@ -94,7 +94,7 @@ const IntervalTimer move_all_text_effects_interval = {std::chrono:: for (TextEffect &te : _text_effects) { if (!te.IsValid()) continue; - if (te.mode != TE_RISING) continue; + if (te.mode != TextEffectMode::Rising) continue; if (te.duration < count) { te.Reset(); @@ -126,7 +126,7 @@ void DrawTextEffects(DrawPixelInfo *dpi) for (const TextEffect &te : _text_effects) { if (!te.IsValid()) continue; - if (te.mode == TE_RISING || _settings_client.gui.loading_indicators) { + if (te.mode == TextEffectMode::Rising || _settings_client.gui.loading_indicators) { std::string *str = ViewportAddString(dpi, &te, flags, Colours::Invalid); if (str == nullptr) continue; diff --git a/src/texteff.hpp b/src/texteff.hpp index 6689594b1e..be70329ba7 100644 --- a/src/texteff.hpp +++ b/src/texteff.hpp @@ -17,10 +17,10 @@ /** * Text effect modes. */ -enum TextEffectMode : uint8_t { - TE_INVALID, ///< Text effect is invalid. - TE_RISING, ///< Make the text effect slowly go upwards - TE_STATIC, ///< Keep the text effect static +enum class TextEffectMode : uint8_t { + Invalid, ///< Text effect is invalid. + Rising, ///< Make the text effect slowly go upwards + Static, ///< Keep the text effect static }; using TextEffectID = uint16_t; diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 06fad3f996..60a1c5519f 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -2973,7 +2973,7 @@ void CcStartStopVehicle(Commands, const CommandCost &result, VehicleID veh_id, b StringID msg = v->vehstatus.Test(VehState::Stopped) ? STR_VEHICLE_COMMAND_STOPPED : STR_VEHICLE_COMMAND_STARTED; const Vehicle *moving_front = v->GetMovingFront(); Point pt = RemapCoords(moving_front->x_pos, moving_front->y_pos, moving_front->z_pos); - AddTextEffect(GetEncodedString(msg), pt.x, pt.y, Ticks::DAY_TICKS, TE_RISING); + AddTextEffect(GetEncodedString(msg), pt.x, pt.y, Ticks::DAY_TICKS, TextEffectMode::Rising); } /**