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 TrackAndDirection #2154

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Refactor TrackAndDirection #2154

wants to merge 5 commits into from

Conversation

ZehMatt
Copy link
Contributor

@ZehMatt ZehMatt commented Oct 19, 2023

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.

uint32_t remainingDistance; // 0x28
union
{
TrackAndDirection trackAndDirection;
Copy link
Contributor

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

Copy link
Contributor Author

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)
Copy link
Contributor

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;
Copy link
Contributor

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;
Copy link
Contributor

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

Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants