As soon as I finished the last post on adding walls around our tunnels I realized there was a much simpler way to get the same result.
I had approached the problem from one end: what type of tiles do we need to skip in the process of placing walls around all tunnel tiles. I expected the code to be complex, but, likely due to the small number of different tiles in use at this time, the final solution was fairly simple:
It’s short, but not pretty, with high chance of getting worse in the future.
But, as I realized once the previous post was finished, there’s an opposite side to this solution: place tunnel wall tiles only where there’s a void adjacent to a tunnel tile:
Yup, that’s it. Same result as the previous one. I’m trying to think of how this can break, and it probably can break in some cases, but I can’t think of one now. We’ll have to get back to this once we do find issues in the future.