Motivation / Problem
In mountainous terrain, OpenTTD towns build roads up and over tall mountains, which often looks silly. Tunneling looks better while still allowing the town to grow.
Also, building a rail line on a raised embankment when
A town can build a tunnel through a mountain if the uphill slope is 4 or more tiles, and the length of the tunnel is within the limit. This limit begins at 8 tiles, the minimum for tunneling through a mountain which has 4 uphill tiles on each side, and increases by 1 for every 1,000 population, as in #8439.
When building under obstructions, the length limit is 5, enough to tunnel under a four-track railway.
I have created a test savegame to check most scenarios I could think of: Town_Tunnel_Test_1.zip
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.
I have tested and can confirm that deleting towns in Scenario Editor works fine. GameScripts which delete roads during gameplay, such as Migrations, also work properly when deleting tunnels constructed by a town.