diff --git a/src/openrct2-ui/ride/Construction.cpp b/src/openrct2-ui/ride/Construction.cpp index 41ad29fa8b..f5e09ecf0f 100644 --- a/src/openrct2-ui/ride/Construction.cpp +++ b/src/openrct2-ui/ride/Construction.cpp @@ -258,8 +258,8 @@ namespace OpenRCT2 SpecialElementsDropdownState list; // if it's building neither forwards nor backwards, no list is available - if (state != RideConstructionState::Front && state != RideConstructionState::Place - && state != RideConstructionState::Back) + if (state != RideConstructionState::front && state != RideConstructionState::place + && state != RideConstructionState::back) return list; auto& elements = list.Elements; @@ -272,7 +272,7 @@ namespace OpenRCT2 // If the current build orientation (slope, bank, diagonal) matches the track element's, show the piece as enabled bool entryIsDisabled; - if (state == RideConstructionState::Back) + if (state == RideConstructionState::back) { entryIsDisabled = ted.definition.pitchEnd != buildSlope || ted.definition.rollEnd != buildBank || TrackPieceDirectionIsDiagonal(ted.coordinates.rotationEnd) != buildDirectionIsDiagonal; diff --git a/src/openrct2-ui/windows/MazeConstruction.cpp b/src/openrct2-ui/windows/MazeConstruction.cpp index 33bfcdf42e..e6cb0bec5e 100644 --- a/src/openrct2-ui/windows/MazeConstruction.cpp +++ b/src/openrct2-ui/windows/MazeConstruction.cpp @@ -176,14 +176,14 @@ namespace OpenRCT2::Ui::Windows void onResize() override { uint64_t newDisabledWidgets = 0; - if (_rideConstructionState == RideConstructionState::Place) + if (_rideConstructionState == RideConstructionState::place) { newDisabledWidgets |= ((1uLL << WIDX_MAZE_BUILD_MODE) | (1uLL << WIDX_MAZE_MOVE_MODE) | (1uLL << WIDX_MAZE_FILL_MODE) | (1uLL << WIDX_MAZE_DIRECTION_NW) | (1uLL << WIDX_MAZE_DIRECTION_NE) | (1uLL << WIDX_MAZE_DIRECTION_SW) | (1uLL << WIDX_MAZE_DIRECTION_SE)); } - else if (_rideConstructionState == RideConstructionState::EntranceExit) + else if (_rideConstructionState == RideConstructionState::entranceExit) { newDisabledWidgets = (1uLL << WIDX_MAZE_DIRECTION_NW) | (1uLL << WIDX_MAZE_DIRECTION_NE) | (1uLL << WIDX_MAZE_DIRECTION_SW) | (1uLL << WIDX_MAZE_DIRECTION_SE); @@ -207,13 +207,13 @@ namespace OpenRCT2::Ui::Windows switch (widgetIndex) { case WIDX_MAZE_BUILD_MODE: - WindowMazeConstructionBuildModeMousedown(RideConstructionState::MazeBuild); + WindowMazeConstructionBuildModeMousedown(RideConstructionState::mazeBuild); break; case WIDX_MAZE_MOVE_MODE: - WindowMazeConstructionBuildModeMousedown(RideConstructionState::MazeMove); + WindowMazeConstructionBuildModeMousedown(RideConstructionState::mazeMove); break; case WIDX_MAZE_FILL_MODE: - WindowMazeConstructionBuildModeMousedown(RideConstructionState::MazeFill); + WindowMazeConstructionBuildModeMousedown(RideConstructionState::mazeFill); break; } } @@ -229,14 +229,14 @@ namespace OpenRCT2::Ui::Windows switch (_rideConstructionState) { - case RideConstructionState::Place: + case RideConstructionState::place: if (!isToolActive(*this, WIDX_MAZE_DIRECTION_GROUPBOX)) { close(); return; } break; - case RideConstructionState::EntranceExit: + case RideConstructionState::entranceExit: if (!isToolActive(*this, WIDX_MAZE_ENTRANCE) && !isToolActive(*this, WIDX_MAZE_EXIT)) { _rideConstructionState = gRideEntranceExitPlacePreviousRideConstructionState; @@ -249,9 +249,9 @@ namespace OpenRCT2::Ui::Windows switch (_rideConstructionState) { - case RideConstructionState::Front: - case RideConstructionState::Back: - case RideConstructionState::Selected: + case RideConstructionState::front: + case RideConstructionState::back: + case RideConstructionState::selected: if (isToolActive(WindowClass::rideConstruction)) { ToolCancel(); @@ -324,18 +324,18 @@ namespace OpenRCT2::Ui::Windows RideConstructionInvalidateCurrentTrack(); - if (_rideConstructionState != RideConstructionState::EntranceExit) + if (_rideConstructionState != RideConstructionState::entranceExit) { gRideEntranceExitPlacePreviousRideConstructionState = _rideConstructionState; } - _rideConstructionState = RideConstructionState::EntranceExit; + _rideConstructionState = RideConstructionState::entranceExit; WindowMazeConstructionUpdatePressedWidgets(); } void WindowMazeConstructionBuildModeMousedown(RideConstructionState rideConstructionState) { - if (_rideConstructionState == RideConstructionState::EntranceExit) + if (_rideConstructionState == RideConstructionState::entranceExit) { ToolCancel(); } @@ -414,15 +414,15 @@ namespace OpenRCT2::Ui::Windows z = _currentTrackBegin.z; switch (_rideConstructionState) { - case RideConstructionState::MazeBuild: + case RideConstructionState::mazeBuild: mode = MazeBuildMode::build; break; - case RideConstructionState::MazeMove: + case RideConstructionState::mazeMove: mode = MazeBuildMode::move; actionFlags = { CommandFlag::allowDuringPaused }; break; default: - case RideConstructionState::MazeFill: + case RideConstructionState::mazeFill: mode = MazeBuildMode::fill; break; } @@ -438,7 +438,7 @@ namespace OpenRCT2::Ui::Windows _currentTrackBegin.x = x; _currentTrackBegin.y = y; - if (_rideConstructionState != RideConstructionState::MazeMove) + if (_rideConstructionState != RideConstructionState::mazeMove) { Audio::Play3D(Audio::SoundId::placeItem, { x, y, z }); } @@ -459,12 +459,12 @@ namespace OpenRCT2::Ui::Windows if (w == nullptr) return; - const bool isEntranceExit = _rideConstructionState == RideConstructionState::EntranceExit; + const bool isEntranceExit = _rideConstructionState == RideConstructionState::entranceExit; const bool entranceToolActive = isToolActive(WindowClass::rideConstruction, WIDX_MAZE_ENTRANCE); - widgetSetPressed(*w, WIDX_MAZE_BUILD_MODE, _rideConstructionState == RideConstructionState::MazeBuild); - widgetSetPressed(*w, WIDX_MAZE_MOVE_MODE, _rideConstructionState == RideConstructionState::MazeMove); - widgetSetPressed(*w, WIDX_MAZE_FILL_MODE, _rideConstructionState == RideConstructionState::MazeFill); + widgetSetPressed(*w, WIDX_MAZE_BUILD_MODE, _rideConstructionState == RideConstructionState::mazeBuild); + widgetSetPressed(*w, WIDX_MAZE_MOVE_MODE, _rideConstructionState == RideConstructionState::mazeMove); + widgetSetPressed(*w, WIDX_MAZE_FILL_MODE, _rideConstructionState == RideConstructionState::mazeFill); widgetSetPressed(*w, WIDX_MAZE_ENTRANCE, isEntranceExit && entranceToolActive); widgetSetPressed(*w, WIDX_MAZE_EXIT, isEntranceExit && !entranceToolActive); diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index aecd5a6c27..e35139b79a 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -283,7 +283,7 @@ namespace OpenRCT2::Ui::Windows _previousTrackPitchEnd = TrackPitch::none; _currentTrackPieceDirection = 0; - _rideConstructionState = RideConstructionState::Place; + _rideConstructionState = RideConstructionState::place; _currentTrackSelectionFlags.clearAll(); _autoOpeningShop = false; _autoRotatingShop = true; @@ -361,7 +361,7 @@ namespace OpenRCT2::Ui::Windows uint64_t newDisabledWidgets = 0; - if (_rideConstructionState == RideConstructionState::Place) + if (_rideConstructionState == RideConstructionState::place) { newDisabledWidgets |= (1uLL << WIDX_CONSTRUCT); } @@ -466,7 +466,7 @@ namespace OpenRCT2::Ui::Windows && !(_currentTrackHasLiftHill)) newDisabledWidgets |= (1uLL << WIDX_SLOPE_UP); } - if (_rideConstructionState == RideConstructionState::State0) + if (_rideConstructionState == RideConstructionState::state0) { newDisabledWidgets |= (1uLL << WIDX_CONSTRUCT) | (1uLL << WIDX_DEMOLISH) | (1uLL << WIDX_PREVIOUS_SECTION) | (1uLL << WIDX_NEXT_SECTION); @@ -777,7 +777,7 @@ namespace OpenRCT2::Ui::Windows { newDisabledWidgets |= (1uLL << WIDX_SLOPE_UP_STEEP); if (_currentlySelectedTrack == TrackCurve::left || _currentlySelectedTrack == TrackCurve::right - || _rideConstructionState != RideConstructionState::Back + || _rideConstructionState != RideConstructionState::back || !IsTrackEnabled(TrackGroup::slopeCurveBanked)) { newDisabledWidgets |= (1uLL << WIDX_LEVEL); @@ -787,7 +787,7 @@ namespace OpenRCT2::Ui::Windows { newDisabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP); if (_currentlySelectedTrack == TrackCurve::left || _currentlySelectedTrack == TrackCurve::right - || _rideConstructionState != RideConstructionState::Front + || _rideConstructionState != RideConstructionState::front || !IsTrackEnabled(TrackGroup::slopeCurveBanked)) { newDisabledWidgets |= (1uLL << WIDX_LEVEL); @@ -934,7 +934,7 @@ namespace OpenRCT2::Ui::Windows } if (IsTrackEnabled(TrackGroup::slopeCurveBanked)) { - if (_rideConstructionState == RideConstructionState::Front) + if (_rideConstructionState == RideConstructionState::front) { if (_currentlySelectedTrack == TrackCurve::leftSmall || _currentlySelectedTrack == TrackCurve::rightSmall) { @@ -946,7 +946,7 @@ namespace OpenRCT2::Ui::Windows } } } - else if (_rideConstructionState == RideConstructionState::Back) + else if (_rideConstructionState == RideConstructionState::back) { if (_currentlySelectedTrack == TrackCurve::leftSmall || _currentlySelectedTrack == TrackCurve::rightSmall) { @@ -963,7 +963,7 @@ namespace OpenRCT2::Ui::Windows | (1uLL << WIDX_LEFT_CURVE) | (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_SMALL) | (1uLL << WIDX_RIGHT_CURVE_VERY_SMALL); } - if (_rideConstructionState == RideConstructionState::Front) + if (_rideConstructionState == RideConstructionState::front) { newDisabledWidgets |= (1uLL << WIDX_NEXT_SECTION); if (WindowRideConstructionUpdateState(nullptr, nullptr, nullptr, nullptr, nullptr, nullptr)) @@ -971,7 +971,7 @@ namespace OpenRCT2::Ui::Windows newDisabledWidgets |= (1uLL << WIDX_CONSTRUCT); } } - else if (_rideConstructionState == RideConstructionState::Back) + else if (_rideConstructionState == RideConstructionState::back) { newDisabledWidgets |= (1uLL << WIDX_PREVIOUS_SECTION); if (WindowRideConstructionUpdateState(nullptr, nullptr, nullptr, nullptr, nullptr, nullptr)) @@ -983,8 +983,8 @@ namespace OpenRCT2::Ui::Windows { newDisabledWidgets &= ~(1uLL << WIDX_BANKING_GROUPBOX); } - if (_rideConstructionState == RideConstructionState::EntranceExit - || _rideConstructionState == RideConstructionState::Selected) + if (_rideConstructionState == RideConstructionState::entranceExit + || _rideConstructionState == RideConstructionState::selected) { newDisabledWidgets |= (1uLL << WIDX_DIRECTION_GROUPBOX) | (1uLL << WIDX_SLOPE_GROUPBOX) | (1uLL << WIDX_BANKING_GROUPBOX) | (1uLL << WIDX_LEFT_CURVE_VERY_SMALL) | (1uLL << WIDX_LEFT_CURVE_SMALL) @@ -1053,7 +1053,7 @@ namespace OpenRCT2::Ui::Windows } } - if (_rideConstructionState == RideConstructionState::Place) + if (_rideConstructionState == RideConstructionState::place) { if (!isToolActive(*this, WIDX_CONSTRUCT)) { @@ -1062,7 +1062,7 @@ namespace OpenRCT2::Ui::Windows } } - if (_rideConstructionState == RideConstructionState::EntranceExit) + if (_rideConstructionState == RideConstructionState::entranceExit) { if (!isToolActive(*this, WIDX_ENTRANCE) && !isToolActive(*this, WIDX_EXIT)) { @@ -1073,9 +1073,9 @@ namespace OpenRCT2::Ui::Windows switch (_rideConstructionState) { - case RideConstructionState::Front: - case RideConstructionState::Back: - case RideConstructionState::Selected: + case RideConstructionState::front: + case RideConstructionState::back: + case RideConstructionState::selected: if (isToolActive(WindowClass::rideConstruction)) { ToolCancel(); @@ -1289,7 +1289,7 @@ namespace OpenRCT2::Ui::Windows break; case WIDX_SLOPE_DOWN: RideConstructionInvalidateCurrentTrack(); - if (_rideConstructionState == RideConstructionState::Back && _currentTrackRollEnd != TrackRoll::none) + if (_rideConstructionState == RideConstructionState::back && _currentTrackRollEnd != TrackRoll::none) { _currentTrackRollEnd = TrackRoll::none; } @@ -1297,7 +1297,7 @@ namespace OpenRCT2::Ui::Windows break; case WIDX_LEVEL: RideConstructionInvalidateCurrentTrack(); - if (_rideConstructionState == RideConstructionState::Front && _previousTrackPitchEnd == TrackPitch::down25) + if (_rideConstructionState == RideConstructionState::front && _previousTrackPitchEnd == TrackPitch::down25) { if (_currentlySelectedTrack == TrackCurve::leftSmall) { @@ -1309,7 +1309,7 @@ namespace OpenRCT2::Ui::Windows } } else if ( - _rideConstructionState == RideConstructionState::Back && _previousTrackPitchEnd == TrackPitch::up25) + _rideConstructionState == RideConstructionState::back && _previousTrackPitchEnd == TrackPitch::up25) { if (_currentlySelectedTrack == TrackCurve::leftSmall) { @@ -1324,13 +1324,13 @@ namespace OpenRCT2::Ui::Windows break; case WIDX_SLOPE_UP: RideConstructionInvalidateCurrentTrack(); - if (_rideConstructionState == RideConstructionState::Front && _currentTrackRollEnd != TrackRoll::none) + if (_rideConstructionState == RideConstructionState::front && _currentTrackRollEnd != TrackRoll::none) { _currentTrackRollEnd = TrackRoll::none; } if (currentRide->getRideTypeDescriptor().SupportsTrackGroup(TrackGroup::reverseFreefall)) { - if (_rideConstructionState == RideConstructionState::Front + if (_rideConstructionState == RideConstructionState::front && _currentlySelectedTrack == TrackCurve::none) { _currentlySelectedTrack = TrackElemType::reverseFreefallSlope; @@ -1452,7 +1452,7 @@ namespace OpenRCT2::Ui::Windows uint8_t brakesSpeed = std::min(trackSpeedMaximum, _currentBrakeSpeed + trackSpeedIncrement); if (brakesSpeed != _currentBrakeSpeed) { - if (_rideConstructionState == RideConstructionState::Selected) + if (_rideConstructionState == RideConstructionState::selected) { SetBrakeSpeed(brakesSpeed); } @@ -1483,7 +1483,7 @@ namespace OpenRCT2::Ui::Windows uint8_t brakesSpeed = std::max(trackSpeedMinimum, _currentBrakeSpeed - trackSpeedIncrement); if (brakesSpeed != _currentBrakeSpeed) { - if (_rideConstructionState == RideConstructionState::Selected) + if (_rideConstructionState == RideConstructionState::selected) { SetBrakeSpeed(brakesSpeed); } @@ -1515,7 +1515,7 @@ namespace OpenRCT2::Ui::Windows case WIDX_SEAT_ROTATION_ANGLE_SPINNER_UP: if (_currentSeatRotationAngle < 15) { - if (_rideConstructionState == RideConstructionState::Selected) + if (_rideConstructionState == RideConstructionState::selected) { RideSelectedTrackSetSeatRotation(_currentSeatRotationAngle + 1); } @@ -1529,7 +1529,7 @@ namespace OpenRCT2::Ui::Windows case WIDX_SEAT_ROTATION_ANGLE_SPINNER_DOWN: if (_currentSeatRotationAngle > 0) { - if (_rideConstructionState == RideConstructionState::Selected) + if (_rideConstructionState == RideConstructionState::selected) { RideSelectedTrackSetSeatRotation(_currentSeatRotationAngle - 1); } @@ -1711,7 +1711,7 @@ namespace OpenRCT2::Ui::Windows // Draw cost screenCoords = { windowPos.x + widget.midX(), windowPos.y + widget.bottom - 23 }; - if (_rideConstructionState != RideConstructionState::Place) + if (_rideConstructionState != RideConstructionState::place) drawText(rt, screenCoords, STR_BUILD_THIS, { TextAlignment::centre }); screenCoords.y += 11; @@ -2049,22 +2049,22 @@ namespace OpenRCT2::Ui::Windows switch (_rideConstructionState) { - case RideConstructionState::Front: + case RideConstructionState::front: widgets[WIDX_CONSTRUCT].setVisible(); widgets[WIDX_NEXT_SECTION].setHidden(); break; - case RideConstructionState::Back: + case RideConstructionState::back: widgets[WIDX_CONSTRUCT].setVisible(); widgets[WIDX_PREVIOUS_SECTION].setHidden(); break; - case RideConstructionState::Place: + case RideConstructionState::place: widgets[WIDX_CONSTRUCT].setVisible(); widgets[WIDX_DEMOLISH].setHidden(); widgets[WIDX_NEXT_SECTION].setHidden(); widgets[WIDX_PREVIOUS_SECTION].setHidden(); widgets[WIDX_ROTATE].setVisible(); break; - case RideConstructionState::EntranceExit: + case RideConstructionState::entranceExit: widgets[WIDX_DEMOLISH].setHidden(); widgets[WIDX_NEXT_SECTION].setHidden(); widgets[WIDX_PREVIOUS_SECTION].setHidden(); @@ -2204,17 +2204,17 @@ namespace OpenRCT2::Ui::Windows switch (_rideConstructionState) { - case RideConstructionState::State0: + case RideConstructionState::state0: trackDirection = _currentTrackPieceDirection; trackType = TrackElemType::flat; trackPos = _currentTrackBegin; break; - case RideConstructionState::Selected: + case RideConstructionState::selected: trackDirection = _currentTrackPieceDirection; trackType = _currentTrackPieceType; trackPos = _currentTrackBegin; break; - case RideConstructionState::EntranceExit: + case RideConstructionState::entranceExit: MapSelection::clearSelectedTiles(); return; default: @@ -2283,11 +2283,11 @@ namespace OpenRCT2::Ui::Windows auto trackPlaceAction = GameActions::TrackPlaceAction( rideIndex, trackType, currentRide->type, { trackPos, static_cast(trackDirection) }, properties & 0xFF, (properties >> 8) & 0x0F, (properties >> 12) & 0x0F, liftHillAndAlternativeState, false); - if (_rideConstructionState == RideConstructionState::Back) + if (_rideConstructionState == RideConstructionState::back) { trackPlaceAction.SetCallback(RideConstructPlacedBackwardGameActionCallback); } - else if (_rideConstructionState == RideConstructionState::Front) + else if (_rideConstructionState == RideConstructionState::front) { trackPlaceAction.SetCallback(RideConstructPlacedForwardGameActionCallback); } @@ -2341,24 +2341,24 @@ namespace OpenRCT2::Ui::Windows RideConstructionInvalidateCurrentTrack(); // Select the track element that is to be deleted - _rideConstructionState2 = RideConstructionState::Selected; - if (_rideConstructionState == RideConstructionState::Front) + _rideConstructionState2 = RideConstructionState::selected; + if (_rideConstructionState == RideConstructionState::front) { if (!RideSelectBackwardsFromFront()) { WindowRideConstructionUpdateActiveElements(); return; } - _rideConstructionState2 = RideConstructionState::Front; + _rideConstructionState2 = RideConstructionState::front; } - else if (_rideConstructionState == RideConstructionState::Back) + else if (_rideConstructionState == RideConstructionState::back) { if (!RideSelectForwardsFromBack()) { WindowRideConstructionUpdateActiveElements(); return; } - _rideConstructionState2 = RideConstructionState::Back; + _rideConstructionState2 = RideConstructionState::back; } // Invalidate the selected track element or make sure it's at origin??? @@ -2466,10 +2466,10 @@ namespace OpenRCT2::Ui::Windows gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0); gInputFlags.set(InputFlag::allowRightMouseRemoval); RideConstructionInvalidateCurrentTrack(); - if (_rideConstructionState != RideConstructionState::EntranceExit) + if (_rideConstructionState != RideConstructionState::entranceExit) { gRideEntranceExitPlacePreviousRideConstructionState = _rideConstructionState; - _rideConstructionState = RideConstructionState::EntranceExit; + _rideConstructionState = RideConstructionState::entranceExit; } WindowRideConstructionUpdateActiveElements(); } @@ -2492,10 +2492,10 @@ namespace OpenRCT2::Ui::Windows gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0); gInputFlags.set(InputFlag::allowRightMouseRemoval); RideConstructionInvalidateCurrentTrack(); - if (_rideConstructionState != RideConstructionState::EntranceExit) + if (_rideConstructionState != RideConstructionState::entranceExit) { gRideEntranceExitPlacePreviousRideConstructionState = _rideConstructionState; - _rideConstructionState = RideConstructionState::EntranceExit; + _rideConstructionState = RideConstructionState::entranceExit; } WindowRideConstructionUpdateActiveElements(); } @@ -2505,7 +2505,7 @@ namespace OpenRCT2::Ui::Windows { _currentTrackPitchEnd = slope; _currentTrackPrice = kMoney64Undefined; - if (_rideConstructionState == RideConstructionState::Front && !getGameState().cheats.enableChainLiftOnAllTrack) + if (_rideConstructionState == RideConstructionState::front && !getGameState().cheats.enableChainLiftOnAllTrack) { switch (slope) { @@ -2863,7 +2863,7 @@ namespace OpenRCT2::Ui::Windows static void CloseConstructWindowOnCompletion(const Ride& ride) { - if (_rideConstructionState == RideConstructionState::State0) + if (_rideConstructionState == RideConstructionState::state0) { auto* windowMgr = GetWindowManager(); auto w = windowMgr->FindByClass(WindowClass::rideConstruction); @@ -2891,7 +2891,7 @@ namespace OpenRCT2::Ui::Windows return; } - if (_rideConstructionState == RideConstructionState::State0) + if (_rideConstructionState == RideConstructionState::state0) { w = windowMgr->FindByClass(WindowClass::rideConstruction); if (w != nullptr) @@ -2931,14 +2931,14 @@ namespace OpenRCT2::Ui::Windows _currentTrackPieceDirection = next_track.element->getDirection(); _currentTrackPieceType = next_track.element->asTrack()->GetTrackType(); _currentTrackSelectionFlags.clearAll(); - _rideConstructionState = RideConstructionState::Selected; + _rideConstructionState = RideConstructionState::selected; _rideConstructionNextArrowPulse = 0; gMapSelectFlags.unset(MapSelectFlag::enableArrow); RideSelectNextSection(); } else { - _rideConstructionState = RideConstructionState::State0; + _rideConstructionState = RideConstructionState::state0; } WindowRideConstructionDoEntranceExitCheck(); @@ -2978,14 +2978,14 @@ namespace OpenRCT2::Ui::Windows _currentTrackPieceDirection = trackBeginEnd.begin_direction; _currentTrackPieceType = trackBeginEnd.begin_element->asTrack()->GetTrackType(); _currentTrackSelectionFlags.clearAll(); - _rideConstructionState = RideConstructionState::Selected; + _rideConstructionState = RideConstructionState::selected; _rideConstructionNextArrowPulse = 0; gMapSelectFlags.unset(MapSelectFlag::enableArrow); RideSelectPreviousSection(); } else { - _rideConstructionState = RideConstructionState::State0; + _rideConstructionState = RideConstructionState::state0; } WindowRideConstructionUpdateActiveElements(); @@ -3133,7 +3133,7 @@ namespace OpenRCT2::Ui::Windows window->updateMapSelection(); _selectedTrackType = TrackElemType::none; - if (_rideConstructionState == RideConstructionState::Selected) + if (_rideConstructionState == RideConstructionState::selected) { TileElement* tileElement; if (GetTrackElementOriginAndApplyChanges( @@ -3198,8 +3198,8 @@ namespace OpenRCT2::Ui::Windows switch (_rideConstructionState) { - case RideConstructionState::Front: - case RideConstructionState::Back: + case RideConstructionState::front: + case RideConstructionState::back: { // place ghost piece if (!_currentTrackSelectionFlags.has(TrackSelectionFlag::track)) @@ -3220,7 +3220,7 @@ namespace OpenRCT2::Ui::Windows // diagonal pieces trigger this if (arrowDirection >= 4) arrowDirection += 4; - if (_rideConstructionState == RideConstructionState::Back) + if (_rideConstructionState == RideConstructionState::back) arrowDirection = DirectionReverse(arrowDirection); gMapSelectArrowDirection = arrowDirection; @@ -3244,7 +3244,7 @@ namespace OpenRCT2::Ui::Windows gMapSelectFlags.set(MapSelectFlag::enableArrow); break; } - case RideConstructionState::Selected: + case RideConstructionState::selected: { auto curTime = Platform::GetTicks(); if (_rideConstructionNextArrowPulse >= curTime) @@ -3261,13 +3261,13 @@ namespace OpenRCT2::Ui::Windows if (!newCoords.has_value()) { RideConstructionRemoveGhosts(); - _rideConstructionState = RideConstructionState::State0; + _rideConstructionState = RideConstructionState::state0; } break; } - case RideConstructionState::MazeBuild: - case RideConstructionState::MazeMove: - case RideConstructionState::MazeFill: + case RideConstructionState::mazeBuild: + case RideConstructionState::mazeMove: + case RideConstructionState::mazeFill: { auto curTime = Platform::GetTicks(); if (_rideConstructionNextArrowPulse >= curTime) @@ -3445,7 +3445,7 @@ namespace OpenRCT2::Ui::Windows _currentTrackBegin.z += 16; } - if (_autoRotatingShop && _rideConstructionState == RideConstructionState::Place + if (_autoRotatingShop && _rideConstructionState == RideConstructionState::place && ride->getRideTypeDescriptor().flags.has(RtdFlag::isShopOrFacility)) { PathElement* pathsByDir[kNumOrthogonalDirections]; @@ -3638,7 +3638,7 @@ namespace OpenRCT2::Ui::Windows { for (int32_t zAttempts = 0; zAttempts < numAttempts; ++zAttempts) { - _rideConstructionState = RideConstructionState::MazeBuild; + _rideConstructionState = RideConstructionState::mazeBuild; _currentTrackBegin.x = mapCoords.x; _currentTrackBegin.y = mapCoords.y; _currentTrackBegin.z = z; @@ -3671,7 +3671,7 @@ namespace OpenRCT2::Ui::Windows if (mazeSetTrackResult.error != GameActions::Status::ok) { - _rideConstructionState = RideConstructionState::Place; + _rideConstructionState = RideConstructionState::place; StringId errorText = std::get(mazeSetTrackResult.errorMessage); z -= 8; if (errorText == STR_NOT_ENOUGH_CASH_REQUIRES || errorText == STR_CAN_ONLY_BUILD_THIS_UNDERWATER @@ -3706,7 +3706,7 @@ namespace OpenRCT2::Ui::Windows for (int32_t zAttempts = 0; zAttempts < numAttempts; ++zAttempts) { - _rideConstructionState = RideConstructionState::Front; + _rideConstructionState = RideConstructionState::front; _currentTrackBegin.x = mapCoords.x; _currentTrackBegin.y = mapCoords.y; _currentTrackBegin.z = z; @@ -4556,7 +4556,7 @@ namespace OpenRCT2::Ui::Windows if (_gotoStartPlacementMode) { _currentTrackBegin.z = floor2(piecePos.z, kCoordsZStep); - _rideConstructionState = RideConstructionState::Front; + _rideConstructionState = RideConstructionState::front; _currentTrackSelectionFlags.clearAll(); _currentTrackPieceDirection = piecePos.direction & 3; auto savedSelectedTrack = _currentlySelectedTrack; @@ -4588,15 +4588,15 @@ namespace OpenRCT2::Ui::Windows } else { - if (_rideConstructionState2 == RideConstructionState::Selected - || _rideConstructionState2 == RideConstructionState::Front) + if (_rideConstructionState2 == RideConstructionState::selected + || _rideConstructionState2 == RideConstructionState::front) { if (type == TrackElemType::middleStation || type == TrackElemType::beginStation) { type = TrackElemType::endStation; } } - if (_rideConstructionState2 == RideConstructionState::Back) + if (_rideConstructionState2 == RideConstructionState::back) { if (type == TrackElemType::middleStation) { @@ -4606,17 +4606,17 @@ namespace OpenRCT2::Ui::Windows if (Network::GetMode() == Network::Mode::client) { // rideConstructionState needs to be set again to the proper value, this only affects the client - _rideConstructionState = RideConstructionState::Selected; + _rideConstructionState = RideConstructionState::selected; } _currentTrackBegin = piecePos; _currentTrackPieceDirection = piecePos.direction; _currentTrackPieceType = type; _currentTrackSelectionFlags.clearAll(); - if (_rideConstructionState2 == RideConstructionState::Front) + if (_rideConstructionState2 == RideConstructionState::front) { RideSelectNextSection(); } - else if (_rideConstructionState2 == RideConstructionState::Back) + else if (_rideConstructionState2 == RideConstructionState::back) { RideSelectPreviousSection(); } @@ -4711,7 +4711,7 @@ namespace OpenRCT2::Ui::Windows auto startBank = _previousTrackRollEnd; auto endBank = _currentTrackRollEnd; - if (_rideConstructionState == RideConstructionState::Back) + if (_rideConstructionState == RideConstructionState::back) { startSlope = _currentTrackPitchEnd; endSlope = _previousTrackPitchEnd; @@ -4728,7 +4728,7 @@ namespace OpenRCT2::Ui::Windows bool startsDiagonal = (_currentTrackPieceDirection & (1 << 2)) != 0; if (selectedTrack == TrackCurve::leftLarge || selectedTrack == TrackCurve::rightLarge) { - if (_rideConstructionState == RideConstructionState::Back) + if (_rideConstructionState == RideConstructionState::back) { startsDiagonal = !startsDiagonal; } @@ -4769,7 +4769,7 @@ namespace OpenRCT2::Ui::Windows return std::make_pair(false, TrackElemType::flat); } - if (_rideConstructionState == RideConstructionState::Back) + if (_rideConstructionState == RideConstructionState::back) { if (endSlope != TrackPitch::down25) { @@ -4910,7 +4910,7 @@ namespace OpenRCT2::Ui::Windows x = _currentTrackBegin.x; y = _currentTrackBegin.y; auto z = _currentTrackBegin.z; - if (_rideConstructionState == RideConstructionState::Back) + if (_rideConstructionState == RideConstructionState::back) { z -= trackCoordinates.zEnd; trackDirection = _currentTrackPieceDirection ^ 0x02; diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 851fdc4330..f93ba89106 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -2456,7 +2456,7 @@ static ResultWithMessage RideCheckBlockBrakes(const CoordsXYE& input, CoordsXYE* auto* windowMgr = Ui::GetWindowManager(); WindowBase* w = windowMgr->FindByClass(WindowClass::rideConstruction); - if (w != nullptr && _rideConstructionState != RideConstructionState::State0 && _currentRideIndex == rideIndex) + if (w != nullptr && _rideConstructionState != RideConstructionState::state0 && _currentRideIndex == rideIndex) RideConstructionInvalidateCurrentTrack(); TrackCircuitIterator it; @@ -2521,7 +2521,7 @@ static bool RideCheckTrackContainsInversions(const CoordsXYE& input, CoordsXYE* auto* windowMgr = Ui::GetWindowManager(); WindowBase* w = windowMgr->FindByClass(WindowClass::rideConstruction); - if (w != nullptr && _rideConstructionState != RideConstructionState::State0 && rideIndex == _currentRideIndex) + if (w != nullptr && _rideConstructionState != RideConstructionState::state0 && rideIndex == _currentRideIndex) { RideConstructionInvalidateCurrentTrack(); } @@ -2582,7 +2582,7 @@ static bool RideCheckTrackContainsBanked(const CoordsXYE& input, CoordsXYE* outp auto* windowMgr = Ui::GetWindowManager(); WindowBase* w = windowMgr->FindByClass(WindowClass::rideConstruction); - if (w != nullptr && _rideConstructionState != RideConstructionState::State0 && rideIndex == _currentRideIndex) + if (w != nullptr && _rideConstructionState != RideConstructionState::state0 && rideIndex == _currentRideIndex) { RideConstructionInvalidateCurrentTrack(); } @@ -2624,7 +2624,7 @@ static int32_t RideCheckStationLength(const CoordsXYE& input, CoordsXYE* output) { auto* windowMgr = Ui::GetWindowManager(); WindowBase* w = windowMgr->FindByClass(WindowClass::rideConstruction); - if (w != nullptr && _rideConstructionState != RideConstructionState::State0 + if (w != nullptr && _rideConstructionState != RideConstructionState::state0 && _currentRideIndex == input.element->asTrack()->GetRideIndex()) { RideConstructionInvalidateCurrentTrack(); @@ -2687,7 +2687,7 @@ static bool RideCheckStartAndEndIsStation(const CoordsXYE& input) auto* windowMgr = Ui::GetWindowManager(); auto w = windowMgr->FindByClass(WindowClass::rideConstruction); - if (w != nullptr && _rideConstructionState != RideConstructionState::State0 && rideIndex == _currentRideIndex) + if (w != nullptr && _rideConstructionState != RideConstructionState::state0 && rideIndex == _currentRideIndex) { RideConstructionInvalidateCurrentTrack(); } @@ -4778,7 +4778,7 @@ static int32_t RideGetTrackLength(const Ride& ride) auto* windowMgr = Ui::GetWindowManager(); WindowBase* w = windowMgr->FindByClass(WindowClass::rideConstruction); - if (w != nullptr && _rideConstructionState != RideConstructionState::State0 && _currentRideIndex == rideIndex) + if (w != nullptr && _rideConstructionState != RideConstructionState::state0 && _currentRideIndex == rideIndex) { RideConstructionInvalidateCurrentTrack(); } diff --git a/src/openrct2/ride/RideConstruction.cpp b/src/openrct2/ride/RideConstruction.cpp index 4736514255..b47a126027 100644 --- a/src/openrct2/ride/RideConstruction.cpp +++ b/src/openrct2/ride/RideConstruction.cpp @@ -715,24 +715,24 @@ void RideConstructionInvalidateCurrentTrack() { switch (_rideConstructionState) { - case RideConstructionState::Selected: + case RideConstructionState::selected: GetTrackElementOriginAndApplyChanges( { _currentTrackBegin, static_cast(_currentTrackPieceDirection & 3) }, _currentTrackPieceType, 0, nullptr, { TrackElementSetFlag::highlightOff }); break; - case RideConstructionState::MazeBuild: - case RideConstructionState::MazeMove: - case RideConstructionState::MazeFill: - case RideConstructionState::Front: - case RideConstructionState::Back: + case RideConstructionState::mazeBuild: + case RideConstructionState::mazeMove: + case RideConstructionState::mazeFill: + case RideConstructionState::front: + case RideConstructionState::back: if (_currentTrackSelectionFlags.has(TrackSelectionFlag::arrow)) { MapInvalidateTileFull(_currentTrackBegin.ToTileStart()); } RideConstructionRemoveGhosts(); break; - case RideConstructionState::Place: - case RideConstructionState::EntranceExit: + case RideConstructionState::place: + case RideConstructionState::entranceExit: default: if (_currentTrackSelectionFlags.has(TrackSelectionFlag::arrow)) { @@ -773,7 +773,7 @@ static void ride_construction_reset_current_piece() else { _currentlySelectedTrack = TrackElemType::none; - _rideConstructionState = RideConstructionState::State0; + _rideConstructionState = RideConstructionState::state0; } } @@ -800,7 +800,7 @@ void RideConstructionSetDefaultNextPiece() const TrackElementDescriptor* ted; switch (_rideConstructionState) { - case RideConstructionState::Front: + case RideConstructionState::front: { direction = _currentTrackPieceDirection; if (!trackBlockGetPreviousFromZero(_currentTrackBegin, *ride, direction, &trackBeginEnd)) @@ -865,7 +865,7 @@ void RideConstructionSetDefaultNextPiece() _previousTrackPiece.z = trackElement->getBaseZ(); break; } - case RideConstructionState::Back: + case RideConstructionState::back: { direction = DirectionReverse(_currentTrackPieceDirection); if (!trackBlockGetNextFromZero(_currentTrackBegin, *ride, direction, &xyElement, &z, &direction, false)) @@ -936,7 +936,7 @@ void RideConstructionSetDefaultNextPiece() */ void RideSelectNextSection() { - if (_rideConstructionState == RideConstructionState::Selected) + if (_rideConstructionState == RideConstructionState::selected) { RideConstructionInvalidateCurrentTrack(); int32_t direction = _currentTrackPieceDirection; @@ -946,7 +946,7 @@ void RideSelectNextSection() { _currentTrackBegin, static_cast(direction & 3) }, type, 0, &tileElement, {}); if (!newCoords.has_value()) { - _rideConstructionState = RideConstructionState::State0; + _rideConstructionState = RideConstructionState::state0; WindowRideConstructionUpdateActiveElements(); return; } @@ -968,7 +968,7 @@ void RideSelectNextSection() } else { - _rideConstructionState = RideConstructionState::Front; + _rideConstructionState = RideConstructionState::front; _currentTrackBegin = { outputElement, newCoords->z }; _currentTrackPieceDirection = direction; _currentTrackPieceType = tileElement->asTrack()->GetTrackType(); @@ -977,7 +977,7 @@ void RideSelectNextSection() WindowRideConstructionUpdateActiveElements(); } } - else if (_rideConstructionState == RideConstructionState::Back) + else if (_rideConstructionState == RideConstructionState::back) { gMapSelectFlags.unset(MapSelectFlag::enableArrow); @@ -994,7 +994,7 @@ void RideSelectNextSection() */ void RideSelectPreviousSection() { - if (_rideConstructionState == RideConstructionState::Selected) + if (_rideConstructionState == RideConstructionState::selected) { RideConstructionInvalidateCurrentTrack(); int32_t direction = _currentTrackPieceDirection; @@ -1004,7 +1004,7 @@ void RideSelectPreviousSection() { _currentTrackBegin, static_cast(direction & 3) }, type, 0, &tileElement, {}); if (newCoords == std::nullopt) { - _rideConstructionState = RideConstructionState::State0; + _rideConstructionState = RideConstructionState::state0; WindowRideConstructionUpdateActiveElements(); return; } @@ -1022,7 +1022,7 @@ void RideSelectPreviousSection() } else { - _rideConstructionState = RideConstructionState::Back; + _rideConstructionState = RideConstructionState::back; _currentTrackBegin.x = trackBeginEnd.end_x; _currentTrackBegin.y = trackBeginEnd.end_y; _currentTrackBegin.z = trackBeginEnd.begin_z; @@ -1033,7 +1033,7 @@ void RideSelectPreviousSection() WindowRideConstructionUpdateActiveElements(); } } - else if (_rideConstructionState == RideConstructionState::Front) + else if (_rideConstructionState == RideConstructionState::front) { gMapSelectFlags.unset(MapSelectFlag::enableArrow); @@ -1082,7 +1082,7 @@ static bool ride_modify_entrance_or_exit(const CoordsXYE& tileElement) } RideConstructionInvalidateCurrentTrack(); - if (_rideConstructionState != RideConstructionState::EntranceExit || !isToolActive(WindowClass::rideConstruction)) + if (_rideConstructionState != RideConstructionState::entranceExit || !isToolActive(WindowClass::rideConstruction)) { // Replace entrance / exit ToolSet( @@ -1093,10 +1093,10 @@ static bool ride_modify_entrance_or_exit(const CoordsXYE& tileElement) gRideEntranceExitPlaceRideIndex = rideIndex; gRideEntranceExitPlaceStationIndex = stationIndex; gInputFlags.set(InputFlag::allowRightMouseRemoval); - if (_rideConstructionState != RideConstructionState::EntranceExit) + if (_rideConstructionState != RideConstructionState::entranceExit) { gRideEntranceExitPlacePreviousRideConstructionState = _rideConstructionState; - _rideConstructionState = RideConstructionState::EntranceExit; + _rideConstructionState = RideConstructionState::entranceExit; } WindowRideConstructionUpdateActiveElements(); @@ -1138,7 +1138,7 @@ static bool ride_modify_maze(const CoordsXYE& tileElement) if (trackElement != nullptr) { _currentRideIndex = trackElement->GetRideIndex(); - _rideConstructionState = RideConstructionState::MazeBuild; + _rideConstructionState = RideConstructionState::mazeBuild; _currentTrackBegin.x = tileElement.x; _currentTrackBegin.y = tileElement.y; _currentTrackBegin.z = trackElement->getBaseZ(); @@ -1222,7 +1222,7 @@ bool RideModify(const CoordsXYE& input) return false; _currentRideIndex = rideIndex; - _rideConstructionState = RideConstructionState::Selected; + _rideConstructionState = RideConstructionState::selected; _currentTrackBegin = newCoords.value(); _currentTrackPieceDirection = direction; _currentTrackPieceType = type; @@ -1237,13 +1237,13 @@ bool RideModify(const CoordsXYE& input) } RideSelectNextSection(); - if (_rideConstructionState == RideConstructionState::Front) + if (_rideConstructionState == RideConstructionState::front) { WindowRideConstructionUpdateActiveElements(); return true; } - _rideConstructionState = RideConstructionState::Selected; + _rideConstructionState = RideConstructionState::selected; _currentTrackBegin = *newCoords; _currentTrackPieceDirection = direction; _currentTrackPieceType = type; @@ -1251,9 +1251,9 @@ bool RideModify(const CoordsXYE& input) RideSelectPreviousSection(); - if (_rideConstructionState != RideConstructionState::Back) + if (_rideConstructionState != RideConstructionState::back) { - _rideConstructionState = RideConstructionState::Selected; + _rideConstructionState = RideConstructionState::selected; _currentTrackBegin = *newCoords; _currentTrackPieceDirection = direction; _currentTrackPieceType = type; @@ -1298,7 +1298,7 @@ int32_t RideInitialiseConstructionWindow(Ride& ride) _previousTrackPitchEnd = TrackPitch::none; _currentTrackPieceDirection = 0; - _rideConstructionState = RideConstructionState::Place; + _rideConstructionState = RideConstructionState::place; _currentTrackSelectionFlags.clearAll(); WindowRideConstructionUpdateActiveElements(); @@ -1642,7 +1642,7 @@ bool RideSelectBackwardsFromFront() TrackBeginEnd trackBeginEnd; if (trackBlockGetPreviousFromZero(_currentTrackBegin, *ride, _currentTrackPieceDirection, &trackBeginEnd)) { - _rideConstructionState = RideConstructionState::Selected; + _rideConstructionState = RideConstructionState::selected; _currentTrackBegin.x = trackBeginEnd.begin_x; _currentTrackBegin.y = trackBeginEnd.begin_y; _currentTrackBegin.z = trackBeginEnd.begin_z; @@ -1667,7 +1667,7 @@ bool RideSelectForwardsFromBack() CoordsXYE next_track; if (trackBlockGetNextFromZero(_currentTrackBegin, *ride, direction, &next_track, &z, &direction, false)) { - _rideConstructionState = RideConstructionState::Selected; + _rideConstructionState = RideConstructionState::selected; _currentTrackBegin.x = next_track.x; _currentTrackBegin.y = next_track.y; _currentTrackBegin.z = z; diff --git a/src/openrct2/ride/RideConstruction.h b/src/openrct2/ride/RideConstruction.h index bbbafc300d..64aaceab2c 100644 --- a/src/openrct2/ride/RideConstruction.h +++ b/src/openrct2/ride/RideConstruction.h @@ -71,15 +71,15 @@ namespace OpenRCT2 { enum class RideConstructionState : uint8_t { - State0, - Front, - Back, - Selected, - Place, - EntranceExit, - MazeBuild, - MazeMove, - MazeFill + state0, + front, + back, + selected, + place, + entranceExit, + mazeBuild, + mazeMove, + mazeFill }; enum class AlternativeTrackFlag : uint8_t diff --git a/src/openrct2/ride/TrackIteration.cpp b/src/openrct2/ride/TrackIteration.cpp index f6c43b2cb4..b1730d0509 100644 --- a/src/openrct2/ride/TrackIteration.cpp +++ b/src/openrct2/ride/TrackIteration.cpp @@ -457,7 +457,7 @@ namespace OpenRCT2 auto* windowMgr = Ui::GetWindowManager(); const WindowBase* w = windowMgr->FindByClass(WindowClass::rideConstruction); - if (w != nullptr && _rideConstructionState != RideConstructionState::State0 && _currentRideIndex == ride.id) + if (w != nullptr && _rideConstructionState != RideConstructionState::state0 && _currentRideIndex == ride.id) { RideConstructionInvalidateCurrentTrack(); }