FS#3993 - vehicle limit is not a hard limit

Attached to Project: OpenTTD
Opened by Thijs Marinussen (Yexo) - Saturday, 31 July 2010, 01:00 GMT
Last edited by Alberth (Alberth) - Friday, 06 August 2010, 20:30 GMT
Type Bug
Category Core
Status Closed
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version Version?
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Code used to check if there are already too many trains:
UnitID unit_num = (flags & DC_AUTOREPLACE) ? 0 : GetFreeUnitNumber(VEH_TRAIN);
if (unit_num > _settings_game.vehicle.max_trains) {

This is wrong because if the setting is lowered then there might be gaps in the unit numbers which can allow you to build new trains even though you're already over the (new) limit.
This task depends upon

Closed by  Alberth (Alberth)
Friday, 06 August 2010, 20:30 GMT
Reason for closing:  Implemented
Additional comments about closing:  in r20391, r20392, and r20393
Comment by TruePikachu (TruePikachu) - Saturday, 31 July 2010, 01:07 GMT
Probably can be fixed by comparing the limit against the value which sources the company statistics (number of each vehical)