FS#669 - Docks/Airports/RV Stations can be built without available vehicles.

Attached to Project: OpenTTD
Opened by Celestar (Celestar) - Friday, 09 March 2007, 08:15 GMT
Last edited by Remko Bijker (Rubidium) - Wednesday, 20 June 2007, 08:01 GMT
Type Bug
Category Core
Status Closed
Assigned To No-one
Operating System All
Severity Medium
Priority Normal
Reported Version 0.5.0
Due in Version 0.6.0
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


The game prevents construction of railtypes when no appropriate vehicle is available. However, you can still happily build airports, docks and Bus/Truck stops even if you won't have a suitable vehicle for that station for ages.
This task depends upon

Closed by  Remko Bijker (Rubidium)
Wednesday, 27 June 2007, 14:22 GMT
Reason for closing:  Fixed
Additional comments about closing:  In r10353, though it is optional.
Comment by mindphlux (mindphlux) - Wednesday, 28 March 2007, 12:15 GMT
Attached patch modifies the game to behave as desired in the bug report. Player gets an error message when attempting to build an airport, ship dock or depot, road depot when there are no vehicles available for this building type. Patch includes english and german error messages.

Patch does not include prevention of building a bus or truck stop.
Comment by Celestar (Celestar) - Wednesday, 28 March 2007, 12:23 GMT
a few comments concerning that diff:
1) The check MUST be inside the DoCommand call, because otherwise a modified client will crash a server.
2) the loop should be done using "FOR_ALL_ENGINES".

A question is whether this is the way to go, or just to prevent opening the toolbar in the first place.
Comment by mindphlux (mindphlux) - Wednesday, 28 March 2007, 13:41 GMT
Attached is a new diff:

- loop uses FOR_ALL_ENGINES now
- check is done when clicking the toolbar icons for road/ship/air, if it fails, the toolbar won't be opened
Comment by DaleStan (DaleStan) - Wednesday, 28 March 2007, 15:24 GMT
> road/ship/air
Why is rail not mentioned here? And shouldn't heilports have a different checke than airports?

> +STR_CANT_BUILD_AIRPORT_YET :{WHITE}No aircraft available to build an airport for!
> <...>

Please don't end sentences with a preposition. Is there some reason you didn't just put a period after "available"?
Alternatively, and more in line with TTD's original messages: "Can't build airport here ...n... No aircraft available."
Comment by mindphlux (mindphlux) - Wednesday, 28 March 2007, 15:36 GMT
Rail is not mentioned because that already had the proper check in place. You cannot even open the railroad menu if you have no engines available (at least thats what I found out on the current revision).

Also, my first patch is already replaced by a new version, attached to my second post. There is no error message anymore.
Comment by Chris (Chris) - Monday, 30 April 2007, 17:17 GMT
I didn't know there is a patch already so I started a new one from scratch where I did a few things differently.

- The vehicle lists of not allowed vehicles are not shown (error)
- The build tools (train, ship, air) are not shown when no vehicles are allowed (error)
- The road build tools are shown even when road vehicles can't be built but the buttons for depots, bus and truck stations are disabled

See related forum post: