FS#1769 - Incorrect capacity of articulated vehicles displayed in buy menu.

Attached to Project: OpenTTD
Opened by Richard Wheeler (Zephyris) - Wednesday, 13 February 2008, 19:45 GMT
Type Bug
Category Vehicles → Articulated
Status Closed
Assigned To No-one
Operating System All
Severity High
Priority Normal
Reported Version 0.5.3
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Callbacks for articulated vehicles do not work in the buy menu, resulting in the incorrect cargo capacity being displayed. The capacity of the first vehicle, not the total capacity, is displayed. The callback is not used, even if the cargo type FF (in the action3) directly targets the callback. The GRF specifications (Articulated engine callback (16), state that the behaviour in TTDPatch is to use the callback to adjust the buy menu graphics.

It would be consistent to show the cargo capacity of the total articulated consist in the buy menu. Currently the total capacity of a double headed train is shown, and it would be good if articulated vehicles shared this behaviour.
This task depends upon

Closed by  Peter Nelson (peter1138)
Thursday, 14 February 2008, 07:25 GMT
Reason for closing:  Fixed
Additional comments about closing:  All three work in r12137
Comment by Peter Nelson (peter1138) - Wednesday, 13 February 2008, 22:35 GMT
Do you have a test GRF, please?
Comment by Richard Wheeler (Zephyris) - Thursday, 14 February 2008, 00:27 GMT
Here are three subtly different examples to test different coding styles. The vehicle is a tram introduced in 2009 in all climates. The cargo capacity is 50 passengers per carriage, 3 cars so 150 total.

action3 targets the callback test action2 both for cargo type FF (buy menu graphics) and as the default.
This results in an error from nforenum, so I am not certain it is valid code.

action3 targets a callback test action2 for the cargo type FF, and a different callback test action2 as the default.
This is a somewhat convoluted way I used to try and force the buy menu graphics to go via the callback.

action3 has no cargo specific graphics, and targets a callback test action2 as the default.
This is the basic coding style, I would still expect the callback to be called for the buy menu.