diff --git a/src/openrct2-ui/input/MouseInput.cpp b/src/openrct2-ui/input/MouseInput.cpp index 42b2149537..bf8c830b7e 100644 --- a/src/openrct2-ui/input/MouseInput.cpp +++ b/src/openrct2-ui/input/MouseInput.cpp @@ -515,7 +515,7 @@ namespace OpenRCT2 static void InputWindowResizeContinue(WindowBase& w, const ScreenCoordsXY& screenCoords) { - if (screenCoords.y < static_cast(ContextGetHeight()) - 2) + if (screenCoords.y < (ContextGetHeight() - 2)) { auto differentialCoords = screenCoords - gInputDragLast; int32_t targetWidth = _originalWindowWidth + differentialCoords.x - w.width; diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp index 30818497a1..3240732f12 100644 --- a/src/openrct2-ui/windows/Cheats.cpp +++ b/src/openrct2-ui/windows/Cheats.cpp @@ -884,29 +884,25 @@ static StringId window_cheats_page_titles[] = { case WIDX_MONTH_UP: _monthSpinnerValue++; _monthSpinnerValue = std::clamp(_monthSpinnerValue, 1, static_cast(MONTH_COUNT)); - _daySpinnerValue = std::clamp( - _daySpinnerValue, 1, static_cast(Date::GetDaysInMonth(_monthSpinnerValue - 1))); + _daySpinnerValue = std::clamp(_daySpinnerValue, 1, Date::GetDaysInMonth(_monthSpinnerValue - 1)); invalidateWidget(WIDX_MONTH_BOX); invalidateWidget(WIDX_DAY_BOX); break; case WIDX_MONTH_DOWN: _monthSpinnerValue--; _monthSpinnerValue = std::clamp(_monthSpinnerValue, 1, static_cast(MONTH_COUNT)); - _daySpinnerValue = std::clamp( - _daySpinnerValue, 1, static_cast(Date::GetDaysInMonth(_monthSpinnerValue - 1))); + _daySpinnerValue = std::clamp(_daySpinnerValue, 1, Date::GetDaysInMonth(_monthSpinnerValue - 1)); invalidateWidget(WIDX_MONTH_BOX); invalidateWidget(WIDX_DAY_BOX); break; case WIDX_DAY_UP: _daySpinnerValue++; - _daySpinnerValue = std::clamp( - _daySpinnerValue, 1, static_cast(Date::GetDaysInMonth(_monthSpinnerValue - 1))); + _daySpinnerValue = std::clamp(_daySpinnerValue, 1, Date::GetDaysInMonth(_monthSpinnerValue - 1)); invalidateWidget(WIDX_DAY_BOX); break; case WIDX_DAY_DOWN: _daySpinnerValue--; - _daySpinnerValue = std::clamp( - _daySpinnerValue, 1, static_cast(Date::GetDaysInMonth(_monthSpinnerValue - 1))); + _daySpinnerValue = std::clamp(_daySpinnerValue, 1, Date::GetDaysInMonth(_monthSpinnerValue - 1)); invalidateWidget(WIDX_DAY_BOX); break; case WIDX_DATE_SET: diff --git a/src/openrct2-ui/windows/Finances.cpp b/src/openrct2-ui/windows/Finances.cpp index 3565a710c2..e0ed2ca1ac 100644 --- a/src/openrct2-ui/windows/Finances.cpp +++ b/src/openrct2-ui/windows/Finances.cpp @@ -565,7 +565,7 @@ namespace OpenRCT2::Ui::Windows auto newLoan = gameState.park.bankLoan - 1000.00_GBP; if (gameState.park.bankLoan > 0) { - newLoan = std::max(static_cast(0LL), newLoan); + newLoan = std::max(0.00_GBP, newLoan); } auto gameAction = GameActions::ParkSetLoanAction(newLoan); GameActions::Execute(&gameAction, gameState); diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp index 50553bdcfb..8ff2845c75 100644 --- a/src/openrct2-ui/windows/Options.cpp +++ b/src/openrct2-ui/windows/Options.cpp @@ -2229,7 +2229,7 @@ namespace OpenRCT2::Ui::Windows void AdvancedDraw(Drawing::RenderTarget& rt) { auto ft = Formatter(); - ft.Add(static_cast(Config::Get().general.autosaveAmount)); + ft.Add(Config::Get().general.autosaveAmount); DrawTextBasic( rt, windowPos + ScreenCoordsXY{ widgets[WIDX_AUTOSAVE_AMOUNT].left + 1, widgets[WIDX_AUTOSAVE_AMOUNT].top + 1 }, STR_WINDOW_COLOUR_2_COMMA32, ft, { colours[1] }); diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 2c2908c448..f51c0b387f 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -4173,8 +4173,7 @@ namespace OpenRCT2::Ui::Windows auto z = info.Element->GetBaseZ(); auto direction = info.Element->GetDirection(); auto gameAction = GameActions::RideSetColourSchemeAction( - CoordsXYZD{ info.Loc, z, static_cast(direction) }, info.Element->AsTrack()->GetTrackType(), - newColourScheme); + CoordsXYZD{ info.Loc, z, direction }, info.Element->AsTrack()->GetTrackType(), newColourScheme); GameActions::Execute(&gameAction, getGameState()); } diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index d6c03cc88b..889465562e 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -331,7 +331,7 @@ namespace OpenRCT2::Ui::Windows auto i = static_cast(screenCoords.y / kScrollableRowHeight); if (i != _highlightedIndex) { - _highlightedIndex = static_cast(i); + _highlightedIndex = i; invalidate(); } } diff --git a/src/openrct2/EditorObjectSelectionSession.cpp b/src/openrct2/EditorObjectSelectionSession.cpp index d9be6bc772..6e3977797e 100644 --- a/src/openrct2/EditorObjectSelectionSession.cpp +++ b/src/openrct2/EditorObjectSelectionSession.cpp @@ -143,12 +143,12 @@ void SetupInUseSelectionFlags() { for (auto i = 0u; i < getObjectEntryGroupCount(objectType); i++) { - Editor::ClearSelectedObject(static_cast(objectType), i, ObjectSelectionFlags::AllFlags); + Editor::ClearSelectedObject(objectType, i, ObjectSelectionFlags::AllFlags); - auto loadedObj = objectMgr.GetLoadedObject(static_cast(objectType), i); + auto loadedObj = objectMgr.GetLoadedObject(objectType, i); if (loadedObj != nullptr) { - Editor::SetSelectedObject(static_cast(objectType), i, ObjectSelectionFlags::Selected); + Editor::SetSelectedObject(objectType, i, ObjectSelectionFlags::Selected); } } } diff --git a/src/openrct2/actions/SurfaceSetStyleAction.cpp b/src/openrct2/actions/SurfaceSetStyleAction.cpp index 880757cebb..7f9fed9c5f 100644 --- a/src/openrct2/actions/SurfaceSetStyleAction.cpp +++ b/src/openrct2/actions/SurfaceSetStyleAction.cpp @@ -55,8 +55,7 @@ namespace OpenRCT2::GameActions auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); if (_surfaceStyle != kObjectEntryIndexNull) { - const auto surfaceObj = static_cast( - objManager.GetLoadedObject(_surfaceStyle)); + const auto surfaceObj = objManager.GetLoadedObject(_surfaceStyle); if (surfaceObj == nullptr) { diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index 21cc061fdd..c5a52e4899 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -2348,7 +2348,7 @@ void Guest::SpendMoney(money64& peep_expend_type, money64 amount, ExpenditureTyp { assert(!(getGameState().park.flags & PARK_FLAGS_NO_MONEY)); - CashInPocket = std::max(0.00_GBP, static_cast(CashInPocket) - amount); + CashInPocket = std::max(0.00_GBP, CashInPocket - amount); CashSpent += amount; peep_expend_type += amount; diff --git a/src/openrct2/interface/Viewport.cpp b/src/openrct2/interface/Viewport.cpp index 5f2412c051..cfc5b076b1 100644 --- a/src/openrct2/interface/Viewport.cpp +++ b/src/openrct2/interface/Viewport.cpp @@ -1723,8 +1723,7 @@ namespace OpenRCT2 Viewport* viewport = window->viewport; auto viewLoc = screenCoords; viewLoc -= viewport->pos; - if (viewLoc.x >= 0 && viewLoc.x < static_cast(viewport->width) && viewLoc.y >= 0 - && viewLoc.y < static_cast(viewport->height)) + if ((viewLoc.x >= 0) && (viewLoc.x < viewport->width) && (viewLoc.y >= 0) && (viewLoc.y < viewport->height)) { viewLoc.x = viewport->zoom.ApplyTo(viewLoc.x); viewLoc.y = viewport->zoom.ApplyTo(viewLoc.y); diff --git a/src/openrct2/network/Socket.cpp b/src/openrct2/network/Socket.cpp index 09d5212f26..e9e2cd4185 100644 --- a/src/openrct2/network/Socket.cpp +++ b/src/openrct2/network/Socket.cpp @@ -777,9 +777,7 @@ namespace OpenRCT2::Network { const char* bufferStart = static_cast(buffer) + totalSent; size_t remainingSize = size - totalSent; - int32_t sentBytes = sendto( - _socket, bufferStart, static_cast(remainingSize), FLAG_NO_PIPE, static_cast(ss), - ss_len); + int32_t sentBytes = sendto(_socket, bufferStart, static_cast(remainingSize), FLAG_NO_PIPE, ss, ss_len); if (sentBytes == SOCKET_ERROR) { return totalSent; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 16681818e1..094d85ae08 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -586,7 +586,7 @@ namespace OpenRCT2::RCT1 RCT12::EntryList* entries = GetEntryList(objectType); // Check if there are spare entries available - size_t maxEntries = static_cast(getObjectEntryGroupCount(objectType)); + size_t maxEntries = getObjectEntryGroupCount(objectType); if (entries != nullptr && entries->GetCount() < maxEntries) { entries->GetOrAddEntry(objectName); diff --git a/src/openrct2/rct12/RCT12.h b/src/openrct2/rct12/RCT12.h index 1fa0cb6a29..05fc284e66 100644 --- a/src/openrct2/rct12/RCT12.h +++ b/src/openrct2/rct12/RCT12.h @@ -639,12 +639,12 @@ struct RCT12TileElement : public RCT12TileElementBase template const TType* as() const { - return static_cast(GetType()) == TClass ? reinterpret_cast(this) : nullptr; + return GetType() == TClass ? reinterpret_cast(this) : nullptr; } template TType* as() { - return static_cast(GetType()) == TClass ? reinterpret_cast(this) : nullptr; + return GetType() == TClass ? reinterpret_cast(this) : nullptr; } const RCT12SurfaceElement* AsSurface() const diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 2ef6a17372..7084c9781e 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -5631,7 +5631,7 @@ void DetermineRideEntranceAndExitLocations() } else { - station.Entrance.direction = static_cast(entranceElement->GetDirection()); + station.Entrance.direction = entranceElement->GetDirection(); } } @@ -5646,7 +5646,7 @@ void DetermineRideEntranceAndExitLocations() } else { - station.Exit.direction = static_cast(entranceElement->GetDirection()); + station.Exit.direction = entranceElement->GetDirection(); } } @@ -5697,8 +5697,7 @@ void DetermineRideEntranceAndExitLocations() } // Found our entrance - station.Entrance = { x, y, entranceElement->BaseHeight, - static_cast(entranceElement->GetDirection()) }; + station.Entrance = { x, y, entranceElement->BaseHeight, entranceElement->GetDirection() }; alreadyFoundEntrance = true; LOG_VERBOSE( @@ -5716,8 +5715,7 @@ void DetermineRideEntranceAndExitLocations() } // Found our exit - station.Exit = { x, y, entranceElement->BaseHeight, - static_cast(entranceElement->GetDirection()) }; + station.Exit = { x, y, entranceElement->BaseHeight, entranceElement->GetDirection() }; alreadyFoundExit = true; LOG_VERBOSE( diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index acc7999e69..7954411469 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -1642,8 +1642,8 @@ static GameActions::Result TrackDesignPlaceRide( } auto trackPlaceAction = GameActions::TrackPlaceAction( - ride.id, trackType, ride.type, { newCoords, tempZ, static_cast(rotation) }, - track.brakeBoosterSpeed, track.colourScheme, track.seatRotation, liftHillAndAlternativeState, true); + ride.id, trackType, ride.type, { newCoords, tempZ, rotation }, track.brakeBoosterSpeed, track.colourScheme, + track.seatRotation, liftHillAndAlternativeState, true); trackPlaceAction.SetFlags(flags); auto res = flags.has(CommandFlag::apply) ? GameActions::ExecuteNested(&trackPlaceAction, gameState) diff --git a/src/openrct2/ride/TrackDesignSave.cpp b/src/openrct2/ride/TrackDesignSave.cpp index 1d946ecbd7..478643f985 100644 --- a/src/openrct2/ride/TrackDesignSave.cpp +++ b/src/openrct2/ride/TrackDesignSave.cpp @@ -285,8 +285,7 @@ static TrackDesignAddStatus TrackDesignSaveAddLargeScenery(const CoordsXY& loc, auto direction = tileElement->GetDirection(); auto sequence = tileElement->GetSequenceIndex(); - auto sceneryOrigin = MapLargeSceneryGetOrigin( - { loc.x, loc.y, z << 3, static_cast(direction) }, sequence, nullptr); + auto sceneryOrigin = MapLargeSceneryGetOrigin({ loc.x, loc.y, z << 3, direction }, sequence, nullptr); if (!sceneryOrigin.has_value()) { return TrackDesignAddStatus::Success(); @@ -300,7 +299,7 @@ static TrackDesignAddStatus TrackDesignSaveAddLargeScenery(const CoordsXY& loc, CoordsXYZ tileLoc = { sceneryOrigin->x + rotatedOffsetPos.x, sceneryOrigin->y + rotatedOffsetPos.y, sceneryOrigin->z + tile.offset.z }; - auto largeElement = MapGetLargeScenerySegment({ tileLoc, static_cast(direction) }, tile.index); + auto largeElement = MapGetLargeScenerySegment({ tileLoc, direction }, tile.index); if (largeElement != nullptr) { if (tile.index == 0) @@ -501,8 +500,7 @@ static void TrackDesignSaveRemoveLargeScenery(const CoordsXY& loc, LargeSceneryE auto direction = tileElement->GetDirection(); auto sequence = tileElement->GetSequenceIndex(); - auto sceneryOrigin = MapLargeSceneryGetOrigin( - { loc.x, loc.y, z << 3, static_cast(direction) }, sequence, nullptr); + auto sceneryOrigin = MapLargeSceneryGetOrigin({ loc.x, loc.y, z << 3, direction }, sequence, nullptr); if (!sceneryOrigin) { return; @@ -516,7 +514,7 @@ static void TrackDesignSaveRemoveLargeScenery(const CoordsXY& loc, LargeSceneryE CoordsXYZ tileLoc = { sceneryOrigin->x + rotatedOffsetPos.x, sceneryOrigin->y + rotatedOffsetPos.y, sceneryOrigin->z + tile.offset.z }; - auto largeElement = MapGetLargeScenerySegment({ tileLoc, static_cast(direction) }, tile.index); + auto largeElement = MapGetLargeScenerySegment({ tileLoc, direction }, tile.index); if (largeElement != nullptr) { if (tile.index == 0)