Conversation
Mentioned in 1654735 and a comment in do_play_instrument(music.c) as something which would be a nice future improvement if there were more bits available in flags/drawbridgemask. Turns out the DB_UNDER states are all mutually exclusive and never overlap, so a bit for the jam can be saved by rearranging those.
When a drawbridge becomes jammed, it can be unjammed with the #untrap command, on either the drawbridge itself or the portcullis.
| #define DB_MOAT 0x0 | ||
| #define DB_LAVA 0x4 | ||
| #define DB_ICE 0x8 | ||
| #define DB_FLOOR 0xc | ||
| #define DB_UNDER 0xc /* mask for underneath */ |
There was a problem hiding this comment.
Previously, DB_UNDER = DB_LAVA | DB_ICE | DB_FLOOR. In this change, DB_UNDER = DB_FLOOR. Does this not introduce bugs in code that uses DB_UNDER?
There was a problem hiding this comment.
It's still DB_MOAT | DB_LAVA | DB_ICE | DB_FLOOR (0x0 | 0x4 | 0x8 | 0xc is 0xc), it's just that because they are mutually exclusive states, there can be overlap -- in other words, the checks are always (flags & DB_UNDER) == DB_MOAT, never (flags & DB_MOAT) != 0 (which would be impossible even in the current arrangement, since one of them is 0). So it's not necessary to give each one a unique bit; as long as the values themselves are unique and distinguishable all the existing code works fine.
But this hack to save a bit is also not really necessary if you've expanded flags.
Mentioned in 1654735 and a comment in do_play_instrument(music.c) as
something which would be a nice future improvement if there were more
bits available in flags/drawbridgemask. Turns out the DB_UNDER states
are all mutually exclusive and never overlap, so a bit for the jam can
be saved by rearranging those. An attempt at implementing this.