Skip to content

Fix ORs acting as ANDs in a TrackPieces validation check - #277

Open
LeeSpork wants to merge 2 commits into
OpenLoco:masterfrom
LeeSpork:LeeSpork-patch-1
Open

LeeSpork wants to merge 2 commits into
OpenLoco:masterfrom
LeeSpork:LeeSpork-patch-1

Conversation

@LeeSpork

@LeeSpork LeeSpork commented Sep 18, 2026

Copy link
Copy Markdown

The Enum.HasFlag Method in C# performs the operation (thisInstance & flag) == flag, whereas OpenLoco's hasTraitFlags performs (trackPieces & flagsToTest) != TrackTraitFlags::none (reference), hence the need to implement this check differently.

I also changed the error message that is displayed to the user, as I felt it was a little difficult to understand.

Fixes #276

Not tested.

@LeeSpork LeeSpork changed the title Fix #276 Fix ORs acting as ANDs in a TrackPieces validation check Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not (Diagonal or LargeCurve) and (OneSided or VerySmallCurve) validation does not trigger in some cases where it should

1 participant