mirror of https://github.com/OpenRCT2/OpenRCT2.git
Make RideConstructionState a strong enum
This commit is contained in:
parent
385c9ee5ff
commit
e547dd96db
|
@ -187,11 +187,11 @@ static void window_maze_construction_entrance_mouseup(rct_window* w, rct_widgeti
|
|||
|
||||
ride_construction_invalidate_current_track();
|
||||
|
||||
if (_rideConstructionState != RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT)
|
||||
if (_rideConstructionState != RideConstructionState::EntranceExit)
|
||||
{
|
||||
gRideEntranceExitPlacePreviousRideConstructionState = _rideConstructionState;
|
||||
}
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT;
|
||||
_rideConstructionState = RideConstructionState::EntranceExit;
|
||||
|
||||
window_maze_construction_update_pressed_widgets();
|
||||
}
|
||||
|
@ -227,14 +227,14 @@ static void window_maze_construction_mouseup(rct_window* w, rct_widgetindex widg
|
|||
static void window_maze_construction_resize(rct_window* w)
|
||||
{
|
||||
uint64_t disabledWidgets = 0;
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_PLACE)
|
||||
if (_rideConstructionState == RideConstructionState::Place)
|
||||
{
|
||||
disabledWidgets
|
||||
|= ((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 == RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT)
|
||||
else if (_rideConstructionState == RideConstructionState::EntranceExit)
|
||||
{
|
||||
disabledWidgets = (1ULL << WIDX_MAZE_DIRECTION_NW) | (1ULL << WIDX_MAZE_DIRECTION_NE) | (1ULL << WIDX_MAZE_DIRECTION_SW)
|
||||
| (1ULL << WIDX_MAZE_DIRECTION_SE);
|
||||
|
@ -255,9 +255,9 @@ static void window_maze_construction_resize(rct_window* w)
|
|||
w->disabled_widgets = disabledWidgets;
|
||||
}
|
||||
|
||||
static void window_maze_construction_build_mode_mousedown(uint8_t rideConstructionState)
|
||||
static void window_maze_construction_build_mode_mousedown(RideConstructionState rideConstructionState)
|
||||
{
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT)
|
||||
if (_rideConstructionState == RideConstructionState::EntranceExit)
|
||||
{
|
||||
tool_cancel();
|
||||
}
|
||||
|
@ -274,13 +274,13 @@ static void window_maze_construction_mousedown(rct_window* w, rct_widgetindex wi
|
|||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_MAZE_BUILD_MODE:
|
||||
window_maze_construction_build_mode_mousedown(RIDE_CONSTRUCTION_STATE_MAZE_BUILD);
|
||||
window_maze_construction_build_mode_mousedown(RideConstructionState::Build);
|
||||
break;
|
||||
case WIDX_MAZE_MOVE_MODE:
|
||||
window_maze_construction_build_mode_mousedown(RIDE_CONSTRUCTION_STATE_MAZE_MOVE);
|
||||
window_maze_construction_build_mode_mousedown(RideConstructionState::MazeMove);
|
||||
break;
|
||||
case WIDX_MAZE_FILL_MODE:
|
||||
window_maze_construction_build_mode_mousedown(RIDE_CONSTRUCTION_STATE_MAZE_FILL);
|
||||
window_maze_construction_build_mode_mousedown(RideConstructionState::MazeFill);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -300,32 +300,36 @@ static void window_maze_construction_update(rct_window* w)
|
|||
|
||||
switch (_rideConstructionState)
|
||||
{
|
||||
case RIDE_CONSTRUCTION_STATE_PLACE:
|
||||
case RideConstructionState::Place:
|
||||
if (!WidgetIsActiveTool(w, WIDX_MAZE_DIRECTION_GROUPBOX))
|
||||
{
|
||||
window_close(w);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT:
|
||||
case RideConstructionState::EntranceExit:
|
||||
if (!WidgetIsActiveTool(w, WIDX_MAZE_ENTRANCE) && !WidgetIsActiveTool(w, WIDX_MAZE_EXIT))
|
||||
{
|
||||
_rideConstructionState = gRideEntranceExitPlacePreviousRideConstructionState;
|
||||
window_maze_construction_update_pressed_widgets();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (_rideConstructionState)
|
||||
{
|
||||
case RIDE_CONSTRUCTION_STATE_FRONT:
|
||||
case RIDE_CONSTRUCTION_STATE_BACK:
|
||||
case RIDE_CONSTRUCTION_STATE_SELECTED:
|
||||
case RideConstructionState::Front:
|
||||
case RideConstructionState::Back:
|
||||
case RideConstructionState::Selected:
|
||||
if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WC_RIDE_CONSTRUCTION)
|
||||
{
|
||||
tool_cancel();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
sub_6C94D8();
|
||||
}
|
||||
|
@ -470,7 +474,7 @@ void window_maze_construction_update_pressed_widgets()
|
|||
|
||||
switch (_rideConstructionState)
|
||||
{
|
||||
case RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT:
|
||||
case RideConstructionState::EntranceExit:
|
||||
if (gCurrentToolWidget.widget_index == WIDX_MAZE_ENTRANCE)
|
||||
{
|
||||
pressedWidgets |= EnumToFlag(WIDX_MAZE_ENTRANCE);
|
||||
|
@ -480,15 +484,17 @@ void window_maze_construction_update_pressed_widgets()
|
|||
pressedWidgets |= EnumToFlag(WIDX_MAZE_EXIT);
|
||||
}
|
||||
break;
|
||||
case RIDE_CONSTRUCTION_STATE_MAZE_BUILD:
|
||||
case RideConstructionState::Build:
|
||||
pressedWidgets |= EnumToFlag(WIDX_MAZE_BUILD_MODE);
|
||||
break;
|
||||
case RIDE_CONSTRUCTION_STATE_MAZE_MOVE:
|
||||
case RideConstructionState::MazeMove:
|
||||
pressedWidgets |= EnumToFlag(WIDX_MAZE_MOVE_MODE);
|
||||
break;
|
||||
case RIDE_CONSTRUCTION_STATE_MAZE_FILL:
|
||||
case RideConstructionState::MazeFill:
|
||||
pressedWidgets |= EnumToFlag(WIDX_MAZE_FILL_MODE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
w->pressed_widgets = pressedWidgets;
|
||||
|
@ -513,16 +519,16 @@ static void window_maze_construction_construct(int32_t direction)
|
|||
z = _currentTrackBegin.z;
|
||||
switch (_rideConstructionState)
|
||||
{
|
||||
case RIDE_CONSTRUCTION_STATE_MAZE_BUILD:
|
||||
case RideConstructionState::Build:
|
||||
mode = GC_SET_MAZE_TRACK_BUILD;
|
||||
flags = GAME_COMMAND_FLAG_APPLY;
|
||||
break;
|
||||
case RIDE_CONSTRUCTION_STATE_MAZE_MOVE:
|
||||
case RideConstructionState::MazeMove:
|
||||
mode = GC_SET_MAZE_TRACK_MOVE;
|
||||
flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED;
|
||||
break;
|
||||
default:
|
||||
case RIDE_CONSTRUCTION_STATE_MAZE_FILL:
|
||||
case RideConstructionState::MazeFill:
|
||||
mode = GC_SET_MAZE_TRACK_FILL;
|
||||
flags = GAME_COMMAND_FLAG_APPLY;
|
||||
break;
|
||||
|
@ -536,7 +542,7 @@ static void window_maze_construction_construct(int32_t direction)
|
|||
|
||||
_currentTrackBegin.x = x;
|
||||
_currentTrackBegin.y = y;
|
||||
if (_rideConstructionState != RIDE_CONSTRUCTION_STATE_MAZE_MOVE)
|
||||
if (_rideConstructionState != RideConstructionState::MazeMove)
|
||||
{
|
||||
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, { x, y, z });
|
||||
}
|
||||
|
|
|
@ -563,7 +563,7 @@ rct_window* window_ride_construction_open()
|
|||
_previousTrackSlopeEnd = 0;
|
||||
|
||||
_currentTrackPieceDirection = 0;
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_PLACE;
|
||||
_rideConstructionState = RideConstructionState::Place;
|
||||
_currentTrackSelectionFlags = 0;
|
||||
_autoOpeningShop = false;
|
||||
_autoRotatingShop = true;
|
||||
|
@ -686,7 +686,7 @@ static void window_ride_construction_resize(rct_window* w)
|
|||
{
|
||||
window_ride_construction_update_enabled_track_pieces();
|
||||
w->enabled_widgets &= ~(1ULL << WIDX_CONSTRUCT);
|
||||
if (_rideConstructionState != RIDE_CONSTRUCTION_STATE_PLACE)
|
||||
if (_rideConstructionState != RideConstructionState::Place)
|
||||
{
|
||||
w->enabled_widgets |= (1ULL << WIDX_CONSTRUCT);
|
||||
}
|
||||
|
@ -767,7 +767,7 @@ static void window_ride_construction_resize(rct_window* w)
|
|||
| (1ULL << WIDX_LEVEL) | (1ULL << WIDX_SLOPE_UP) | (1ULL << WIDX_SLOPE_UP_STEEP);
|
||||
}
|
||||
}
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_0)
|
||||
if (_rideConstructionState == RideConstructionState::State0)
|
||||
{
|
||||
disabledWidgets |= (1ULL << WIDX_CONSTRUCT) | (1ULL << WIDX_DEMOLISH) | (1ULL << WIDX_PREVIOUS_SECTION)
|
||||
| (1ULL << WIDX_NEXT_SECTION);
|
||||
|
@ -1001,7 +1001,7 @@ static void window_ride_construction_resize(rct_window* w)
|
|||
{
|
||||
disabledWidgets |= (1ULL << WIDX_SLOPE_UP_STEEP);
|
||||
if (_currentTrackCurve == TRACK_CURVE_LEFT || _currentTrackCurve == TRACK_CURVE_RIGHT
|
||||
|| _rideConstructionState != RIDE_CONSTRUCTION_STATE_BACK || !is_track_enabled(TRACK_SLOPE_CURVE_BANKED))
|
||||
|| _rideConstructionState != RideConstructionState::Back || !is_track_enabled(TRACK_SLOPE_CURVE_BANKED))
|
||||
{
|
||||
disabledWidgets |= (1ULL << WIDX_LEVEL);
|
||||
}
|
||||
|
@ -1010,7 +1010,7 @@ static void window_ride_construction_resize(rct_window* w)
|
|||
{
|
||||
disabledWidgets |= (1ULL << WIDX_SLOPE_DOWN_STEEP);
|
||||
if (_currentTrackCurve == TRACK_CURVE_LEFT || _currentTrackCurve == TRACK_CURVE_RIGHT
|
||||
|| _rideConstructionState != RIDE_CONSTRUCTION_STATE_FRONT || !is_track_enabled(TRACK_SLOPE_CURVE_BANKED))
|
||||
|| _rideConstructionState != RideConstructionState::Front || !is_track_enabled(TRACK_SLOPE_CURVE_BANKED))
|
||||
{
|
||||
disabledWidgets |= (1ULL << WIDX_LEVEL);
|
||||
}
|
||||
|
@ -1147,7 +1147,7 @@ static void window_ride_construction_resize(rct_window* w)
|
|||
}
|
||||
if (is_track_enabled(TRACK_SLOPE_CURVE_BANKED))
|
||||
{
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_FRONT)
|
||||
if (_rideConstructionState == RideConstructionState::Front)
|
||||
{
|
||||
if (_currentTrackCurve == TRACK_CURVE_LEFT_SMALL || _currentTrackCurve == TRACK_CURVE_RIGHT_SMALL)
|
||||
{
|
||||
|
@ -1157,7 +1157,7 @@ static void window_ride_construction_resize(rct_window* w)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_BACK)
|
||||
else if (_rideConstructionState == RideConstructionState::Back)
|
||||
{
|
||||
if (_currentTrackCurve == TRACK_CURVE_LEFT_SMALL || _currentTrackCurve == TRACK_CURVE_RIGHT_SMALL)
|
||||
{
|
||||
|
@ -1173,7 +1173,7 @@ static void window_ride_construction_resize(rct_window* w)
|
|||
disabledWidgets |= (1ULL << WIDX_LEFT_CURVE_VERY_SMALL) | (1ULL << WIDX_LEFT_CURVE_SMALL) | (1ULL << WIDX_LEFT_CURVE)
|
||||
| (1ULL << WIDX_RIGHT_CURVE) | (1ULL << WIDX_RIGHT_CURVE_SMALL) | (1ULL << WIDX_RIGHT_CURVE_VERY_SMALL);
|
||||
}
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_FRONT)
|
||||
if (_rideConstructionState == RideConstructionState::Front)
|
||||
{
|
||||
disabledWidgets |= (1ULL << WIDX_NEXT_SECTION);
|
||||
if (window_ride_construction_update_state(nullptr, nullptr, nullptr, nullptr, nullptr, nullptr))
|
||||
|
@ -1181,7 +1181,7 @@ static void window_ride_construction_resize(rct_window* w)
|
|||
disabledWidgets |= (1ULL << WIDX_CONSTRUCT);
|
||||
}
|
||||
}
|
||||
else if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_BACK)
|
||||
else if (_rideConstructionState == RideConstructionState::Back)
|
||||
{
|
||||
disabledWidgets |= (1ULL << WIDX_PREVIOUS_SECTION);
|
||||
if (window_ride_construction_update_state(nullptr, nullptr, nullptr, nullptr, nullptr, nullptr))
|
||||
|
@ -1193,8 +1193,8 @@ static void window_ride_construction_resize(rct_window* w)
|
|||
{
|
||||
disabledWidgets &= ~(1ULL << WIDX_BANKING_GROUPBOX);
|
||||
}
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT
|
||||
|| _rideConstructionState == RIDE_CONSTRUCTION_STATE_SELECTED)
|
||||
if (_rideConstructionState == RideConstructionState::EntranceExit
|
||||
|| _rideConstructionState == RideConstructionState::Selected)
|
||||
{
|
||||
disabledWidgets |= (1ULL << WIDX_DIRECTION_GROUPBOX) | (1ULL << WIDX_SLOPE_GROUPBOX) | (1ULL << WIDX_BANKING_GROUPBOX)
|
||||
| (1ULL << WIDX_LEFT_CURVE_VERY_SMALL) | (1ULL << WIDX_LEFT_CURVE_SMALL) | (1ULL << WIDX_LEFT_CURVE)
|
||||
|
@ -1383,7 +1383,7 @@ static void window_ride_construction_mousedown(rct_window* w, rct_widgetindex wi
|
|||
break;
|
||||
case WIDX_SLOPE_DOWN:
|
||||
ride_construction_invalidate_current_track();
|
||||
if (_rideConstructionState == 2 && _currentTrackBankEnd != TRACK_BANK_NONE)
|
||||
if (_rideConstructionState == RideConstructionState::Back && _currentTrackBankEnd != TRACK_BANK_NONE)
|
||||
{
|
||||
_currentTrackBankEnd = TRACK_BANK_NONE;
|
||||
}
|
||||
|
@ -1391,7 +1391,7 @@ static void window_ride_construction_mousedown(rct_window* w, rct_widgetindex wi
|
|||
break;
|
||||
case WIDX_LEVEL:
|
||||
ride_construction_invalidate_current_track();
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_FRONT && _previousTrackSlopeEnd == 6)
|
||||
if (_rideConstructionState == RideConstructionState::Front && _previousTrackSlopeEnd == 6)
|
||||
{
|
||||
if (_currentTrackCurve == TRACK_CURVE_LEFT_SMALL)
|
||||
{
|
||||
|
@ -1402,7 +1402,7 @@ static void window_ride_construction_mousedown(rct_window* w, rct_widgetindex wi
|
|||
_currentTrackBankEnd = TRACK_BANK_RIGHT;
|
||||
}
|
||||
}
|
||||
else if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_BACK && _previousTrackSlopeEnd == 2)
|
||||
else if (_rideConstructionState == RideConstructionState::Back && _previousTrackSlopeEnd == 2)
|
||||
{
|
||||
if (_currentTrackCurve == TRACK_CURVE_LEFT_SMALL)
|
||||
{
|
||||
|
@ -1417,13 +1417,13 @@ static void window_ride_construction_mousedown(rct_window* w, rct_widgetindex wi
|
|||
break;
|
||||
case WIDX_SLOPE_UP:
|
||||
ride_construction_invalidate_current_track();
|
||||
if (_rideConstructionState == 1 && _currentTrackBankEnd != TRACK_BANK_NONE)
|
||||
if (_rideConstructionState == RideConstructionState::Front && _currentTrackBankEnd != TRACK_BANK_NONE)
|
||||
{
|
||||
_currentTrackBankEnd = TRACK_BANK_NONE;
|
||||
}
|
||||
if (ride->GetRideTypeDescriptor().SupportsTrackPiece(TRACK_REVERSE_FREEFALL))
|
||||
{
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_FRONT && _currentTrackCurve == TRACK_CURVE_NONE)
|
||||
if (_rideConstructionState == RideConstructionState::Front && _currentTrackCurve == TRACK_CURVE_NONE)
|
||||
{
|
||||
_currentTrackCurve = TrackElemType::ReverseFreefallSlope | RideConstructionSpecialPieceSelected;
|
||||
window_ride_construction_update_active_elements();
|
||||
|
@ -1547,7 +1547,7 @@ static void window_ride_construction_mousedown(rct_window* w, rct_widgetindex wi
|
|||
uint8_t brakesSpeed = *brakesSpeedPtr + 2;
|
||||
if (brakesSpeed <= maxBrakesSpeed)
|
||||
{
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_SELECTED)
|
||||
if (_rideConstructionState == RideConstructionState::Selected)
|
||||
{
|
||||
ride_construction_set_brakes_speed(brakesSpeed);
|
||||
}
|
||||
|
@ -1573,7 +1573,7 @@ static void window_ride_construction_mousedown(rct_window* w, rct_widgetindex wi
|
|||
uint8_t brakesSpeed = *brakesSpeedPtr - 2;
|
||||
if (brakesSpeed >= 2)
|
||||
{
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_SELECTED)
|
||||
if (_rideConstructionState == RideConstructionState::Selected)
|
||||
{
|
||||
ride_construction_set_brakes_speed(brakesSpeed);
|
||||
}
|
||||
|
@ -1604,7 +1604,7 @@ static void window_ride_construction_mousedown(rct_window* w, rct_widgetindex wi
|
|||
case WIDX_SEAT_ROTATION_ANGLE_SPINNER_UP:
|
||||
if (_currentSeatRotationAngle < 15)
|
||||
{
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_SELECTED)
|
||||
if (_rideConstructionState == RideConstructionState::Selected)
|
||||
{
|
||||
ride_selected_track_set_seat_rotation(_currentSeatRotationAngle + 1);
|
||||
}
|
||||
|
@ -1618,7 +1618,7 @@ static void window_ride_construction_mousedown(rct_window* w, rct_widgetindex wi
|
|||
case WIDX_SEAT_ROTATION_ANGLE_SPINNER_DOWN:
|
||||
if (_currentSeatRotationAngle > 0)
|
||||
{
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_SELECTED)
|
||||
if (_rideConstructionState == RideConstructionState::Selected)
|
||||
{
|
||||
ride_selected_track_set_seat_rotation(_currentSeatRotationAngle - 1);
|
||||
}
|
||||
|
@ -1668,7 +1668,7 @@ static void CloseConstructWindowOnCompletion(Ride* ride);
|
|||
|
||||
static void CloseConstructWindowOnCompletion(Ride* ride)
|
||||
{
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_0)
|
||||
if (_rideConstructionState == RideConstructionState::State0)
|
||||
{
|
||||
auto w = window_find_by_class(WC_RIDE_CONSTRUCTION);
|
||||
if (w != nullptr)
|
||||
|
@ -1711,14 +1711,14 @@ static void RideConstructPlacedForwardGameActionCallback(const GameAction* ga, c
|
|||
_currentTrackPieceDirection = next_track.element->GetDirection();
|
||||
_currentTrackPieceType = next_track.element->AsTrack()->GetTrackType();
|
||||
_currentTrackSelectionFlags = 0;
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_SELECTED;
|
||||
_rideConstructionState = RideConstructionState::Selected;
|
||||
_rideConstructionNextArrowPulse = 0;
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
|
||||
ride_select_next_section();
|
||||
}
|
||||
else
|
||||
{
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_0;
|
||||
_rideConstructionState = RideConstructionState::State0;
|
||||
}
|
||||
|
||||
window_ride_construction_do_station_check();
|
||||
|
@ -1756,14 +1756,14 @@ static void RideConstructPlacedBackwardGameActionCallback(const GameAction* ga,
|
|||
_currentTrackPieceDirection = trackBeginEnd.begin_direction;
|
||||
_currentTrackPieceType = trackBeginEnd.begin_element->AsTrack()->GetTrackType();
|
||||
_currentTrackSelectionFlags = 0;
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_SELECTED;
|
||||
_rideConstructionState = RideConstructionState::Selected;
|
||||
_rideConstructionNextArrowPulse = 0;
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
|
||||
ride_select_previous_section();
|
||||
}
|
||||
else
|
||||
{
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_0;
|
||||
_rideConstructionState = RideConstructionState::State0;
|
||||
}
|
||||
|
||||
window_ride_construction_do_station_check();
|
||||
|
@ -1796,11 +1796,11 @@ static void window_ride_construction_construct(rct_window* w)
|
|||
auto trackPlaceAction = TrackPlaceAction(
|
||||
rideIndex, trackType, { trackPos, static_cast<uint8_t>(trackDirection) }, (properties)&0xFF, (properties >> 8) & 0x0F,
|
||||
(properties >> 12) & 0x0F, liftHillAndAlternativeState, false);
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_BACK)
|
||||
if (_rideConstructionState == RideConstructionState::Back)
|
||||
{
|
||||
trackPlaceAction.SetCallback(RideConstructPlacedBackwardGameActionCallback);
|
||||
}
|
||||
else if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_FRONT)
|
||||
else if (_rideConstructionState == RideConstructionState::Front)
|
||||
{
|
||||
trackPlaceAction.SetCallback(RideConstructPlacedForwardGameActionCallback);
|
||||
}
|
||||
|
@ -1863,24 +1863,24 @@ static void window_ride_construction_mouseup_demolish(rct_window* w)
|
|||
ride_construction_invalidate_current_track();
|
||||
|
||||
// Select the track element that is to be deleted
|
||||
_rideConstructionState2 = RIDE_CONSTRUCTION_STATE_SELECTED;
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_FRONT)
|
||||
_rideConstructionState2 = RideConstructionState::Selected;
|
||||
if (_rideConstructionState == RideConstructionState::Front)
|
||||
{
|
||||
if (!ride_select_backwards_from_front())
|
||||
{
|
||||
window_ride_construction_update_active_elements();
|
||||
return;
|
||||
}
|
||||
_rideConstructionState2 = RIDE_CONSTRUCTION_STATE_FRONT;
|
||||
_rideConstructionState2 = RideConstructionState::Front;
|
||||
}
|
||||
else if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_BACK)
|
||||
else if (_rideConstructionState == RideConstructionState::Back)
|
||||
{
|
||||
if (!ride_select_forwards_from_back())
|
||||
{
|
||||
window_ride_construction_update_active_elements();
|
||||
return;
|
||||
}
|
||||
_rideConstructionState2 = RIDE_CONSTRUCTION_STATE_BACK;
|
||||
_rideConstructionState2 = RideConstructionState::Back;
|
||||
}
|
||||
|
||||
// Invalidate the selected track element or make sure it's at origin???
|
||||
|
@ -1986,10 +1986,10 @@ static void window_ride_construction_entrance_click(rct_window* w)
|
|||
gRideEntranceExitPlaceStationIndex = 0;
|
||||
input_set_flag(INPUT_FLAG_6, true);
|
||||
ride_construction_invalidate_current_track();
|
||||
if (_rideConstructionState != RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT)
|
||||
if (_rideConstructionState != RideConstructionState::EntranceExit)
|
||||
{
|
||||
gRideEntranceExitPlacePreviousRideConstructionState = _rideConstructionState;
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT;
|
||||
_rideConstructionState = RideConstructionState::EntranceExit;
|
||||
}
|
||||
window_ride_construction_update_active_elements();
|
||||
}
|
||||
|
@ -2016,10 +2016,10 @@ static void window_ride_construction_exit_click(rct_window* w)
|
|||
gRideEntranceExitPlaceStationIndex = 0;
|
||||
input_set_flag(INPUT_FLAG_6, true);
|
||||
ride_construction_invalidate_current_track();
|
||||
if (_rideConstructionState != RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT)
|
||||
if (_rideConstructionState != RideConstructionState::EntranceExit)
|
||||
{
|
||||
gRideEntranceExitPlacePreviousRideConstructionState = _rideConstructionState;
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT;
|
||||
_rideConstructionState = RideConstructionState::EntranceExit;
|
||||
}
|
||||
window_ride_construction_update_active_elements();
|
||||
}
|
||||
|
@ -2053,7 +2053,7 @@ static void window_ride_construction_update(rct_window* w)
|
|||
break;
|
||||
}
|
||||
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_PLACE)
|
||||
if (_rideConstructionState == RideConstructionState::Place)
|
||||
{
|
||||
if (!WidgetIsActiveTool(w, WIDX_CONSTRUCT))
|
||||
{
|
||||
|
@ -2062,7 +2062,7 @@ static void window_ride_construction_update(rct_window* w)
|
|||
}
|
||||
}
|
||||
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT)
|
||||
if (_rideConstructionState == RideConstructionState::EntranceExit)
|
||||
{
|
||||
if (!WidgetIsActiveTool(w, WIDX_ENTRANCE) && !WidgetIsActiveTool(w, WIDX_EXIT))
|
||||
{
|
||||
|
@ -2073,14 +2073,16 @@ static void window_ride_construction_update(rct_window* w)
|
|||
|
||||
switch (_rideConstructionState)
|
||||
{
|
||||
case RIDE_CONSTRUCTION_STATE_FRONT:
|
||||
case RIDE_CONSTRUCTION_STATE_BACK:
|
||||
case RIDE_CONSTRUCTION_STATE_SELECTED:
|
||||
case RideConstructionState::Front:
|
||||
case RideConstructionState::Back:
|
||||
case RideConstructionState::Selected:
|
||||
if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WC_RIDE_CONSTRUCTION)
|
||||
{
|
||||
tool_cancel();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
sub_6C94D8();
|
||||
|
@ -2323,7 +2325,7 @@ static void window_ride_construction_paint(rct_window* w, rct_drawpixelinfo* dpi
|
|||
|
||||
// Draw cost
|
||||
screenCoords = { w->windowPos.x + widget->midX(), w->windowPos.y + widget->bottom - 23 };
|
||||
if (_rideConstructionState != RIDE_CONSTRUCTION_STATE_PLACE)
|
||||
if (_rideConstructionState != RideConstructionState::Place)
|
||||
DrawTextBasic(dpi, screenCoords, STR_BUILD_THIS, {}, { TextAlignment::CENTRE });
|
||||
|
||||
screenCoords.y += 11;
|
||||
|
@ -2488,7 +2490,7 @@ void window_ride_construction_update_active_elements_impl()
|
|||
window_ride_construction_update_map_selection();
|
||||
|
||||
_selectedTrackType = TrackElemType::None;
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_SELECTED)
|
||||
if (_rideConstructionState == RideConstructionState::Selected)
|
||||
{
|
||||
if (sub_6C683D(
|
||||
{ _currentTrackBegin, static_cast<Direction>(_currentTrackPieceDirection & 3) }, _currentTrackPieceType, 0,
|
||||
|
@ -2549,8 +2551,8 @@ void sub_6C94D8()
|
|||
|
||||
switch (_rideConstructionState)
|
||||
{
|
||||
case RIDE_CONSTRUCTION_STATE_FRONT:
|
||||
case RIDE_CONSTRUCTION_STATE_BACK:
|
||||
case RideConstructionState::Front:
|
||||
case RideConstructionState::Back:
|
||||
{
|
||||
if (!(_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_TRACK))
|
||||
{
|
||||
|
@ -2578,7 +2580,7 @@ void sub_6C94D8()
|
|||
type = _currentTrackPieceType;
|
||||
if (direction >= 4)
|
||||
direction += 4;
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_BACK)
|
||||
if (_rideConstructionState == RideConstructionState::Back)
|
||||
direction = direction_reverse(direction);
|
||||
gMapSelectArrowPosition = trackPos;
|
||||
gMapSelectArrowDirection = direction;
|
||||
|
@ -2588,7 +2590,7 @@ void sub_6C94D8()
|
|||
map_invalidate_tile_full(trackPos);
|
||||
break;
|
||||
}
|
||||
case RIDE_CONSTRUCTION_STATE_SELECTED:
|
||||
case RideConstructionState::Selected:
|
||||
{
|
||||
auto curTime = platform_get_ticks();
|
||||
if (_rideConstructionNextArrowPulse >= curTime)
|
||||
|
@ -2604,13 +2606,13 @@ void sub_6C94D8()
|
|||
if (newCoords == std::nullopt)
|
||||
{
|
||||
ride_construction_remove_ghosts();
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_0;
|
||||
_rideConstructionState = RideConstructionState::State0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RIDE_CONSTRUCTION_STATE_MAZE_BUILD:
|
||||
case RIDE_CONSTRUCTION_STATE_MAZE_MOVE:
|
||||
case RIDE_CONSTRUCTION_STATE_MAZE_FILL:
|
||||
case RideConstructionState::Build:
|
||||
case RideConstructionState::MazeMove:
|
||||
case RideConstructionState::MazeFill:
|
||||
{
|
||||
auto curTime = platform_get_ticks();
|
||||
if (_rideConstructionNextArrowPulse >= curTime)
|
||||
|
@ -2637,6 +2639,8 @@ void sub_6C94D8()
|
|||
map_invalidate_tile_full(trackPos);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2655,17 +2659,17 @@ static void window_ride_construction_update_map_selection()
|
|||
|
||||
switch (_rideConstructionState)
|
||||
{
|
||||
case RIDE_CONSTRUCTION_STATE_0:
|
||||
case RideConstructionState::State0:
|
||||
trackDirection = _currentTrackPieceDirection;
|
||||
trackType = 0;
|
||||
trackPos = _currentTrackBegin;
|
||||
break;
|
||||
case RIDE_CONSTRUCTION_STATE_SELECTED:
|
||||
case RideConstructionState::Selected:
|
||||
trackDirection = _currentTrackPieceDirection;
|
||||
trackType = _currentTrackPieceType;
|
||||
trackPos = _currentTrackBegin;
|
||||
break;
|
||||
case RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT:
|
||||
case RideConstructionState::EntranceExit:
|
||||
gMapSelectionTiles.clear();
|
||||
return;
|
||||
default:
|
||||
|
@ -2715,12 +2719,12 @@ static void window_ride_construction_update_possible_ride_configurations()
|
|||
}
|
||||
|
||||
int32_t slope, bank;
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_FRONT || _rideConstructionState == RIDE_CONSTRUCTION_STATE_PLACE)
|
||||
if (_rideConstructionState == RideConstructionState::Front || _rideConstructionState == RideConstructionState::Place)
|
||||
{
|
||||
slope = TrackDefinitions[trackType].vangle_start;
|
||||
bank = TrackDefinitions[trackType].bank_start;
|
||||
}
|
||||
else if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_BACK)
|
||||
else if (_rideConstructionState == RideConstructionState::Back)
|
||||
{
|
||||
slope = TrackDefinitions[trackType].vangle_end;
|
||||
bank = TrackDefinitions[trackType].bank_end;
|
||||
|
@ -3166,22 +3170,22 @@ static void window_ride_construction_update_widgets(rct_window* w)
|
|||
|
||||
switch (_rideConstructionState)
|
||||
{
|
||||
case RIDE_CONSTRUCTION_STATE_FRONT:
|
||||
case RideConstructionState::Front:
|
||||
window_ride_construction_widgets[WIDX_CONSTRUCT].type = WindowWidgetType::ImgBtn;
|
||||
window_ride_construction_widgets[WIDX_NEXT_SECTION].type = WindowWidgetType::Empty;
|
||||
break;
|
||||
case RIDE_CONSTRUCTION_STATE_BACK:
|
||||
case RideConstructionState::Back:
|
||||
window_ride_construction_widgets[WIDX_CONSTRUCT].type = WindowWidgetType::ImgBtn;
|
||||
window_ride_construction_widgets[WIDX_PREVIOUS_SECTION].type = WindowWidgetType::Empty;
|
||||
break;
|
||||
case RIDE_CONSTRUCTION_STATE_PLACE:
|
||||
case RideConstructionState::Place:
|
||||
window_ride_construction_widgets[WIDX_CONSTRUCT].type = WindowWidgetType::ImgBtn;
|
||||
window_ride_construction_widgets[WIDX_DEMOLISH].type = WindowWidgetType::Empty;
|
||||
window_ride_construction_widgets[WIDX_NEXT_SECTION].type = WindowWidgetType::Empty;
|
||||
window_ride_construction_widgets[WIDX_PREVIOUS_SECTION].type = WindowWidgetType::Empty;
|
||||
window_ride_construction_widgets[WIDX_ROTATE].type = WindowWidgetType::FlatBtn;
|
||||
break;
|
||||
case RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT:
|
||||
case RideConstructionState::EntranceExit:
|
||||
window_ride_construction_widgets[WIDX_DEMOLISH].type = WindowWidgetType::Empty;
|
||||
window_ride_construction_widgets[WIDX_NEXT_SECTION].type = WindowWidgetType::Empty;
|
||||
window_ride_construction_widgets[WIDX_PREVIOUS_SECTION].type = WindowWidgetType::Empty;
|
||||
|
@ -3368,7 +3372,7 @@ static void loc_6C7502(int32_t al)
|
|||
{
|
||||
_currentTrackSlopeEnd = al;
|
||||
_currentTrackPrice = MONEY32_UNDEFINED;
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_FRONT)
|
||||
if (_rideConstructionState == RideConstructionState::Front)
|
||||
{
|
||||
if (al != 2 && al != 4 && al != 0)
|
||||
{
|
||||
|
@ -3542,7 +3546,7 @@ void ride_construction_toolupdate_construct(const ScreenCoordsXY& screenCoords)
|
|||
_currentTrackBegin.z += 16;
|
||||
}
|
||||
|
||||
if (_autoRotatingShop && _rideConstructionState == RIDE_CONSTRUCTION_STATE_PLACE
|
||||
if (_autoRotatingShop && _rideConstructionState == RideConstructionState::Place
|
||||
&& ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_IS_SHOP))
|
||||
{
|
||||
TileElement* pathsByDir[NumOrthogonalDirections];
|
||||
|
@ -3731,7 +3735,7 @@ void ride_construction_tooldown_construct(const ScreenCoordsXY& screenCoords)
|
|||
{
|
||||
for (int32_t zAttempts = 0; zAttempts < numAttempts; ++zAttempts)
|
||||
{
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_MAZE_BUILD;
|
||||
_rideConstructionState = RideConstructionState::Build;
|
||||
_currentTrackBegin.x = mapCoords.x;
|
||||
_currentTrackBegin.y = mapCoords.y;
|
||||
_currentTrackBegin.z = z;
|
||||
|
@ -3752,7 +3756,7 @@ void ride_construction_tooldown_construct(const ScreenCoordsXY& screenCoords)
|
|||
|
||||
if (_trackPlaceCost == MONEY32_UNDEFINED)
|
||||
{
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_PLACE;
|
||||
_rideConstructionState = RideConstructionState::Place;
|
||||
rct_string_id errorText = gGameCommandErrorText;
|
||||
z -= 8;
|
||||
if (errorText == STR_NOT_ENOUGH_CASH_REQUIRES || errorText == STR_CAN_ONLY_BUILD_THIS_UNDERWATER
|
||||
|
@ -3787,7 +3791,7 @@ void ride_construction_tooldown_construct(const ScreenCoordsXY& screenCoords)
|
|||
|
||||
for (int32_t zAttempts = 0; zAttempts < numAttempts; ++zAttempts)
|
||||
{
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_FRONT;
|
||||
_rideConstructionState = RideConstructionState::Front;
|
||||
_currentTrackBegin.x = mapCoords.x;
|
||||
_currentTrackBegin.y = mapCoords.y;
|
||||
_currentTrackBegin.z = z;
|
||||
|
|
|
@ -32,6 +32,7 @@ struct scenario_index_entry;
|
|||
|
||||
enum class VisibilityCache : uint8_t;
|
||||
enum class CursorID : uint8_t;
|
||||
enum class RideConstructionState : uint8_t;
|
||||
|
||||
#define SCROLLABLE_ROW_HEIGHT 12
|
||||
#define LIST_ROW_HEIGHT 12
|
||||
|
@ -892,7 +893,7 @@ money32 place_provisional_track_piece(
|
|||
const CoordsXYZ& trackPos);
|
||||
|
||||
extern uint64_t _enabledRidePieces;
|
||||
extern uint8_t _rideConstructionState2;
|
||||
extern RideConstructionState _rideConstructionState2;
|
||||
extern bool _stationConstructed;
|
||||
extern bool _deferClose;
|
||||
|
||||
|
|
|
@ -715,7 +715,7 @@ int32_t ride_find_track_gap(const Ride* ride, CoordsXYE* input, CoordsXYE* outpu
|
|||
}
|
||||
|
||||
rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION);
|
||||
if (w != nullptr && _rideConstructionState != RIDE_CONSTRUCTION_STATE_0 && _currentRideIndex == ride->id)
|
||||
if (w != nullptr && _rideConstructionState != RideConstructionState::State0 && _currentRideIndex == ride->id)
|
||||
{
|
||||
ride_construction_invalidate_current_track();
|
||||
}
|
||||
|
@ -2581,7 +2581,7 @@ static int32_t ride_check_block_brakes(CoordsXYE* input, CoordsXYE* output)
|
|||
{
|
||||
ride_id_t rideIndex = input->element->AsTrack()->GetRideIndex();
|
||||
rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION);
|
||||
if (w != nullptr && _rideConstructionState != RIDE_CONSTRUCTION_STATE_0 && _currentRideIndex == rideIndex)
|
||||
if (w != nullptr && _rideConstructionState != RideConstructionState::State0 && _currentRideIndex == rideIndex)
|
||||
ride_construction_invalidate_current_track();
|
||||
|
||||
track_circuit_iterator it;
|
||||
|
@ -2645,7 +2645,7 @@ static bool ride_check_track_contains_inversions(CoordsXYE* input, CoordsXYE* ou
|
|||
return true;
|
||||
|
||||
rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION);
|
||||
if (w != nullptr && _rideConstructionState != RIDE_CONSTRUCTION_STATE_0 && rideIndex == _currentRideIndex)
|
||||
if (w != nullptr && _rideConstructionState != RideConstructionState::State0 && rideIndex == _currentRideIndex)
|
||||
{
|
||||
ride_construction_invalidate_current_track();
|
||||
}
|
||||
|
@ -2703,7 +2703,7 @@ static bool ride_check_track_contains_banked(CoordsXYE* input, CoordsXYE* output
|
|||
return true;
|
||||
|
||||
rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION);
|
||||
if (w != nullptr && _rideConstructionState != RIDE_CONSTRUCTION_STATE_0 && rideIndex == _currentRideIndex)
|
||||
if (w != nullptr && _rideConstructionState != RideConstructionState::State0 && rideIndex == _currentRideIndex)
|
||||
{
|
||||
ride_construction_invalidate_current_track();
|
||||
}
|
||||
|
@ -2743,7 +2743,7 @@ static bool ride_check_track_contains_banked(CoordsXYE* input, CoordsXYE* output
|
|||
static int32_t ride_check_station_length(CoordsXYE* input, CoordsXYE* output)
|
||||
{
|
||||
rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION);
|
||||
if (w != nullptr && _rideConstructionState != RIDE_CONSTRUCTION_STATE_0
|
||||
if (w != nullptr && _rideConstructionState != RideConstructionState::State0
|
||||
&& _currentRideIndex == input->element->AsTrack()->GetRideIndex())
|
||||
{
|
||||
ride_construction_invalidate_current_track();
|
||||
|
@ -2804,7 +2804,7 @@ static bool ride_check_start_and_end_is_station(CoordsXYE* input)
|
|||
return false;
|
||||
|
||||
auto w = window_find_by_class(WC_RIDE_CONSTRUCTION);
|
||||
if (w != nullptr && _rideConstructionState != RIDE_CONSTRUCTION_STATE_0 && rideIndex == _currentRideIndex)
|
||||
if (w != nullptr && _rideConstructionState != RideConstructionState::State0 && rideIndex == _currentRideIndex)
|
||||
{
|
||||
ride_construction_invalidate_current_track();
|
||||
}
|
||||
|
@ -4886,7 +4886,7 @@ static int32_t ride_get_track_length(Ride* ride)
|
|||
ride_id_t rideIndex = tileElement->AsTrack()->GetRideIndex();
|
||||
|
||||
rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION);
|
||||
if (w != nullptr && _rideConstructionState != RIDE_CONSTRUCTION_STATE_0 && _currentRideIndex == rideIndex)
|
||||
if (w != nullptr && _rideConstructionState != RideConstructionState::State0 && _currentRideIndex == rideIndex)
|
||||
{
|
||||
ride_construction_invalidate_current_track();
|
||||
}
|
||||
|
|
|
@ -881,17 +881,17 @@ enum
|
|||
RIDE_CRASH_TYPE_FATALITIES = 8
|
||||
};
|
||||
|
||||
enum
|
||||
enum class RideConstructionState : uint8_t
|
||||
{
|
||||
RIDE_CONSTRUCTION_STATE_0,
|
||||
RIDE_CONSTRUCTION_STATE_FRONT,
|
||||
RIDE_CONSTRUCTION_STATE_BACK,
|
||||
RIDE_CONSTRUCTION_STATE_SELECTED,
|
||||
RIDE_CONSTRUCTION_STATE_PLACE,
|
||||
RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT,
|
||||
RIDE_CONSTRUCTION_STATE_MAZE_BUILD,
|
||||
RIDE_CONSTRUCTION_STATE_MAZE_MOVE,
|
||||
RIDE_CONSTRUCTION_STATE_MAZE_FILL
|
||||
State0,
|
||||
Front,
|
||||
Back,
|
||||
Selected,
|
||||
Place,
|
||||
EntranceExit,
|
||||
Build,
|
||||
MazeMove,
|
||||
MazeFill
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -1086,7 +1086,7 @@ extern uint16_t _numCurrentPossibleRideConfigurations;
|
|||
extern uint16_t _numCurrentPossibleSpecialTrackPieces;
|
||||
|
||||
extern uint32_t _currentTrackCurve;
|
||||
extern uint8_t _rideConstructionState;
|
||||
extern RideConstructionState _rideConstructionState;
|
||||
extern ride_id_t _currentRideIndex;
|
||||
|
||||
extern CoordsXYZ _currentTrackBegin;
|
||||
|
@ -1114,7 +1114,7 @@ extern CoordsXYZD _unkF440C5;
|
|||
extern uint8_t gRideEntranceExitPlaceType;
|
||||
extern ride_id_t gRideEntranceExitPlaceRideIndex;
|
||||
extern StationIndex gRideEntranceExitPlaceStationIndex;
|
||||
extern uint8_t gRideEntranceExitPlacePreviousRideConstructionState;
|
||||
extern RideConstructionState gRideEntranceExitPlacePreviousRideConstructionState;
|
||||
extern uint8_t gRideEntranceExitPlaceDirection;
|
||||
|
||||
extern bool gGotoStartPlacementMode;
|
||||
|
|
|
@ -53,7 +53,7 @@ uint16_t _numCurrentPossibleRideConfigurations;
|
|||
uint16_t _numCurrentPossibleSpecialTrackPieces;
|
||||
|
||||
uint32_t _currentTrackCurve;
|
||||
uint8_t _rideConstructionState;
|
||||
RideConstructionState _rideConstructionState;
|
||||
ride_id_t _currentRideIndex;
|
||||
|
||||
CoordsXYZ _currentTrackBegin;
|
||||
|
@ -83,7 +83,7 @@ uint8_t gLastEntranceStyle;
|
|||
uint8_t gRideEntranceExitPlaceType;
|
||||
ride_id_t gRideEntranceExitPlaceRideIndex;
|
||||
StationIndex gRideEntranceExitPlaceStationIndex;
|
||||
uint8_t gRideEntranceExitPlacePreviousRideConstructionState;
|
||||
RideConstructionState gRideEntranceExitPlacePreviousRideConstructionState;
|
||||
Direction gRideEntranceExitPlaceDirection;
|
||||
|
||||
using namespace OpenRCT2;
|
||||
|
@ -545,24 +545,24 @@ void ride_construction_invalidate_current_track()
|
|||
{
|
||||
switch (_rideConstructionState)
|
||||
{
|
||||
case RIDE_CONSTRUCTION_STATE_SELECTED:
|
||||
case RideConstructionState::Selected:
|
||||
sub_6C683D(
|
||||
{ _currentTrackBegin, static_cast<Direction>(_currentTrackPieceDirection & 3) }, _currentTrackPieceType, 0,
|
||||
nullptr, TRACK_ELEMENT_SET_HIGHLIGHT_FALSE);
|
||||
break;
|
||||
case RIDE_CONSTRUCTION_STATE_MAZE_BUILD:
|
||||
case RIDE_CONSTRUCTION_STATE_MAZE_MOVE:
|
||||
case RIDE_CONSTRUCTION_STATE_MAZE_FILL:
|
||||
case RIDE_CONSTRUCTION_STATE_FRONT:
|
||||
case RIDE_CONSTRUCTION_STATE_BACK:
|
||||
case RideConstructionState::Build:
|
||||
case RideConstructionState::MazeMove:
|
||||
case RideConstructionState::MazeFill:
|
||||
case RideConstructionState::Front:
|
||||
case RideConstructionState::Back:
|
||||
if (_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_ARROW)
|
||||
{
|
||||
map_invalidate_tile_full(_currentTrackBegin.ToTileStart());
|
||||
}
|
||||
ride_construction_remove_ghosts();
|
||||
break;
|
||||
case RIDE_CONSTRUCTION_STATE_PLACE:
|
||||
case RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT:
|
||||
case RideConstructionState::Place:
|
||||
case RideConstructionState::EntranceExit:
|
||||
default:
|
||||
if (_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_ARROW)
|
||||
{
|
||||
|
@ -604,7 +604,7 @@ static void ride_construction_reset_current_piece()
|
|||
else
|
||||
{
|
||||
_currentTrackCurve = TrackElemType::None;
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_0;
|
||||
_rideConstructionState = RideConstructionState::State0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -628,7 +628,7 @@ void ride_construction_set_default_next_piece()
|
|||
_currentTrackPrice = MONEY32_UNDEFINED;
|
||||
switch (_rideConstructionState)
|
||||
{
|
||||
case RIDE_CONSTRUCTION_STATE_FRONT:
|
||||
case RideConstructionState::Front:
|
||||
direction = _currentTrackPieceDirection;
|
||||
if (!track_block_get_previous_from_zero(_currentTrackBegin, ride, direction, &trackBeginEnd))
|
||||
{
|
||||
|
@ -679,7 +679,7 @@ void ride_construction_set_default_next_piece()
|
|||
_currentTrackLiftHill = tileElement->AsTrack()->HasChain() && slope != TRACK_SLOPE_DOWN_25
|
||||
&& slope != TRACK_SLOPE_DOWN_60;
|
||||
break;
|
||||
case RIDE_CONSTRUCTION_STATE_BACK:
|
||||
case RideConstructionState::Back:
|
||||
direction = direction_reverse(_currentTrackPieceDirection);
|
||||
if (!track_block_get_next_from_zero(_currentTrackBegin, ride, direction, &xyElement, &z, &direction, false))
|
||||
{
|
||||
|
@ -726,6 +726,8 @@ void ride_construction_set_default_next_piece()
|
|||
_currentTrackLiftHill = tileElement->AsTrack()->HasChain();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -735,7 +737,7 @@ void ride_construction_set_default_next_piece()
|
|||
*/
|
||||
void ride_select_next_section()
|
||||
{
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_SELECTED)
|
||||
if (_rideConstructionState == RideConstructionState::Selected)
|
||||
{
|
||||
ride_construction_invalidate_current_track();
|
||||
int32_t direction = _currentTrackPieceDirection;
|
||||
|
@ -744,7 +746,7 @@ void ride_select_next_section()
|
|||
auto newCoords = sub_6C683D({ _currentTrackBegin, static_cast<Direction>(direction & 3) }, type, 0, &tileElement, 0);
|
||||
if (newCoords == std::nullopt)
|
||||
{
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_0;
|
||||
_rideConstructionState = RideConstructionState::State0;
|
||||
window_ride_construction_update_active_elements();
|
||||
return;
|
||||
}
|
||||
|
@ -775,7 +777,7 @@ void ride_select_next_section()
|
|||
}
|
||||
else
|
||||
{
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_FRONT;
|
||||
_rideConstructionState = RideConstructionState::Front;
|
||||
_currentTrackBegin = { outputElement, newCoords->z };
|
||||
_currentTrackPieceDirection = direction;
|
||||
_currentTrackPieceType = tileElement->AsTrack()->GetTrackType();
|
||||
|
@ -784,7 +786,7 @@ void ride_select_next_section()
|
|||
window_ride_construction_update_active_elements();
|
||||
}
|
||||
}
|
||||
else if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_BACK)
|
||||
else if (_rideConstructionState == RideConstructionState::Back)
|
||||
{
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
|
||||
|
||||
|
@ -801,7 +803,7 @@ void ride_select_next_section()
|
|||
*/
|
||||
void ride_select_previous_section()
|
||||
{
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_SELECTED)
|
||||
if (_rideConstructionState == RideConstructionState::Selected)
|
||||
{
|
||||
ride_construction_invalidate_current_track();
|
||||
int32_t direction = _currentTrackPieceDirection;
|
||||
|
@ -810,7 +812,7 @@ void ride_select_previous_section()
|
|||
auto newCoords = sub_6C683D({ _currentTrackBegin, static_cast<Direction>(direction & 3) }, type, 0, &tileElement, 0);
|
||||
if (newCoords == std::nullopt)
|
||||
{
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_0;
|
||||
_rideConstructionState = RideConstructionState::State0;
|
||||
window_ride_construction_update_active_elements();
|
||||
return;
|
||||
}
|
||||
|
@ -836,7 +838,7 @@ void ride_select_previous_section()
|
|||
}
|
||||
else
|
||||
{
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_BACK;
|
||||
_rideConstructionState = RideConstructionState::Back;
|
||||
_currentTrackBegin.x = trackBeginEnd.end_x;
|
||||
_currentTrackBegin.y = trackBeginEnd.end_y;
|
||||
_currentTrackBegin.z = trackBeginEnd.begin_z;
|
||||
|
@ -847,7 +849,7 @@ void ride_select_previous_section()
|
|||
window_ride_construction_update_active_elements();
|
||||
}
|
||||
}
|
||||
else if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_FRONT)
|
||||
else if (_rideConstructionState == RideConstructionState::Front)
|
||||
{
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
|
||||
|
||||
|
@ -895,7 +897,7 @@ static bool ride_modify_entrance_or_exit(const CoordsXYE& tileElement)
|
|||
}
|
||||
|
||||
ride_construction_invalidate_current_track();
|
||||
if (_rideConstructionState != RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT || !(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))
|
||||
if (_rideConstructionState != RideConstructionState::EntranceExit || !(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))
|
||||
|| gCurrentToolWidget.window_classification != WC_RIDE_CONSTRUCTION)
|
||||
{
|
||||
// Replace entrance / exit
|
||||
|
@ -907,10 +909,10 @@ static bool ride_modify_entrance_or_exit(const CoordsXYE& tileElement)
|
|||
gRideEntranceExitPlaceRideIndex = rideIndex;
|
||||
gRideEntranceExitPlaceStationIndex = stationIndex;
|
||||
input_set_flag(INPUT_FLAG_6, true);
|
||||
if (_rideConstructionState != RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT)
|
||||
if (_rideConstructionState != RideConstructionState::EntranceExit)
|
||||
{
|
||||
gRideEntranceExitPlacePreviousRideConstructionState = _rideConstructionState;
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT;
|
||||
_rideConstructionState = RideConstructionState::EntranceExit;
|
||||
}
|
||||
|
||||
window_ride_construction_update_active_elements();
|
||||
|
@ -948,7 +950,7 @@ static bool ride_modify_maze(const CoordsXYE& tileElement)
|
|||
if (trackElement != nullptr)
|
||||
{
|
||||
_currentRideIndex = trackElement->GetRideIndex();
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_MAZE_BUILD;
|
||||
_rideConstructionState = RideConstructionState::Build;
|
||||
_currentTrackBegin.x = tileElement.x;
|
||||
_currentTrackBegin.y = tileElement.y;
|
||||
_currentTrackBegin.z = trackElement->GetBaseZ();
|
||||
|
@ -1030,7 +1032,7 @@ bool ride_modify(CoordsXYE* input)
|
|||
return false;
|
||||
|
||||
_currentRideIndex = rideIndex;
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_SELECTED;
|
||||
_rideConstructionState = RideConstructionState::Selected;
|
||||
_currentTrackBegin = *newCoords;
|
||||
_currentTrackPieceDirection = direction;
|
||||
_currentTrackPieceType = type;
|
||||
|
@ -1045,13 +1047,13 @@ bool ride_modify(CoordsXYE* input)
|
|||
}
|
||||
|
||||
ride_select_next_section();
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_FRONT)
|
||||
if (_rideConstructionState == RideConstructionState::Front)
|
||||
{
|
||||
window_ride_construction_update_active_elements();
|
||||
return true;
|
||||
}
|
||||
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_SELECTED;
|
||||
_rideConstructionState = RideConstructionState::Selected;
|
||||
_currentTrackBegin = *newCoords;
|
||||
_currentTrackPieceDirection = direction;
|
||||
_currentTrackPieceType = type;
|
||||
|
@ -1059,9 +1061,9 @@ bool ride_modify(CoordsXYE* input)
|
|||
|
||||
ride_select_previous_section();
|
||||
|
||||
if (_rideConstructionState != RIDE_CONSTRUCTION_STATE_BACK)
|
||||
if (_rideConstructionState != RideConstructionState::Back)
|
||||
{
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_SELECTED;
|
||||
_rideConstructionState = RideConstructionState::Selected;
|
||||
_currentTrackBegin = *newCoords;
|
||||
_currentTrackPieceDirection = direction;
|
||||
_currentTrackPieceType = type;
|
||||
|
@ -1110,7 +1112,7 @@ int32_t ride_initialise_construction_window(Ride* ride)
|
|||
_previousTrackSlopeEnd = 0;
|
||||
|
||||
_currentTrackPieceDirection = 0;
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_PLACE;
|
||||
_rideConstructionState = RideConstructionState::Place;
|
||||
_currentTrackSelectionFlags = 0;
|
||||
|
||||
window_ride_construction_update_active_elements();
|
||||
|
@ -1657,7 +1659,7 @@ bool ride_select_backwards_from_front()
|
|||
track_begin_end trackBeginEnd;
|
||||
if (track_block_get_previous_from_zero(_currentTrackBegin, ride, _currentTrackPieceDirection, &trackBeginEnd))
|
||||
{
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_SELECTED;
|
||||
_rideConstructionState = RideConstructionState::Selected;
|
||||
_currentTrackBegin.x = trackBeginEnd.begin_x;
|
||||
_currentTrackBegin.y = trackBeginEnd.begin_y;
|
||||
_currentTrackBegin.z = trackBeginEnd.begin_z;
|
||||
|
@ -1682,7 +1684,7 @@ bool ride_select_forwards_from_back()
|
|||
CoordsXYE next_track;
|
||||
if (track_block_get_next_from_zero(_currentTrackBegin, ride, direction, &next_track, &z, &direction, false))
|
||||
{
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_SELECTED;
|
||||
_rideConstructionState = RideConstructionState::Selected;
|
||||
_currentTrackBegin.x = next_track.x;
|
||||
_currentTrackBegin.y = next_track.y;
|
||||
_currentTrackBegin.z = z;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
bool gDisableErrorWindowSound = false;
|
||||
|
||||
uint64_t _enabledRidePieces;
|
||||
uint8_t _rideConstructionState2;
|
||||
RideConstructionState _rideConstructionState2;
|
||||
|
||||
// This variable is updated separately from ride->num_stations because the latter
|
||||
// is unreliable if currently in station construction mode
|
||||
|
@ -133,7 +133,7 @@ static std::tuple<bool, track_type_t> window_ride_construction_update_state_get_
|
|||
uint8_t startBank = _previousTrackBankEnd;
|
||||
uint8_t endBank = _currentTrackBankEnd;
|
||||
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_BACK)
|
||||
if (_rideConstructionState == RideConstructionState::Back)
|
||||
{
|
||||
startSlope = _currentTrackSlopeEnd;
|
||||
endSlope = _previousTrackSlopeEnd;
|
||||
|
@ -150,7 +150,7 @@ static std::tuple<bool, track_type_t> window_ride_construction_update_state_get_
|
|||
bool startsDiagonal = (_currentTrackPieceDirection & (1 << 2)) != 0;
|
||||
if (curve == TRACK_CURVE_LEFT_LARGE || curve == TRACK_CURVE_RIGHT_LARGE)
|
||||
{
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_BACK)
|
||||
if (_rideConstructionState == RideConstructionState::Back)
|
||||
{
|
||||
startsDiagonal = !startsDiagonal;
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ static std::tuple<bool, track_type_t> window_ride_construction_update_state_get_
|
|||
return std::make_tuple(false, 0);
|
||||
}
|
||||
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_BACK)
|
||||
if (_rideConstructionState == RideConstructionState::Back)
|
||||
{
|
||||
if (endSlope != TRACK_SLOPE_DOWN_25)
|
||||
{
|
||||
|
@ -317,7 +317,7 @@ bool window_ride_construction_update_state(
|
|||
x = _currentTrackBegin.x;
|
||||
y = _currentTrackBegin.y;
|
||||
auto z = _currentTrackBegin.z;
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_BACK)
|
||||
if (_rideConstructionState == RideConstructionState::Back)
|
||||
{
|
||||
z -= trackCoordinates.z_end;
|
||||
trackDirection = _currentTrackPieceDirection ^ 0x02;
|
||||
|
@ -401,7 +401,7 @@ void window_ride_construction_do_entrance_exit_check()
|
|||
return;
|
||||
}
|
||||
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_0)
|
||||
if (_rideConstructionState == RideConstructionState::State0)
|
||||
{
|
||||
w = window_find_by_class(WC_RIDE_CONSTRUCTION);
|
||||
if (w != nullptr)
|
||||
|
@ -432,7 +432,7 @@ void window_ride_construction_mouseup_demolish_next_piece(const CoordsXYZD& piec
|
|||
if (gGotoStartPlacementMode)
|
||||
{
|
||||
_currentTrackBegin.z = floor2(piecePos.z, COORDS_Z_STEP);
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_FRONT;
|
||||
_rideConstructionState = RideConstructionState::Front;
|
||||
_currentTrackSelectionFlags = 0;
|
||||
_currentTrackPieceDirection = piecePos.direction & 3;
|
||||
auto savedCurrentTrackCurve = _currentTrackCurve;
|
||||
|
@ -464,15 +464,15 @@ void window_ride_construction_mouseup_demolish_next_piece(const CoordsXYZD& piec
|
|||
}
|
||||
else
|
||||
{
|
||||
if (_rideConstructionState2 == RIDE_CONSTRUCTION_STATE_SELECTED
|
||||
|| _rideConstructionState2 == RIDE_CONSTRUCTION_STATE_FRONT)
|
||||
if (_rideConstructionState2 == RideConstructionState::Selected
|
||||
|| _rideConstructionState2 == RideConstructionState::Front)
|
||||
{
|
||||
if (type == TrackElemType::MiddleStation || type == TrackElemType::BeginStation)
|
||||
{
|
||||
type = TrackElemType::EndStation;
|
||||
}
|
||||
}
|
||||
if (_rideConstructionState2 == RIDE_CONSTRUCTION_STATE_BACK)
|
||||
if (_rideConstructionState2 == RideConstructionState::Back)
|
||||
{
|
||||
if (type == TrackElemType::MiddleStation)
|
||||
{
|
||||
|
@ -482,17 +482,17 @@ void window_ride_construction_mouseup_demolish_next_piece(const CoordsXYZD& piec
|
|||
if (network_get_mode() == NETWORK_MODE_CLIENT)
|
||||
{
|
||||
// rideConstructionState needs to be set again to the proper value, this only affects the client
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_SELECTED;
|
||||
_rideConstructionState = RideConstructionState::Selected;
|
||||
}
|
||||
_currentTrackBegin = piecePos;
|
||||
_currentTrackPieceDirection = piecePos.direction;
|
||||
_currentTrackPieceType = type;
|
||||
_currentTrackSelectionFlags = 0;
|
||||
if (_rideConstructionState2 == RIDE_CONSTRUCTION_STATE_FRONT)
|
||||
if (_rideConstructionState2 == RideConstructionState::Front)
|
||||
{
|
||||
ride_select_next_section();
|
||||
}
|
||||
else if (_rideConstructionState2 == RIDE_CONSTRUCTION_STATE_BACK)
|
||||
else if (_rideConstructionState2 == RideConstructionState::Back)
|
||||
{
|
||||
ride_select_previous_section();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue