Houses lose their road link when one piece of road is removed
Whether a building is connected to the market is not a property of the building but of the whole road network, and it changes when a single tile goes. This entry shows how to decide who is cut off, and why diagonal neighbours and the first tile matter.
Why this works
Being connected is a fact about the whole network, not about one piece. Following the roads outward from the source and asking who gets reached always answers truthfully, however the network was cut, and never goes out of date.
When not to use it
It is the wrong tool when roads are free-form or when goods travel by teleport, boat or air, where there is no line to follow. It is also wasteful for very large maps that change constantly. Then keep the links up to date piece by piece.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 4 common mistakes and the fix
- 34 lines of example code with 3 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Houses lose their road link when one piece of road is removed" (read_entry road-connection-flood-fill-after-removal) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP