Skip to content

Map: a sure revisit drops paths the room no longer lists - #27

Merged
MHohlios merged 2 commits into
mainfrom
wiffletree/map-revisiting-a-room-drops-paths-the-game-no-lo
Nov 3, 2026
Merged

MHohlios merged 2 commits into
mainfrom
wiffletree/map-revisiting-a-room-drops-paths-the-game-no-lo

Conversation

@MHohlios

@MHohlios MHohlios commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Why

In an area with two look-alike rooms side by side (two "Southern Meadow"s), the map once mistook one for the other and gave the west meadow a south path that doesn't exist. note_exits refreshed a room's exit list on every visit but never removed links, so the bogus path outlived every visit.

What changed

  • Layout::drop_unlisted_links (map/layout.rs): on a sure arrival (the tracker is convinced, not adrift, not dark), the current room drops each link in a direction it no longer lists, and the far room drops its return link when that link points back.
  • A doorway (an exit once seen with a door) keeps its link on both ends, so shut or hidden doors still work.
  • Maze rooms are skipped on both ends: a maze stands for many squares, but its exits are only the last square's.
  • Doc comments in map/room.rs and persist/schema.rs updated to the new rule.

Tests

  • New a_sure_revisit_drops_a_path_the_room_no_longer_lists: reaches the bad state through a plausible walk (a crooked path fools the map into the wrong meadow), revisits surely, and checks the link is gone after reopening the database. It fails without the fix.
  • New a_maze_keeps_its_links_when_its_last_square_lists_fewer_exits.
  • links_stay_when_a_room_later_lists_fewer_exits is now a_doorway_keeps_its_link_when_the_room_later_lists_fewer_exits: it sees a closed door first, since only a doorway's link now survives a missing listing.
  • cargo fmt --check, cargo clippy --workspace --all-targets --release -- -D warnings and cargo test -p mudling-core pass.

Follow-ups

  • A wrong guess the map is convinced of now also drops the real paths of the room it guessed. They're relearned on the next walk through those exits; consider skipping the drop when doubt ended only by the long-doubt fallback or a look-alike link guess (crates/mudling-core/src/map/tracker.rs:382).

Reviewed with Wiffletree: 1 full review and 1 re-check, 2 rounds (Tests, Claude, Style)

mhohlios added 2 commits November 2, 2026 22:27
A wrong guess between look-alike rooms could give a room a path the game
never lists there, and links outlived every later visit. A sure arrival
now drops the room's links in directions it no longer lists, and the far
rooms' ways back along them, except through a known doorway.
A maze shows only the last square's exits, so its real ways in and out
must not be dropped, on its side or the far side. Also bring the schema
comment on links in line with the new rule.
@MHohlios
MHohlios merged commit 5f23f7f into main Nov 3, 2026
6 checks passed
@MHohlios
MHohlios deleted the wiffletree/map-revisiting-a-room-drops-paths-the-game-no-lo branch November 3, 2026 11:53
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.

1 participant