Windows 10, 64 Bit
v0.2.4
e36d8f0
I built a custom LIM Launched Roller Coaster in the Gravity Gardens campaign mission of the game. The refurbishment of the roller coaster is free. This is the only roller coaster in my game where refurbishment is free.

Save game:
Gravity Gardens.zip
This error is happening when TrackRemoveAction tries to remove a piece of track with type TRACK_ELEM_90_DEG_DOWN, in order to calculate the refurbishment cost I'm presuming.
We actually get a message in terminal with a warning when clicking the refurbishment button:
WARNING[OpenRCT2\src\openrct2\actions\TrackRemoveAction.hpp:116
(TrackRemoveAction::Query)]: Track Element not found. x = 544, y = 992, z = 512, d = 2, seq = 1.
This happens because we can't find one of the TRACK_ELEM_90_DEG_DOWN coaster tracks in the map.
Oddly enough, that track is present on the map, under the same position and type, but the tileElement->AsTrack()->Sequence we are looking for is mismatched: we are looking for Sequence == 1, but the map has the track with Sequence == 0.
I was trying to find where in the map we create such track, and it seems to me like we create it with Sequence == 1, so I'm trying to figure out where, if anywhere, the Sequence is flipped to 0.
This happens on a brand new LIM coaster too, as long as it has a TRACK_ELEM_90_DEG_DOWN element.
This unfortunately still happens with the Compact Inverted Coaster too (as reported in #11655). It doesn't just happen with refurbishment, it even happens when you try to demolish the ride, although the difference here is that you still gain money from deleting the ride.
EDIT: It happens with every coaster type that can use vertical slopes if the last piece coming out from behind the station is a vertical drop piece.
The demolish and refurbish windows use the same code to calculate the price, which of course results in the exact same error. When actually demolishing the ride, each track piece is removed individually with a more robust algorithm, which always results in the correct refund price. This algorithm is however not (yet) suitable for calculating the refund price without removing the track pieces.
As the price calculation code is based on the save code, does the coaster save properly?
Most helpful comment
This error is happening when
TrackRemoveActiontries to remove a piece of track with typeTRACK_ELEM_90_DEG_DOWN, in order to calculate the refurbishment cost I'm presuming.We actually get a message in terminal with a warning when clicking the refurbishment button:
This happens because we can't find one of the
TRACK_ELEM_90_DEG_DOWNcoaster tracks in the map.Oddly enough, that track is present on the map, under the same position and type, but the
tileElement->AsTrack()->Sequencewe are looking for is mismatched: we are looking for Sequence == 1, but the map has the track with Sequence == 0.I was trying to find where in the map we create such track, and it seems to me like we create it with Sequence == 1, so I'm trying to figure out where, if anywhere, the Sequence is flipped to 0.
This happens on a brand new LIM coaster too, as long as it has a
TRACK_ELEM_90_DEG_DOWNelement.