Callback: Engine name

From GRFSpecs
Revision as of 13:59, 13 May 2025 by Frosch (talk | contribs) (→‎Engine name (161))
(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.

Return value Version Meaning
0000..03FF D0xx text to display.
0400 GRFv≥8 Display regular name from Action4 (same as callback failure).
040F Supported by OpenTTD 1515 Not supported by TTDPatch Display text using text ID from register 0x100 (not limited to D0xx texts). The text stack starts at register 0x101.

The contents of registers Supported by OpenTTD 1414 Not supported by TTDPatch 100h..105h Supported by OpenTTD 1515 Not supported by TTDPatch 100h..10Fh 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.

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 "Available vehicles" panel of 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 Vehicle is drawn in the "Vehicles in use" panel of autoreplace GUI.
23..2F reserved for other future GUIs with non-purchased vehicles.
30..FF reserved


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


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