Callback: Engine name

From GRFSpecs
Revision as of 22:20, 30 January 2023 by Michi cc (talk | contribs) (Engine name callback)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Engine name (161)

This callback allows you to dynamically determine the name shown for an engine type. The return value should be the number of a D0xx text to be displayed. The contents of registers 100h..105h are copied onto the text reference stack and can be used with string codes 80/81 to show texts from the D8xx range as well, extending the available unique strings.

GRFv≥8 For GRF version 8 and above you can return 400 to display the engine name from the property (instead of failing the callback).

The callback is run in purchase list scope, i.e. for cargotype FF. No variables of an actual vehicle are available.


During this callback, variable 10 (extra callback info 1) contains information about the context where the name is shown.

Bits 0 - 7 of variable 10[1] Meaning
00 No specific context is avaible.
01..10 reserved
11 Name is shown in the vehicle details GUI. (This includes the refit GUI.)
12..1F reserved for other future GUIs.
20 Vehicle is drawn in the purchase list. (This includes the autoreplace GUI.)
Bits 8 - 15 contain the indentation level in the list, e.g. when using vehicle variants.
21 Vehicle is drawn in the exclusive preview GUI or in the advertisement news.
22..2F reserved for other future GUIs with non-purchased vehicles.
30..FF reserved

This callback is available from Supported by OpenTTD 14 (g05ed9f56fd)14 Not supported by TTDPatch OpenTTD 14 and above.

  1. Values correspond to the values used for sprite drawing.