Difference between revisions of "Callback: Engine name"
From GRFSpecs
Jump to navigationJump to search (Engine name callback) |
Brickblock1 (talk | contribs) |
||
(4 intermediate revisions by one other user not shown) | |||
Line 21: | Line 21: | ||
| 12..1F || reserved for other future GUIs. |
| 12..1F || reserved for other future GUIs. |
||
|- |
|- |
||
− | | 20 || Vehicle is drawn in the purchase list. (This includes the autoreplace GUI.)<br>Bits '''8 - 15''' contain the indentation level in the list, e.g. when using vehicle variants. |
+ | | 20 || Vehicle is drawn in the purchase list. (This includes the "Available vehicles" panel of autoreplace GUI.)<br>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. |
| 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. |
||
⚫ | |||
+ | |- |
||
⚫ | |||
|- |
|- |
||
| 30..FF || reserved |
| 30..FF || reserved |
||
|} |
|} |
||
+ | |||
+ | |||
+ | <references/> |
||
+ | |||
This callback is available from {{ottdp|14|no|ottdrev=g05ed9f56fd}} OpenTTD 14 and above. |
This callback is available from {{ottdp|14|no|ottdrev=g05ed9f56fd}} OpenTTD 14 and above. |
Latest revision as of 20:53, 30 November 2023
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 |
- ↑ Values correspond to the values used for sprite drawing.