Difference between revisions of "Callback: Change vehicle properties"

From GRFSpecs
Jump to navigationJump to search
(Add notes about RV prop 21 and ship prop 1C being changable via CB 10)
(→‎Change vehicle properties (36): Custom cargo ageing)
Line 29: Line 29:
 
|-
 
|-
 
|||25 (User data)||2.5 beta 6||r11431||
 
|||25 (User data)||2.5 beta 6||r11431||
  +
|-
  +
|||2B (Custom cargo ageing period)|| - ||r22713||
 
|-
 
|-
 
|Road Vehicles (01)||''07 (Load amount)''|| - || - ||''Changeable via [[Callbacks#Load amount callback 12|callback 12]]''
 
|Road Vehicles (01)||''07 (Load amount)''|| - || - ||''Changeable via [[Callbacks#Load amount callback 12|callback 12]]''
Line 47: Line 49:
 
|-
 
|-
 
|||''21 (Visual effect)''|| - || - ||''Changeable via [[Callbacks#Visual effect and wagon power 10|callback 10]]''
 
|||''21 (Visual effect)''|| - || - ||''Changeable via [[Callbacks#Visual effect and wagon power 10|callback 10]]''
  +
|-
  +
|||22 (Custom cargo ageing period)|| - ||r22713||
 
|-
 
|-
 
|Ships (02)||''07 (Load amount)''|| - || - ||''Changeable via [[Callbacks#Load amount callback 12|callback 12]]''
 
|Ships (02)||''07 (Load amount)''|| - || - ||''Changeable via [[Callbacks#Load amount callback 12|callback 12]]''
Line 59: Line 63:
 
|-
 
|-
 
|||''1C (Visual effect)''|| - || - ||''Changeable via [[Callbacks#Visual effect and wagon power 10|callback 10]]''
 
|||''1C (Visual effect)''|| - || - ||''Changeable via [[Callbacks#Visual effect and wagon power 10|callback 10]]''
  +
|-
  +
|||1D (Custom cargo ageing period)|| - ||r22713||
 
|-
 
|-
 
|Planes (03)||''07 (Load amount)''|| - || - ||''Changeable via [[Callbacks#Load amount callback 12|callback 12]]''
 
|Planes (03)||''07 (Load amount)''|| - || - ||''Changeable via [[Callbacks#Load amount callback 12|callback 12]]''
Line 71: Line 77:
 
|-
 
|-
 
|||11 (Mail capacity)|| ||r19218||
 
|||11 (Mail capacity)|| ||r19218||
  +
|-
  +
|||1C (Custom cargo ageing period)|| - ||r22713||
 
|}
 
|}
   

Revision as of 21:12, 3 August 2011

Change vehicle properties (36)

This common callback allows modification of certain properties of a vehicle for which there exists no specific callback (like CBs 10, 11, 12). The low byte of variable 10 holds the property number from Action 0.

The following properties are supported:

Feature Property Minimum version OpenTTD rev
Trains (00) 07 (Load amount) - - Changeable via callback 12
09 (Speed) 2.5 beta 6 r9671
0B (Power) 2.5 beta 6 r9671
0D (Running cost factor) 2.6 rev 1420 r9671
14 (Cargo capacity) 2.6 rev 1966 r9828 See also callback 15
16 (Weight) 2.6 rev 1887 r9780
17 (Cost factor) r9806
1F (Tractive effort) 2.5 beta 6 r9671
21 (Short wagons) - - Changeable via callback 11
22 (Visual effect & powered wagons) - - Changeable via callback 10
25 (User data) 2.5 beta 6 r11431
2B (Custom cargo ageing period) - r22713
Road Vehicles (01) 07 (Load amount) - - Changeable via callback 12
09 (Running cost factor) r18011
0F (Cargo capacity) r9828 See also callback 15
11 (Cost factor) r9806
13 (Power) r21058
14 (Weight) r21058
15 (Speed) r21100
18 (Tractive effort) r21058
21 (Visual effect) - - Changeable via callback 10
22 (Custom cargo ageing period) - r22713
Ships (02) 07 (Load amount) - - Changeable via callback 12
0A (Cost factor) TTDPatch 2.6 rev 1990 r9806
0B (Speed) 2.5 beta 6 r9671
0D (Cargo capacity) TTDPatch 2.6 rev 1990 r9828 See also callback 15
0F (Running cost factor) TTDPatch 2.6 rev 1510 r9808
1C (Visual effect) - - Changeable via callback 10
1D (Custom cargo ageing period) - r22713
Planes (03) 07 (Load amount) - - Changeable via callback 12
0B (Cost factor) r9806
0C (Speed) 2.5 beta 6 r9671
0E (Running cost factor) 2.6 r1507 r9678
0F (Passenger capacity) r19218 See also callback 15
11 (Mail capacity) r19218
1C (Custom cargo ageing period) - r22713

Most properties will only change when the vehicle is bought, serviced (enters a depot), visits a station or on loading of a saved game. Other ones such as TE are called every time a TE calculation is run.

If the callback fails, the corresponding value from the action 0 property will be used. The callback is always used when defined, no bit in the action 0 property needs to be set to activate it.

Before r1758 (both 2.5 and TTDPatch 2.6), callback 36 was sometimes called with the 40+x and 80+x variables unavailable when they should have been available, or with not all 80+x variables properly initialized, causing some 40+x variables to be unsafe.

About the capacity properties see also the summary page about  vehicle refitting.