mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #10078 from kodmord/ISSUE-10074
Fix #10074: Refactor TrackDesignEntranceElement
This commit is contained in:
commit
8539303602
|
@ -107,7 +107,7 @@ bool T6Exporter::SaveTrack(IStream* stream)
|
||||||
|
|
||||||
for (const auto& entranceElement : _trackDesign->entrance_elements)
|
for (const auto& entranceElement : _trackDesign->entrance_elements)
|
||||||
{
|
{
|
||||||
tempStream.WriteValue<uint8_t>(entranceElement.z);
|
tempStream.WriteValue<uint8_t>(entranceElement.z == -1 ? (uint8_t)0x80 : entranceElement.z);
|
||||||
tempStream.WriteValue<uint8_t>(entranceElement.direction | (entranceElement.isExit << 7));
|
tempStream.WriteValue<uint8_t>(entranceElement.direction | (entranceElement.isExit << 7));
|
||||||
tempStream.WriteValue<int16_t>(entranceElement.x);
|
tempStream.WriteValue<int16_t>(entranceElement.x);
|
||||||
tempStream.WriteValue<int16_t>(entranceElement.y);
|
tempStream.WriteValue<int16_t>(entranceElement.y);
|
||||||
|
|
|
@ -173,7 +173,7 @@ public:
|
||||||
_stream.SetPosition(_stream.GetPosition() - 1);
|
_stream.SetPosition(_stream.GetPosition() - 1);
|
||||||
_stream.Read(&t6EntranceElement, sizeof(rct_td6_entrance_element));
|
_stream.Read(&t6EntranceElement, sizeof(rct_td6_entrance_element));
|
||||||
TrackDesignEntranceElement entranceElement{};
|
TrackDesignEntranceElement entranceElement{};
|
||||||
entranceElement.z = t6EntranceElement.z;
|
entranceElement.z = (t6EntranceElement.z == (int8_t)(uint8_t)0x80) ? -1 : t6EntranceElement.z;
|
||||||
entranceElement.direction = t6EntranceElement.direction & 0x7F;
|
entranceElement.direction = t6EntranceElement.direction & 0x7F;
|
||||||
entranceElement.x = t6EntranceElement.x;
|
entranceElement.x = t6EntranceElement.x;
|
||||||
entranceElement.y = t6EntranceElement.y;
|
entranceElement.y = t6EntranceElement.y;
|
||||||
|
|
|
@ -320,11 +320,6 @@ rct_string_id TrackDesign::CreateTrackDesignTrack(const Ride& ride)
|
||||||
return STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY;
|
return STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (z == 0xFF)
|
|
||||||
{
|
|
||||||
z = 0x80;
|
|
||||||
}
|
|
||||||
|
|
||||||
entrance.z = z;
|
entrance.z = z;
|
||||||
|
|
||||||
// If this is the exit version
|
// If this is the exit version
|
||||||
|
@ -1643,7 +1638,7 @@ static bool track_design_place_ride(TrackDesign* td6, int16_t x, int16_t y, int1
|
||||||
};
|
};
|
||||||
TileElement* tile_element = map_get_first_element_at(tile.x >> 5, tile.y >> 5);
|
TileElement* tile_element = map_get_first_element_at(tile.x >> 5, tile.y >> 5);
|
||||||
z = gTrackPreviewOrigin.z / 8;
|
z = gTrackPreviewOrigin.z / 8;
|
||||||
z += (entrance.z == (int8_t)(uint8_t)0x80) ? -1 : entrance.z;
|
z += entrance.z;
|
||||||
if (tile_element == nullptr)
|
if (tile_element == nullptr)
|
||||||
{
|
{
|
||||||
_trackDesignPlaceCost = MONEY32_UNDEFINED;
|
_trackDesignPlaceCost = MONEY32_UNDEFINED;
|
||||||
|
@ -1698,8 +1693,7 @@ static bool track_design_place_ride(TrackDesign* td6, int16_t x, int16_t y, int1
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
z = (entrance.z == (int8_t)(uint8_t)0x80) ? -1 : entrance.z;
|
z = entrance.z * 8;
|
||||||
z *= 8;
|
|
||||||
z += gTrackPreviewOrigin.z;
|
z += gTrackPreviewOrigin.z;
|
||||||
|
|
||||||
auto res = RideEntranceExitPlaceAction::TrackPlaceQuery({ x, y, z }, false);
|
auto res = RideEntranceExitPlaceAction::TrackPlaceQuery({ x, y, z }, false);
|
||||||
|
|
Loading…
Reference in New Issue