New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add: Towns can build tunnels #8473
Conversation
781ddfc
to
e6829c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall code looks good; haven't tested the PR yet, will do that after the fixes :)
Owh, would you mind checking if deleting towns works as expected? I remember vaguely there is code for bridges to make sure that towns that grew beyond bridges also clean up correctly. This is needed for map generation, if I remember correctly :) Tnx! |
Sure, I can take a look in scenario editor. I'll also have to check the Migrations GS, which shrinks towns and leaves bridges behind (on purpose). Need to make sure that won't crash the game. |
e6829c0
to
8729b64
Compare
8729b64
to
7f333df
Compare
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks absolutely amazing! Well done :)
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
Towns can build level crossings
is off blocks town growth since it cannot bridge over the tracks. Now, towns can also tunnel under these and other obstructions.Description
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
Limitations
Although my code closely mirrorsThis is a bug in Change: Towns don't build dead-end road bridges #8401 and will be fixed in a separate PR.GrowTownWithBridge()
and checks the next tile after the tunnel as I added in Change: Towns don't build dead-end road bridges #8401, it doesn't recognize road stations as a valid next tile. But bridges are fine, even when constructed by a player company. I'm not sure what's going on here and would appreciate some help.Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.