From 6de514c38721de081b548f2f044659f544214b9e Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Mon, 15 Jul 2024 21:16:30 +0200 Subject: [PATCH] Address minor code style violation in unsigned suffix (#22306) --- src/openrct2/drawing/Drawing.h | 2 +- src/openrct2/entity/Guest.cpp | 16 +++---- src/openrct2/entity/Peep.cpp | 2 +- src/openrct2/interface/Viewport.h | 60 ++++++++++++------------- src/openrct2/interface/Window.h | 2 +- src/openrct2/network/NetworkBase.cpp | 4 +- src/openrct2/park/ParkFile.cpp | 4 +- src/openrct2/ride/Ride.cpp | 2 +- src/openrct2/scripting/ScriptEngine.cpp | 2 +- src/openrct2/util/Util.h | 2 +- 10 files changed, 48 insertions(+), 48 deletions(-) diff --git a/src/openrct2/drawing/Drawing.h b/src/openrct2/drawing/Drawing.h index fd0953a3ba..958d5d77ec 100644 --- a/src/openrct2/drawing/Drawing.h +++ b/src/openrct2/drawing/Drawing.h @@ -45,7 +45,7 @@ struct PaletteBGRA uint8_t Alpha{}; }; -constexpr auto PALETTE_SIZE = 256U; +constexpr auto PALETTE_SIZE = 256u; struct GamePalette { diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index af3af61b63..763042796c 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -1315,7 +1315,7 @@ void Guest::UpdateSitting() if (HasFoodOrDrink()) { - if ((ScenarioRand() & 0xFFFFU) > 1310U) + if ((ScenarioRand() & 0xFFFFu) > 1310u) { TryGetUpFromSitting(); return; @@ -1328,7 +1328,7 @@ void Guest::UpdateSitting() } const auto rand = ScenarioRand(); - if ((rand & 0xFFFFU) > 131U) + if ((rand & 0xFFFFu) > 131u) { TryGetUpFromSitting(); return; @@ -1340,12 +1340,12 @@ void Guest::UpdateSitting() } Action = PeepActionType::SittingLookAroundLeft; - if (rand & 0x80000000U) + if (rand & 0x80000000u) { Action = PeepActionType::SittingLookAroundRight; } - if (rand & 0x40000000U) + if (rand & 0x40000000u) { Action = PeepActionType::SittingCheckWatch; } @@ -2145,7 +2145,7 @@ bool Guest::ShouldGoOnRide(Ride& ride, StationIndex entranceNum, bool atQueue, b // there's a 90% chance that the peep will ignore it. if (!RideHasRatings(ride) && ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_PEEP_CHECK_GFORCES)) { - if ((ScenarioRand() & 0xFFFF) > 0x1999U) + if ((ScenarioRand() & 0xFFFF) > 0x1999u) { ChoseNotToGoOnRide(ride, peepAtRide, false); return false; @@ -3647,7 +3647,7 @@ void Guest::UpdateRideLeaveEntranceWaypoints(const Ride& ride) const auto& rtd = ride.GetRideTypeDescriptor(); CoordsXY waypoint = rtd.GetGuestWaypointLocation(*vehicle, ride, CurrentRideStation); - const auto waypointIndex = Var37 / 4U; + const auto waypointIndex = Var37 / 4u; if (waypointIndex < carEntry->peep_loading_waypoints.size()) { Guard::Assert(carEntry->peep_loading_waypoints.size() >= static_cast(waypointIndex)); @@ -4317,7 +4317,7 @@ void Guest::UpdateRideLeaveVehicle() CoordsXYZ exitWaypointLoc = waypointLoc; - const auto waypointIndex = Var37 / 4U; + const auto waypointIndex = Var37 / 4u; if (waypointIndex < carEntry->peep_loading_waypoints.size()) { exitWaypointLoc.x += carEntry->peep_loading_waypoints[waypointIndex][2].x; @@ -4494,7 +4494,7 @@ void Guest::UpdateRideApproachVehicleWaypoints() } const auto& vehicle_type = rideEntry->Cars[vehicle->vehicle_type]; - const auto waypointIndex = Var37 / 4U; + const auto waypointIndex = Var37 / 4u; if (waypointIndex < vehicle_type.peep_loading_waypoints.size()) { Guard::Assert(waypoint < 3); diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index d5d5bfd8a3..62fda0d5eb 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -201,7 +201,7 @@ void PeepUpdateAll() const auto currentTicks = OpenRCT2::GetGameState().CurrentTicks; - constexpr auto kTicks128Mask = 128U - 1U; + constexpr auto kTicks128Mask = 128u - 1u; const auto currentTicksMasked = currentTicks & kTicks128Mask; uint32_t index = 0; diff --git a/src/openrct2/interface/Viewport.h b/src/openrct2/interface/Viewport.h index 0366976024..e6994bb5d2 100644 --- a/src/openrct2/interface/Viewport.h +++ b/src/openrct2/interface/Viewport.h @@ -30,42 +30,42 @@ struct PaintEntry; // Values can be changed when plugins move to using named constants. enum : uint32_t { - VIEWPORT_FLAG_NONE = 0U, + VIEWPORT_FLAG_NONE = 0u, - VIEWPORT_FLAG_GRIDLINES = (1U << 7), - VIEWPORT_FLAG_UNDERGROUND_INSIDE = (1U << 0), - VIEWPORT_FLAG_HIDE_BASE = (1U << 12), - VIEWPORT_FLAG_HIDE_VERTICAL = (1U << 13), + VIEWPORT_FLAG_GRIDLINES = (1u << 7), + VIEWPORT_FLAG_UNDERGROUND_INSIDE = (1u << 0), + VIEWPORT_FLAG_HIDE_BASE = (1u << 12), + VIEWPORT_FLAG_HIDE_VERTICAL = (1u << 13), - VIEWPORT_FLAG_SOUND_ON = (1U << 10), - VIEWPORT_FLAG_LAND_OWNERSHIP = (1U << 8), - VIEWPORT_FLAG_CONSTRUCTION_RIGHTS = (1U << 9), - VIEWPORT_FLAG_HIDE_ENTITIES = (1U << 14), - VIEWPORT_FLAG_CLIP_VIEW = (1U << 17), - VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES = (1U << 18), - VIEWPORT_FLAG_TRANSPARENT_BACKGROUND = (1U << 19), + VIEWPORT_FLAG_SOUND_ON = (1u << 10), + VIEWPORT_FLAG_LAND_OWNERSHIP = (1u << 8), + VIEWPORT_FLAG_CONSTRUCTION_RIGHTS = (1u << 9), + VIEWPORT_FLAG_HIDE_ENTITIES = (1u << 14), + VIEWPORT_FLAG_CLIP_VIEW = (1u << 17), + VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES = (1u << 18), + VIEWPORT_FLAG_TRANSPARENT_BACKGROUND = (1u << 19), - VIEWPORT_FLAG_LAND_HEIGHTS = (1U << 4), - VIEWPORT_FLAG_TRACK_HEIGHTS = (1U << 5), - VIEWPORT_FLAG_PATH_HEIGHTS = (1U << 6), + VIEWPORT_FLAG_LAND_HEIGHTS = (1u << 4), + VIEWPORT_FLAG_TRACK_HEIGHTS = (1u << 5), + VIEWPORT_FLAG_PATH_HEIGHTS = (1u << 6), - VIEWPORT_FLAG_HIDE_RIDES = (1U << 1), - VIEWPORT_FLAG_HIDE_VEHICLES = (1U << 20), - VIEWPORT_FLAG_HIDE_VEGETATION = (1U << 21), - VIEWPORT_FLAG_HIDE_SCENERY = (1U << 2), - VIEWPORT_FLAG_HIDE_PATHS = (1U << 16), - VIEWPORT_FLAG_HIDE_SUPPORTS = (1U << 3), - VIEWPORT_FLAG_HIDE_GUESTS = (1U << 11), - VIEWPORT_FLAG_HIDE_STAFF = (1U << 23), + VIEWPORT_FLAG_HIDE_RIDES = (1u << 1), + VIEWPORT_FLAG_HIDE_VEHICLES = (1u << 20), + VIEWPORT_FLAG_HIDE_VEGETATION = (1u << 21), + VIEWPORT_FLAG_HIDE_SCENERY = (1u << 2), + VIEWPORT_FLAG_HIDE_PATHS = (1u << 16), + VIEWPORT_FLAG_HIDE_SUPPORTS = (1u << 3), + VIEWPORT_FLAG_HIDE_GUESTS = (1u << 11), + VIEWPORT_FLAG_HIDE_STAFF = (1u << 23), - VIEWPORT_FLAG_INVISIBLE_RIDES = (1U << 24), - VIEWPORT_FLAG_INVISIBLE_VEHICLES = (1U << 25), - VIEWPORT_FLAG_INVISIBLE_VEGETATION = (1U << 26), - VIEWPORT_FLAG_INVISIBLE_SCENERY = (1U << 27), - VIEWPORT_FLAG_INVISIBLE_PATHS = (1U << 28), - VIEWPORT_FLAG_INVISIBLE_SUPPORTS = (1U << 29), + VIEWPORT_FLAG_INVISIBLE_RIDES = (1u << 24), + VIEWPORT_FLAG_INVISIBLE_VEHICLES = (1u << 25), + VIEWPORT_FLAG_INVISIBLE_VEGETATION = (1u << 26), + VIEWPORT_FLAG_INVISIBLE_SCENERY = (1u << 27), + VIEWPORT_FLAG_INVISIBLE_PATHS = (1u << 28), + VIEWPORT_FLAG_INVISIBLE_SUPPORTS = (1u << 29), - VIEWPORT_FLAG_INDEPEDENT_ROTATION = (1U << 30), + VIEWPORT_FLAG_INDEPEDENT_ROTATION = (1u << 30), }; enum class VisibilityKind diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index d434b3641e..a017c71f3c 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -255,7 +255,7 @@ enum WINDOW_FLAGS WF_SCROLLING_TO_LOCATION = (1 << 3), WF_TRANSPARENT = (1 << 4), WF_NO_BACKGROUND = (1 << 5), // Instead of half transparency, completely remove the window background - WF_DEAD = (1U << 6), // Window is closed and will be deleted in the next update. + WF_DEAD = (1u << 6), // Window is closed and will be deleted in the next update. WF_7 = (1 << 7), WF_RESIZABLE = (1 << 8), WF_NO_AUTO_CLOSE = (1 << 9), // Don't auto close this window if too many windows are open diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index f880110f06..cc4c4f8187 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -1395,8 +1395,8 @@ void NetworkBase::ServerSendScripts(NetworkConnection& connection) # else NetworkPacket packetScriptHeader(NetworkCommand::ScriptsHeader); - packetScriptHeader << static_cast(0U); - packetScriptHeader << static_cast(0U); + packetScriptHeader << static_cast(0u); + packetScriptHeader << static_cast(0u); # endif } diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index 78a86a8c3a..8edbc2d9bb 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -1470,7 +1470,7 @@ namespace OpenRCT2 { uint16_t tempRideValue{}; cs.ReadWrite(tempRideValue); - if (tempRideValue == 0xFFFFU) + if (tempRideValue == 0xFFFFu) { ride.value = RIDE_VALUE_UNDEFINED; } @@ -1483,7 +1483,7 @@ namespace OpenRCT2 { money64 tempRideValue{}; cs.ReadWrite(tempRideValue); - if (tempRideValue == 0xFFFFU) + if (tempRideValue == 0xFFFFu) { ride.value = RIDE_VALUE_UNDEFINED; } diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index a8716c2ecf..8bc709aa93 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -2274,7 +2274,7 @@ void RideSetVehicleColoursToRandomPreset(Ride& ride, uint8_t preset_index) ride.vehicleColourSettings = VehicleColourSettings::perTrain; for (uint32_t i = 0; i < presetList->count; i++) { - const auto index = i % 32U; + const auto index = i % 32u; ride.vehicle_colours[i] = presetList->list[index]; } } diff --git a/src/openrct2/scripting/ScriptEngine.cpp b/src/openrct2/scripting/ScriptEngine.cpp index 9e9c67ccc5..694a0c945c 100644 --- a/src/openrct2/scripting/ScriptEngine.cpp +++ b/src/openrct2/scripting/ScriptEngine.cpp @@ -1634,7 +1634,7 @@ IntervalHandle ScriptEngine::AllocateHandle() const auto nextHandle = _nextIntervalHandle; // In case of overflow start from 1 again - _nextIntervalHandle = std::max(_nextIntervalHandle + 1U, 1U); + _nextIntervalHandle = std::max(_nextIntervalHandle + 1u, 1u); return nextHandle; } diff --git a/src/openrct2/util/Util.h b/src/openrct2/util/Util.h index d18181625a..ea891221df 100644 --- a/src/openrct2/util/Util.h +++ b/src/openrct2/util/Util.h @@ -88,5 +88,5 @@ constexpr uint8_t HiByte(uint16_t value) constexpr uint8_t LoByte(uint16_t value) { - return static_cast(value & 0xFFU); + return static_cast(value & 0xFFu); }