Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor flat ride track pieces #14021

Merged
merged 6 commits into from
Feb 18, 2021

Conversation

Gymnasiast
Copy link
Member

No description provided.

@Gymnasiast Gymnasiast linked an issue Feb 8, 2021 that may be closed by this pull request
@Gymnasiast Gymnasiast force-pushed the refactor/flat-ride-pieces branch 2 times, most recently from 16bb9bf to 81d18e0 Compare February 8, 2021 20:51
@duncanspumpkin
Copy link
Contributor

Replays are only different due to the change in track id. All okay to rerecord.

duncanspumpkin added a commit to OpenRCT2/replays that referenced this pull request Feb 14, 2021
if (src.proximity_track_type == TrackElemType::RotationControlToggleAlias
&& !RCT2TrackTypeIsBooster(_s6.rides[src.current_ride].type, src.proximity_track_type))
dst.ProximityTrackType = TrackElemType::RotationControlToggle;
dst.ProximityTrackType = RCT2TrackTypeToOpenRCT2(src.proximity_track_type, _s6.rides[src.current_ride].type);
Copy link
Contributor

@duncanspumpkin duncanspumpkin Feb 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests are crashing on this if the current ride is null then this will throw. Also proximity_track_type could be 0xFF to imply null this is a subtle bug from #13977.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, but 255 was also the quarter loop of the multi-dim. What if the proximity_track_type was that piece?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's a bit of a mess. I think though you can get away with just checking for null rides and just pretend that the track null issue doesn't exist.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, before I saw this I already pushed a commit that assumed that 255 was null (considering the special checks in RideRating, that seems safest to me). Is it okay to keep that?

@@ -803,7 +803,12 @@ class S6Importer final : public IParkImporter
dst.ProximityStart = { src.proximity_start_x, src.proximity_start_y, src.proximity_start_z };
dst.CurrentRide = src.current_ride;
dst.State = src.state;
dst.ProximityTrackType = RCT2TrackTypeToOpenRCT2(src.proximity_track_type, _s6.rides[src.current_ride].type);
if (src.proximity_track_type == 0xFF)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this will work. I think the first thing to check would be if the current ride is invalid.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I set it to null if src.proximity_track_type == 0xFF || src.current_ride >= RCT12_MAX_RIDES_IN_PARK?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I've looked into it and its impossible to get the information we need. We have lost too much information (really we never had the information) due to the change in track types! We are just going to have to do something hacky and modify the ride rating code to get out of this.

Change the if to the following:

if (src.current_ride < RCT12_MAX_RIDES_IN_PARK && _s6.rides[src.current_ride].type != RIDE_TYPE_NULL)
            dst.ProximityTrackType = RCT2TrackTypeToOpenRCT2(src.proximity_track_type, _s6.rides[src.current_ride].type);
        else
            dst.ProximityTrackType = 0xFF;

We will then need to modify the ride rating checks L335 and L229 to add an additional hack:

// TODO: Hack to be removed with new save format trackType 0xFF should not be here
if (trackType == 0xFF || trackType == TrackElemType::None || ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just thought of something: do we even need to import these at all? Can't we just reset the ratings calc data upon import?

The only downside I see is that it may take a bit longer for the data to come up if you save and reload during calculation, since it would have to start from scratch.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we do need it. Peep decisions are changed depending on rating. Changes to when the rating is available will break the simulation

@Gymnasiast Gymnasiast merged commit c5c21a7 into OpenRCT2:develop Feb 18, 2021
@Gymnasiast Gymnasiast deleted the refactor/flat-ride-pieces branch February 18, 2021 17:54
@Gymnasiast Gymnasiast added this to the v0.3.3 milestone Feb 18, 2021
Gymnasiast added a commit to Gymnasiast/OpenRCT2 that referenced this pull request Feb 23, 2021
tupaschoal pushed a commit that referenced this pull request Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deduplicate flat ride pieces
3 participants