Callback: Cargo Subtype Display

From GRFSpecs
Jump to navigationJump to search

Cargo Subtype Display (19)

This callback allows you to display some text after the cargo name when refitting, and in the vehicle capacity display. This is useful to distinguish several subtypes of a certain cargo, e.g. goods could be cars, petroleum, sheet metal etc.

The return value must be the number of a D0xx string set by an action 4 in the same .grf file.  For example, if you set text ID D006 to some text, return 06 in this callback will make it displayed after the cargo name.

Normally, you would use the vehicle refit cycle/sub type variable F2 to distinguish the various subtypes.  During refitting, the callback is called with successively increased values of variable F2, until the callback says to stop.  All the returned variations are then displayed as refitting options, with all options that have the same cargo type and callback result (irrespective of refit cycle) grouped together in the same line.

GRFv≤7 For GRF version 7 and below the valid return values are:

00..FE Use subtype from text D0xx (D000..D0FE)
FF Stop calling.

GRFv≥8 For GRF version 8 and above the valid return values are:

00..3FF Use subtype from text D0xx (D000..D3FF)
400 Stop calling.