mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 15:52:55 +01:00
* Fix #10064: Refactor TrackDesignEntranceElement
This commit is contained in:
@@ -620,14 +620,7 @@ static void window_track_place_draw_mini_preview_track(
|
||||
if (draw_mini_preview_is_pixel_in_bounds(pixelPosition))
|
||||
{
|
||||
uint8_t* pixel = draw_mini_preview_get_pixel_ptr(pixelPosition);
|
||||
|
||||
bool isExit = false;
|
||||
if (entrance.direction & (1 << 7))
|
||||
{
|
||||
isExit = true;
|
||||
}
|
||||
|
||||
uint8_t colour = isExit ? _PaletteIndexColourExit : _PaletteIndexColourEntrance;
|
||||
uint8_t colour = entrance.isExit ? _PaletteIndexColourExit : _PaletteIndexColourEntrance;
|
||||
for (int32_t i = 0; i < 4; i++)
|
||||
{
|
||||
pixel[338 + i] = colour; // x + 2, y + 2
|
||||
|
||||
@@ -108,7 +108,7 @@ bool T6Exporter::SaveTrack(IStream* stream)
|
||||
for (const auto& entranceElement : _trackDesign->entrance_elements)
|
||||
{
|
||||
tempStream.WriteValue<uint8_t>(entranceElement.z);
|
||||
tempStream.WriteValue<uint8_t>(entranceElement.direction);
|
||||
tempStream.WriteValue<uint8_t>(entranceElement.direction | (entranceElement.isExit << 7));
|
||||
tempStream.WriteValue<int16_t>(entranceElement.x);
|
||||
tempStream.WriteValue<int16_t>(entranceElement.y);
|
||||
}
|
||||
|
||||
@@ -174,9 +174,10 @@ public:
|
||||
_stream.Read(&t6EntranceElement, sizeof(rct_td6_entrance_element));
|
||||
TrackDesignEntranceElement entranceElement{};
|
||||
entranceElement.z = t6EntranceElement.z;
|
||||
entranceElement.direction = t6EntranceElement.direction;
|
||||
entranceElement.direction = t6EntranceElement.direction & 0x7F;
|
||||
entranceElement.x = t6EntranceElement.x;
|
||||
entranceElement.y = t6EntranceElement.y;
|
||||
entranceElement.isExit = t6EntranceElement.direction >> 7;
|
||||
td->entrance_elements.push_back(entranceElement);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ rct_string_id TrackDesign::CreateTrackDesignTrack(const Ride& ride)
|
||||
// If this is the exit version
|
||||
if (i == 1)
|
||||
{
|
||||
entrance.direction |= (1 << 7);
|
||||
entrance.isExit = true;
|
||||
}
|
||||
entrance_elements.push_back(entrance);
|
||||
}
|
||||
@@ -1635,12 +1635,6 @@ static bool track_design_place_ride(TrackDesign* td6, int16_t x, int16_t y, int1
|
||||
case PTD_OPERATION_PLACE_TRACK_PREVIEW:
|
||||
{
|
||||
rotation = (rotation + entrance.direction) & 3;
|
||||
bool isExit = false;
|
||||
if (entrance.direction & (1 << 7))
|
||||
{
|
||||
isExit = true;
|
||||
}
|
||||
|
||||
if (_trackDesignPlaceOperation != PTD_OPERATION_PLACE_QUERY)
|
||||
{
|
||||
LocationXY16 tile = {
|
||||
@@ -1686,7 +1680,7 @@ static bool track_design_place_ride(TrackDesign* td6, int16_t x, int16_t y, int1
|
||||
|
||||
gGameCommandErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
|
||||
auto rideEntranceExitPlaceAction = RideEntranceExitPlaceAction(
|
||||
{ x, y }, rotation, ride->id, stationIndex, isExit);
|
||||
{ x, y }, rotation, ride->id, stationIndex, entrance.isExit);
|
||||
rideEntranceExitPlaceAction.SetFlags(flags);
|
||||
auto res = flags & GAME_COMMAND_FLAG_APPLY ? GameActions::ExecuteNested(&rideEntranceExitPlaceAction)
|
||||
: GameActions::QueryNested(&rideEntranceExitPlaceAction);
|
||||
|
||||
@@ -28,6 +28,7 @@ struct TrackDesignEntranceElement
|
||||
uint8_t direction;
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
bool isExit;
|
||||
};
|
||||
|
||||
/* Track Scenery entry size: 0x16 */
|
||||
|
||||
Reference in New Issue
Block a user