Difference between revisions of "Callback: Decide input and output cargo types"

From GRFSpecs
Jump to navigationJump to search
m (OpenTTD version that supports callbacks 14B 14C)
Line 15: Line 15:
 
Although currently [[Callbacks#Decide input and output cargo types (14B,14C) |callback 14B]] is called no more than three times, and [[Callbacks#Decide input and output cargo types (14B,14C) |callback 14C]] no more than twice, this may change between versions/implementations, to allow more input/output types. To be safe, you should return FFh as the last element even when you use all three input types or both output types.
 
Although currently [[Callbacks#Decide input and output cargo types (14B,14C) |callback 14B]] is called no more than three times, and [[Callbacks#Decide input and output cargo types (14B,14C) |callback 14C]] no more than twice, this may change between versions/implementations, to allow more input/output types. To be safe, you should return FFh as the last element even when you use all three input types or both output types.
   
These callbacks are available from {{ttdp|2.6}} TTDPatch 2.6 r1718 and above
+
These callbacks are available from {{ottd|0.6|r11177}} OpenTTD r11177 and {{ttdp|2.6}} TTDPatch 2.6 r1718 and above
   
 
[[Category:Callbacks]]
 
[[Category:Callbacks]]

Revision as of 13:51, 28 September 2015

Decide input and output cargo types (14B,14C)

These callbacks are called when the industry is built, and allow customizing the input and output cargo types dynamically. Both callbacks are called repeatedly, with the lowest byte of variable 10 starting from zero and increasing after every call; you should return a cargo type each time, or FFh to terminate the list. (A failed callback terminates the list, too.) The same limitations apply as for callback 14A: industry tiles aren't yet placed, and some industry variables contain junk. You can use random action2s, however. The interpretation of the returned value depends on two factors: the current GRF version number and the presence of a cargo translation table:

GRF version Has cargo translation table Interpretation
6 or below Climate-dependent cargo slot number
7 or above No Cargo bit
7 or above Yes Index in the translation table

Although currently callback 14B is called no more than three times, and callback 14C no more than twice, this may change between versions/implementations, to allow more input/output types. To be safe, you should return FFh as the last element even when you use all three input types or both output types.

These callbacks are available from Supported by OpenTTD 0.6 (r11177)0.6 OpenTTD r11177 and Supported by TTDPatch 2.62.6 TTDPatch 2.6 r1718 and above