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

Create a TrackDesignEntranceElement struct to replace rct_td6_entrance_element #10052

Closed
duncanspumpkin opened this issue Oct 6, 2019 · 0 comments
Labels
good-first-issue Low hanging fruits good for people new to open source or OpenRCT2. refactor A task that will improve code readability, without changing outcome.

Comments

@duncanspumpkin
Copy link
Contributor

duncanspumpkin commented Oct 6, 2019

We recently created a new TD6 and TD4 importer that takes the existing CS structs (rct_track_td6, rct_track_td4) and imports them into the new internal TrackDesign struct. This is the start of creating a new track design format for OpenRCT2. As part of this process we need to create new structs for the internal structs of the TrackDesign struct. The new TrackDesign has four structs that are still in the original CS types. These are:

  • rct_td46_maze_element
  • rct_td46_track_element
  • rct_td6_entrance_element
  • rct_td6_scenery_element

We need to convert the above structs into our own format so that we can improve them for greater flexibility. The first stage of doing this is to just create an identical struct with a new name and use it when importing and for the TrackDesign struct. I suggest we call them the following:

  • TrackDesignMazeElement
  • TrackDesignTrackElement
  • TrackDesignEntranceElement
  • TrackDesignSceneryElement

This refactor has been split into 4 parts. See also #10051, #10053, #10054.
This issue is only for the changes to implement TrackDesignEntranceElement.
Make the new struct in ride/TrackDesign.h. Make sure it has the exact same fields as rct_td6_entrance_element. Look at every use of rct_td6_entrance_element and if it is NOT in the following files change it to TrackDesignEntranceElement: T6Exporter.cpp, T6Importer.cpp, T4Importer.cpp.

For T6Exporter.cpp, T6Importer.cpp, T4Importer.cpp you will need to modify the importers/exporter to convert between the two structs. Do this field by field.

Example T6Importer

            rct_td6_entrance_element t6EntranceElement{};
            _stream.Read(&t6EntranceElement, sizeof(rct_td6_entrance_element));
            TrackDesignEntranceElement entranceElement{};
            entranceElement.x = t6EntranceElement.x;
            entranceElement.y = t6EntranceElement.y;
            entranceElement.z = t6EntranceElement.z;
            entranceElement.direction = t6EntranceElement.direction;
@duncanspumpkin duncanspumpkin added refactor A task that will improve code readability, without changing outcome. good-first-issue Low hanging fruits good for people new to open source or OpenRCT2. labels Oct 6, 2019
duncanspumpkin added a commit that referenced this issue Oct 8, 2019
Fix #10052: Create a TrackDesignEntranceElement struct to replace rct_td6_entrance_element
XplosiveLugnut pushed a commit to XplosiveLugnut/OpenRCT2 that referenced this issue Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good-first-issue Low hanging fruits good for people new to open source or OpenRCT2. refactor A task that will improve code readability, without changing outcome.
Projects
None yet
Development

No branches or pull requests

1 participant