-
Notifications
You must be signed in to change notification settings - Fork 52
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
Render contiguous boundaries #1285
Conversation
4646cb0
to
42eb3fd
Compare
96a06ae
to
118e874
Compare
118e874
to
8bde244
Compare
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.
@kostmo Looks good! 👍
I was initially put off by having the variants hardcoded, but on further thought this simple approach makes sense.
The PR description confused me though, is the discussion up to date?
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.
Looks good to me, though I can't help thinking that the complication with the orientationMap
necessitates adding yet more complication in the form of a boundaryOverride
field in a Display
.
This is just speculation for a future PR... what if a Display
contained just a single Char
, and an "orientation map" was stored at a higher level as a function from direction to Display
? Likewise, then Display
wouldn't have to know anything about boundary overrides --- if you wanted to show a boundary you would just take the Display
you got and replace its Char
with the appropriate box drawing character. [The reason we can't do that now is that you can't just "replace a Display
's character" since it might store a whole orientation map worth of different characters...]
Makes use of #1285 to simplify wall rendering in several scenarios.
Closes #1271
Demo
Implementation
This implements neighbor-aware boundary rendering strictly on the display layer. Underlying entities remain unchanged (for the purpose of world cell contents and e.g.
scan
). Eventually we should be able to retire all of the niche boundary glyph entities.Only a single function
getBoundaryDisplay
is exposed for computing the glyph appropriate for adjacent boundaries. It takes a function fromAbsoluteDir -> Bool
indicating whether the neighbor cell in a particular direction is (also) a "boundary" entity.The internal
glyphForNeighbors
function is implemented with pattern-matching such that exhaustive coverage of cases is guaranteed.