Difference between revisions of "Callback: Engine name"

From GRFSpecs
Jump to navigationJump to search
 
Line 1: Line 1:
 
== Engine name (161) ==
 
== 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.
+
This callback allows you to dynamically determine the name shown for an engine type.
   
  +
{|
{{grfFrom|8}} For GRF version 8 and above you can return 400 to display the engine name from the property (instead of failing the callback).
 
  +
|-
  +
!Return value!!Version!!Meaning
  +
|-
  +
|0000..03FF|| ||D0xx text to display.
  +
|-
  +
|0400||{{grfFrom|8}}||Display regular name from Action4 (same as callback failure).
  +
|-
  +
|040F||{{ottdp|15|no}}||Display text using text ID from register 0x100 (not limited to D0xx texts). The text stack starts at register 0x101.
  +
|}
   
  +
The contents of registers {{ottdp|14|no}} 100h..105h {{ottdp|15|no}} 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.
 
   
 
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.
 
During this callback, variable 10 (extra callback info 1) contains information about the context where the name is shown.

Latest revision as of 13:59, 13 May 2025

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.