Callback: Engine name
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 "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 |
This callback is available from 14 OpenTTD 14 and above.
- ↑ Values correspond to the values used for sprite drawing.