Fix virtual floor no longer appearing during track construction (#22602)

This commit is contained in:
Aaron van Geffen authored and GitHub committed 2024-08-20 20:09:53 +00:00
1 parent dff232e294
commit 23ea4613e6
2 files changed
+17 -1

No files matched your search

+1
View File
@@ -19,6 +19,7 @@
- Fix: [#22316] Potential crash when switching the drawing engine while the game is running.
- Fix: [#22395, #22396] Misaligned tick marks in financial and guest count graphs (original bug).
- Fix: [#22457] Potential crash opening the scenario select window.
- Fix: [#22520] Virtual floor no longer appears when holding modifier keys during track construction.
- Fix: [#22582] Lighting effects are not enabled/disabled correctly, making the game appear frozen.
0.4.13 (2024-08-04)
+16 -1
View File
@@ -18,6 +18,7 @@
#include "../entity/Staff.h"
#include "../interface/Viewport.h"
#include "../network/network.h"
#include "../paint/VirtualFloor.h"
#include "../ride/RideConstruction.h"
#include "../ride/RideData.h"
#include "../ride/Track.h"
@@ -78,12 +79,17 @@ money64 PlaceProvisionalTrackPiece(
if (res.Error != GameActions::Status::Ok)
return kMoney64Undefined;
int16_t zBegin{};
int16_t zBegin{}, zEnd{};
const auto& ted = GetTrackElementDescriptor(trackType);
const TrackCoordinates& coords = ted.coordinates;
if (ride->GetRideTypeDescriptor().HasFlag(RtdFlag::hasTrack))
{
zBegin = coords.zBegin;
zEnd = coords.zEnd;
}
else
{
zEnd = zBegin = coords.zBegin;
}
_unkF440C5 = { trackPos.x, trackPos.y, trackPos.z + zBegin, static_cast<Direction>(trackDirection) };
@@ -96,6 +102,15 @@ money64 PlaceProvisionalTrackPiece(
if (_currentTrackPitchEnd != TrackPitch::None)
ViewportSetVisibility(ViewportVisibility::TrackHeights);
// Invalidate previous track piece (we may not be changing height!)
VirtualFloorInvalidate();
if (!isToolActive(WindowClass::Scenery))
{
// Set height to where the next track piece would begin
VirtualFloorSetHeight(trackPos.z - zBegin + zEnd);
}
return res.Cost;
}