routefinder: name loc approach bits, add rotation tests - #156
Open
reldo-dev wants to merge 1 commit into
Open
Conversation
Rotations.rotate masks its input to 4 bits (7cd2d93). The mask is correct but hides the reason: forceApproachFlags is a 5-bit mask, not 4. Every non-zero value in the rev 240 cache is 0b11111 with exactly one bit cleared - the single permitted approach. Bits 0-3 are N/E/S/W; bit 4 is a fifth position used by 59 locs and unmodelled server-side. Unmasked, only 0x1e broke: its stray bit wraps into the low nibble giving 0x0f, blocking every side. The other three rotate correctly by coincidence. No behaviour change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #123. No behaviour change.
Rotations.rotatemasks to 4 bits (7cd2d93). The mask is right — this makes the reason explicit and adds tests.forceApproachFlagsis a 5-bit mask. Every non-zero value at rev 240 is0b11111with exactly one bit cleared — the permitted approach:0x1e111100x1d111010x1b110110x17101110x0f01111Bits 0–3 are N/E/S/W. Bit 4 is a fifth position, used only by 59 locs — all 1×1 and non-solid. Not modelled server-side.
Why only north broke: unmasked,
0x1e shr 3wraps two bits instead of one and gives0x0f— every side blocked. The other three land the stray bit where the shift already set one.Adds the first tests to
engine/routefinder, covering every value in the cache across all four angles.