-
Notifications
You must be signed in to change notification settings - Fork 147
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 TrackAndDirection #2154
base: master
Are you sure you want to change the base?
Conversation
uint32_t remainingDistance; // 0x28 | ||
union | ||
{ | ||
TrackAndDirection trackAndDirection; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The offsets are useful to know. // 0x2C
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is there on the union
@@ -120,15 +120,15 @@ namespace OpenLoco::VehicleManager | |||
} | |||
|
|||
// 0x004B05E4 | |||
void placeDownVehicle(Vehicles::VehicleHead* const head, const coord_t x, const coord_t y, const uint8_t baseZ, const Vehicles::TrackAndDirection& unk1, const uint16_t unk2) | |||
void placeDownVehicle(Vehicles::VehicleHead* const head, const coord_t x, const coord_t y, const uint8_t baseZ, const Vehicles::TrackAndDirection& tad, const uint16_t unk2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a trad. Can be called for roads or tracks.
@@ -135,7 +135,7 @@ namespace OpenLoco::GameCommands | |||
newBogie->tileY = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L49 _backup2C is not a TrackAndDirection its a trad.
{ | ||
TrackAndDirection trackAndDirection; | ||
RoadAndDirection roadAndDirection; | ||
uint16_t trad; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this for? trad
isn't a very descriptive name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
track or road and direction is a mouthful. Its there for the cases where we don't know what its going to be used for.
Having it stored directly in the union makes the code a bit more readable and definitely shorter, most if not all functions already expected the correct type, there should be no logic changes.