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

Fix for Issue#8725: refactoring _currentTrackBegin and _previousTrackPiece in Ride.cpp to use CoordsXYZ struct #8759

Merged
merged 6 commits into from Feb 24, 2019

Conversation

ndngo
Copy link
Contributor

@ndngo ndngo commented Feb 23, 2019

In the Ride.cpp file,

uint16_t _currentTrackBeginX;
uint16_t _currentTrackBeginY;
uint16_t _currentTrackBeginZ;

were refactored to use the CoordsXYZ struct

CoordsXYZ _previousTrackPiece;
struct CoordsXYZ
{
    int32_t x = 0;
    int32_t y = 0;
    int32_t z = 0;

    CoordsXYZ() = default;
    constexpr CoordsXYZ(int32_t _x, int32_t _y, int32_t _z)
        : x(_x)
        , y(_y)
        , z(_z)
    {
    }
};

such that

x = _currentTrackBeginX;
y = _currentTrackBeginY;
z = _currentTrackBeginZ;

becomes

x = _currentTrackBegin.x;
y = _currentTrackBegin.y;
z = _currentTrackBegin.z;

The same refactoring logic was used to refactor _previousTrackPiece.

@ndngo ndngo changed the title Fix for Issue#8725: refactoring _currentTrackBegin and _previousTrackPiece to use CoordsXYZ struct Fix for Issue#8725: refactoring _currentTrackBegin and _previousTrackPiece in Ride.cpp to use CoordsXYZ struct Feb 23, 2019
@IntelOrca
Copy link
Contributor

You will also need to apply changes to other source files which use _currentTrackBegin and _previousTrackPiece

@@ -289,7 +289,7 @@ static constexpr const rct_string_id RideConfigurationStringIds[] = {
STR_HELIX_DOWN_LEFT, // 108
STR_HELIX_DOWN_RIGHT, // 109
STR_BASE_SIZE_2_X_2, // 110
STR_BASE_SIZE_4_X_4, // 111
STR_BASE_SIZE_4_X_4, // ****111
Copy link
Contributor

Choose a reason for hiding this comment

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

Unsure what this change has been made for. Please revert.

Copy link
Contributor

@duncanspumpkin duncanspumpkin left a comment

Choose a reason for hiding this comment

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

Looks good. Almost there just need to make a formatting adjustment to keep the clang-format ci happy.

If your unsure how to find more information on that look below where it says continuous-integration/travis-ci/pr — The Travis CI build failed and click details. Then when on Travis select the clang format option and it will tell you which line needs adjusting.

@duncanspumpkin duncanspumpkin added the refactor A task that will improve code readability, without changing outcome. label Feb 24, 2019
Removed accidental addition to comment
added new line to stay within line length limit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor A task that will improve code readability, without changing outcome.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants