Open Roller Coaster Tycoon 2
I took on a refactoring issue from the open source re-implementation of Roller Coaster Tycoon 2. It piqued my interest because I love simulation games. I started out playing Transport Tycoon Deluxe when my dad gave it to me for my 7th birthday. Soon after, I played Sim City 4, and recently, I bought Cities Skylines. I have yet to set aside time to play it but I enjoy watching other people theorycraft strategies to optimize traffic.
I am experiencing less anxiety now that I already have one pull request under my belt. Tackling this issue now feels less overwhelming. OpenRTC2 is also written in C++ so it is much more comfortable for me to work with.
Refactor _currentTrackBeginX, _currentTrackBeginY, _currentTrackBeginZ into _currentTrackBegin by using the CoordsXYZ…github.com
In the Ride.cpp file, uint16_t _currentTrackBeginX; uint16_t _currentTrackBeginY; uint16_t _currentTrackBeginZ; were…github.com
The task was to refactor coordinates that were being stored in three separate ints into a struct written specifically for storing coordinates. Initially, three separate variables were used to store a single coordinate.
There already existed a data structure that was for storing 3D coordinates.
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)
My task was to refactor the code base such that it used
Accessing the coordinate would then change from
x = _currentTrackBeginX;
y = _currentTrackBeginY;
z = _currentTrackBeginZ;
x = _currentTrackBegin.x;
y = _currentTrackBegin.y;
z = _currentTrackBegin.z;
I finished this PR much quicker now that I have gained confidence in myself. I delayed myself less from working on the issue. It added a completely different feeling when I played the game because I felt like I was involved in how it works in the backend. I felt empowered that if there was something in the game that felt broken, I am able to fix it myself, instead of grumbling to the game devs on a forum.