Skip to content

Commit

Permalink
Remove gTrackGroundFlags by returning it within GameActionResult (#8930)
Browse files Browse the repository at this point in the history
Fix #8726
  • Loading branch information
Nazey authored and duncanspumpkin committed Mar 24, 2019
1 parent fef7a4a commit 9cbc308
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 97 deletions.
5 changes: 5 additions & 0 deletions contributors.md
Expand Up @@ -116,6 +116,11 @@ The following people are not part of the development team, but have been contrib
* 脴ystein Dale (oystedal)
* Christian Schubert (Osmodium)
* James Lord (RCTMASTA)
* Brian Massino (Nazey)
* Lauren Watson (lwatson2016)
* Jason Myre (jmyre1999)
* Nicole Wright (nicolewright)
* Josh Tucker (joshtucker132)

## Toolchain
* (Balletie) - macOS
Expand Down
11 changes: 5 additions & 6 deletions src/openrct2-ui/windows/RideConstruction.cpp
Expand Up @@ -1654,8 +1654,8 @@ static void window_ride_construction_dropdown(rct_window* w, rct_widgetindex wid
_currentTrackCurve = trackPiece | 0x100;
window_ride_construction_update_active_elements();
}
static void RideConstructPlacedForwardGameActionCallback(const GameAction* ga, const GameActionResult* result);
static void RideConstructPlacedBackwardGameActionCallback(const GameAction* ga, const GameActionResult* result);
static void RideConstructPlacedForwardGameActionCallback(const GameAction* ga, const TrackPlaceActionResult* result);
static void RideConstructPlacedBackwardGameActionCallback(const GameAction* ga, const TrackPlaceActionResult* result);
static void CloseConstructWindowOnCompletion(Ride* ride);

static void CloseConstructWindowOnCompletion(Ride* ride)
Expand All @@ -1677,7 +1677,7 @@ static void CloseConstructWindowOnCompletion(Ride* ride)
}
}

static void RideConstructPlacedForwardGameActionCallback(const GameAction* ga, const GameActionResult* result)
static void RideConstructPlacedForwardGameActionCallback(const GameAction* ga, const TrackPlaceActionResult* result)
{
if (result->Error != GA_ERROR::OK)
{
Expand Down Expand Up @@ -1724,7 +1724,7 @@ static void RideConstructPlacedForwardGameActionCallback(const GameAction* ga, c
CloseConstructWindowOnCompletion(ride);
}

static void RideConstructPlacedBackwardGameActionCallback(const GameAction* ga, const GameActionResult* result)
static void RideConstructPlacedBackwardGameActionCallback(const GameAction* ga, const TrackPlaceActionResult* result)
{
if (result->Error != GA_ERROR::OK)
{
Expand Down Expand Up @@ -1791,7 +1791,6 @@ static void window_ride_construction_construct(rct_window* w)
auto trackPlaceAction = TrackPlaceAction(
rideIndex, trackType, { x, y, z, static_cast<uint8_t>(trackDirection) }, (properties)&0xFF, (properties >> 8) & 0x0F,
(properties >> 12) & 0x0F, liftHillAndAlternativeState);

if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_BACK)
{
trackPlaceAction.SetCallback(RideConstructPlacedBackwardGameActionCallback);
Expand All @@ -1815,7 +1814,7 @@ static void window_ride_construction_construct(rct_window* w)
_currentTrackSelectionFlags |= TRACK_SELECTION_FLAG_TRACK_PLACE_ACTION_QUEUED;
}

if (gTrackGroundFlags & TRACK_ELEMENT_LOCATION_IS_UNDERGROUND)
if (dynamic_cast<TrackPlaceActionResult*>(res.get())->GroundFlags & TRACK_ELEMENT_LOCATION_IS_UNDERGROUND)
{
viewport_set_visibility(1);
}
Expand Down

0 comments on commit 9cbc308

Please sign in to comment.