Difference between revisions of "Callback: Change vehicle properties"

From GRFSpecs
Jump to navigationJump to search
m (Create a separate page for each callback)
 
(add train property 2E)
 
(9 intermediate revisions by 4 users not shown)
Line 6: Line 6:
   
 
{| |-
 
{| |-
!Feature!!Property!!Minimum version!!OpenTTD rev!!
+
!Feature!!Version!!Property!!Remarks
 
|-
 
|-
|Trains (00)||''07 (Load amount)''|| - || - ||''Changeable via [[Callbacks#Load amount callback 12|callback 12]]''
+
|Trains (00)||{{ottdp|1.2|no}} {{grfFrom|8}}||07 (Load amount)||See also [[Callbacks#Load amount callback 12|callback 12]]
 
|-
 
|-
|||09 (Speed)||2.5 beta 6||r9671||
+
|||{{ottdp|0.6|2.5|ttdprev=beta 6|ottdrev=r9671}}||09 (Speed)||
 
|-
 
|-
|||0B (Power)||2.5 beta 6||r9671||
+
|||{{ottdp|0.6|2.5|ttdprev=beta 6|ottdrev=r9671 }}||0B (Power)||
 
|-
 
|-
|||0D (Running cost factor)||2.6 rev 1420||r9671||
+
|||{{ottdp|0.6|2.6|ttdprev=r1420|ottdrev=r9671}}||0D (Running cost factor)||
 
|-
 
|-
|||14 (Cargo capacity)||2.6 rev 1966||r9828||See also [[Callbacks#Refitted capacity callback 15|callback 15]]
+
|||{{ottdp|0.6|2.6|ttdprev=r1966|ottdrev=r9828}}||14 (Cargo capacity)||See also [[Callbacks#Refitted capacity callback 15|callback 15]]
 
|-
 
|-
|||16 (Weight)||2.6 rev 1887||r9780||
+
|||{{ottdp|0.6|2.5|ttdprev=r1887|ottdrev=r9780}}||16 (Weight)||
 
|-
 
|-
|||17 (Cost factor)|| ||r9806||
+
|||{{ottdp|0.6|no|ottdrev=r9806}}||17 (Cost factor)||
 
|-
 
|-
|||1F (Tractive effort)||2.5 beta 6||r9671||
+
|||{{ottdp|0.6|2.5|ttdprev=beta 6|ottdrev=r9671}}||1F (Tractive effort)||
 
|-
 
|-
  +
|||{{ottdp|1.2|no}} {{grfFrom|8}}||21 (Short wagons) <ref name="onlyindepot">These properties may only change their value when the vehicle is inside a depot. That means, if your vehicle supports autorefit and refitting can change these properties, you must use [[Callback:_Refit_cost_factor|callback 15E]] to prevent the refitting.</ref>||See also [[Callbacks#Wagon length callback 11|callback 11]]
|||''21 (Short wagons)''|| - || - ||''Changeable via [[Callbacks#Wagon length callback 11|callback 11]]''
 
 
|-
 
|-
|||''22 (Visual effect & powered wagons)''|| - || - ||''Changeable via [[Callbacks#Visual effect and wagon power 10|callback 10]]''
+
|||{{ottdp|no|no}}||''22 (Visual effect & powered wagons)''||''Changeable via [[Callbacks#Visual effect and wagon power 10|callback 10]]''
 
|-
 
|-
|||25 (User data)||2.5 beta 6||r11431||
+
|||{{ottdp|0.6|2.5|ttdprev=beta 6|ottdrev=r11431}}||25 (User data)||
 
|-
 
|-
  +
|||{{ottdp|1.2|no|ottdrev=r22713}}||2B (Custom cargo ageing period)||
|Road Vehicles (01)||''07 (Load amount)''|| - || - ||''Changeable via [[Callbacks#Load amount callback 12|callback 12]]''
 
 
|-
 
|-
  +
|||{{ottdp|12|no|ottdrev=g2183fd4dab}}||2E (Maximum curve speed modifier)||
|||09 (Running cost factor)|| ||r18011||
 
 
|-
 
|-
|||0F (Cargo capacity)|| ||r9828||See also [[Callbacks#Refitted capacity callback 15|callback 15]]
+
|Road Vehicles (01)||{{ottdp|1.2|no}} {{grfFrom|8}}||07 (Load amount)||See also [[Callbacks#Load amount callback 12|callback 12]]
 
|-
 
|-
|||11 (Cost factor)|| ||r9806||
+
|||{{ottdp|1.0|no|ottdrev=r18011}}||09 (Running cost factor)||
 
|-
 
|-
 
|||{{ottdp|0.6|no|ottdrev=r9828}}||0F (Cargo capacity)||See also [[Callbacks#Refitted capacity callback 15|callback 15]]
|||13 (Power)|| ||r21058||
 
 
|-
 
|-
  +
|||{{ottdp|0.6|no|ottdrev=r9806}}||11 (Cost factor)||
|||14 (Weight)|| ||r21058||
 
 
|-
 
|-
  +
|||{{ottdp|1.1|no|ottdrev=r21058}}||13 (Power)||
|||15 (Speed)|| ||r21100||
 
 
|-
 
|-
  +
|||{{ottdp|1.1|no|ottdrev=r21058}}||14 (Weight)||
|||18 (Tractive effort)|| ||r21058||
 
 
|-
 
|-
  +
|||{{ottdp|1.1|no|ottdrev=r21100}}||15 (Speed)||
|Ships (02)||''07 (Load amount)''|| - || - ||''Changeable via [[Callbacks#Load amount callback 12|callback 12]]''
 
 
|-
 
|-
  +
|||{{ottdp|1.1|no|ottdrev=r21058}}||18 (Tractive effort)||
|||0A (Cost factor)|| TTDPatch 2.6 rev 1990 ||r9806||
 
 
|-
 
|-
 
|||{{ottdp|no|no}}||''21 (Visual effect)''||''Changeable via [[Callbacks#Visual effect and wagon power 10|callback 10]]''
|||0B (Speed)||2.5 beta 6||r9671||
 
 
|-
 
|-
  +
|||{{ottdp|1.2|no|ottdrev=r22713}}||22 (Custom cargo ageing period)||
|||0D (Cargo capacity)|| TTDPatch 2.6 rev 1990 ||r9828||See also [[Callbacks#Refitted capacity callback 15|callback 15]]
 
 
|-
 
|-
 
|||{{ottdp|1.2|no}} {{grfFrom|8}}||23 (Short wagons)<ref name="onlyindepot"/>||See also [[Callbacks#Wagon length callback 11|callback 11]]
|||0F (Running cost factor)|| TTDPatch 2.6 rev 1510 ||r9808||
 
 
|-
 
|-
|Planes (03)||''07 (Load amount)''|| - || - ||''Changeable via [[Callbacks#Load amount callback 12|callback 12]]''
+
|Ships (02)||{{ottdp|1.2|no}} {{grfFrom|8}}||07 (Load amount)||See also [[Callbacks#Load amount callback 12|callback 12]]
 
|-
 
|-
|||0B (Cost factor)|| ||r9806||
+
|||{{ottdp|0.6|2.6|ttdprev=r1990|ottdrev=r9806}}||0A (Cost factor)||
 
|-
 
|-
|||0C (Speed)||2.5 beta 6||r9671||
+
|||{{ottdp|0.6|2.5|ttdprev=beta 6|ottdrev=r9671}}||0B (Speed)||
 
|-
 
|-
 
|||{{ottdp|0.6|2.6|ttdprev=r1990|ottdrev=r9828}}||0D (Cargo capacity)||See also [[Callbacks#Refitted capacity callback 15|callback 15]]
|||0E (Running cost factor)||2.6 r1507||r9678||
 
 
|-
 
|-
  +
|||{{ottdp|0.6|2.6|ttdprev=r1510|ottdrev=r9808}}||0F (Running cost factor)||
|||0F (Passenger capacity)|| ||r19218||See also [[Callbacks#Refitted capacity callback 15|callback 15]]
 
 
|-
 
|-
  +
|||{{ottdp|no|no}}||''1C (Visual effect)''||''Changeable via [[Callbacks#Visual effect and wagon power 10|callback 10]]''
|||11 (Mail capacity)|| ||r19218||
 
  +
|-
  +
|||{{ottdp|1.2|no|ottdrev=r22713}}||1D (Custom cargo ageing period)||
  +
|-
 
|Planes (03)||{{ottdp|1.2|no}} {{grfFrom|8}}||07 (Load amount)||See also [[Callbacks#Load amount callback 12|callback 12]]
  +
|-
  +
|||{{ottdp|0.6|no|ottdrev=r9806}}||0B (Cost factor)||
  +
|-
  +
|||{{ottdp|0.6|2.5|ttdprev=beta 6|ottdrev=r9671}}||0C (Speed)||
  +
|-
  +
|||{{ottdp|0.6|2.6|ttdprev=r1507|ottdrev=r9678}}||0E (Running cost factor)||
  +
|-
  +
|||{{ottdp|1.0|no|ottdrev=r19218}}||0F (Primary cargo capacity)||See also [[Callbacks#Refitted capacity callback 15|callback 15]]
  +
|-
  +
|||{{ottdp|1.0|no|ottdrev=r19218}}||11 (Secondary cargo capacity)||
  +
|-
  +
|||{{ottdp|1.2|no|ottdrev=r22713}}||1C (Custom cargo ageing period)||
  +
|-
  +
|||{{ottdp|1.2|no|ottdrev=r23504}}||1F (Aircraft range)||
 
|}
 
|}
  +
  +
<references/>
   
 
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.
 
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.
Line 75: Line 95:
 
Before r1758 (both 2.5 and TTDPatch 2.6), [[Callbacks#Change vehicle properties (36) |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.
 
Before r1758 (both 2.5 and TTDPatch 2.6), [[Callbacks#Change vehicle properties (36) |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 &nbsp;[[VehicleRefitting|vehicle refitting]].
+
About the capacity properties see also the summary page about [[VehicleRefitting|vehicle refitting]].
 
[[Category:Callbacks]]
 
[[Category:Callbacks]]

Latest revision as of 17:55, 23 August 2021

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 Version Property Remarks
Trains (00) Supported by OpenTTD 1.21.2 Not supported by TTDPatch GRFv≥8 07 (Load amount) See also callback 12
Supported by OpenTTD 0.6 (r9671)0.6 Supported by TTDPatch 2.5 (beta 6)2.5 09 (Speed)
Supported by OpenTTD 0.6 (r9671)0.6 Supported by TTDPatch 2.5 (beta 6)2.5 0B (Power)
Supported by OpenTTD 0.6 (r9671)0.6 Supported by TTDPatch 2.6 (r1420)2.6 0D (Running cost factor)
Supported by OpenTTD 0.6 (r9828)0.6 Supported by TTDPatch 2.6 (r1966)2.6 14 (Cargo capacity) See also callback 15
Supported by OpenTTD 0.6 (r9780)0.6 Supported by TTDPatch 2.5 (r1887)2.5 16 (Weight)
Supported by OpenTTD 0.6 (r9806)0.6 Not supported by TTDPatch 17 (Cost factor)
Supported by OpenTTD 0.6 (r9671)0.6 Supported by TTDPatch 2.5 (beta 6)2.5 1F (Tractive effort)
Supported by OpenTTD 1.21.2 Not supported by TTDPatch GRFv≥8 21 (Short wagons) [1] See also callback 11
Not supported by OpenTTD Not supported by TTDPatch 22 (Visual effect & powered wagons) Changeable via callback 10
Supported by OpenTTD 0.6 (r11431)0.6 Supported by TTDPatch 2.5 (beta 6)2.5 25 (User data)
Supported by OpenTTD 1.2 (r22713)1.2 Not supported by TTDPatch 2B (Custom cargo ageing period)
Supported by OpenTTD 12 (g2183fd4dab)12 Not supported by TTDPatch 2E (Maximum curve speed modifier)
Road Vehicles (01) Supported by OpenTTD 1.21.2 Not supported by TTDPatch GRFv≥8 07 (Load amount) See also callback 12
Supported by OpenTTD 1.0 (r18011)1.0 Not supported by TTDPatch 09 (Running cost factor)
Supported by OpenTTD 0.6 (r9828)0.6 Not supported by TTDPatch 0F (Cargo capacity) See also callback 15
Supported by OpenTTD 0.6 (r9806)0.6 Not supported by TTDPatch 11 (Cost factor)
Supported by OpenTTD 1.1 (r21058)1.1 Not supported by TTDPatch 13 (Power)
Supported by OpenTTD 1.1 (r21058)1.1 Not supported by TTDPatch 14 (Weight)
Supported by OpenTTD 1.1 (r21100)1.1 Not supported by TTDPatch 15 (Speed)
Supported by OpenTTD 1.1 (r21058)1.1 Not supported by TTDPatch 18 (Tractive effort)
Not supported by OpenTTD Not supported by TTDPatch 21 (Visual effect) Changeable via callback 10
Supported by OpenTTD 1.2 (r22713)1.2 Not supported by TTDPatch 22 (Custom cargo ageing period)
Supported by OpenTTD 1.21.2 Not supported by TTDPatch GRFv≥8 23 (Short wagons)[1] See also callback 11
Ships (02) Supported by OpenTTD 1.21.2 Not supported by TTDPatch GRFv≥8 07 (Load amount) See also callback 12
Supported by OpenTTD 0.6 (r9806)0.6 Supported by TTDPatch 2.6 (r1990)2.6 0A (Cost factor)
Supported by OpenTTD 0.6 (r9671)0.6 Supported by TTDPatch 2.5 (beta 6)2.5 0B (Speed)
Supported by OpenTTD 0.6 (r9828)0.6 Supported by TTDPatch 2.6 (r1990)2.6 0D (Cargo capacity) See also callback 15
Supported by OpenTTD 0.6 (r9808)0.6 Supported by TTDPatch 2.6 (r1510)2.6 0F (Running cost factor)
Not supported by OpenTTD Not supported by TTDPatch 1C (Visual effect) Changeable via callback 10
Supported by OpenTTD 1.2 (r22713)1.2 Not supported by TTDPatch 1D (Custom cargo ageing period)
Planes (03) Supported by OpenTTD 1.21.2 Not supported by TTDPatch GRFv≥8 07 (Load amount) See also callback 12
Supported by OpenTTD 0.6 (r9806)0.6 Not supported by TTDPatch 0B (Cost factor)
Supported by OpenTTD 0.6 (r9671)0.6 Supported by TTDPatch 2.5 (beta 6)2.5 0C (Speed)
Supported by OpenTTD 0.6 (r9678)0.6 Supported by TTDPatch 2.6 (r1507)2.6 0E (Running cost factor)
Supported by OpenTTD 1.0 (r19218)1.0 Not supported by TTDPatch 0F (Primary cargo capacity) See also callback 15
Supported by OpenTTD 1.0 (r19218)1.0 Not supported by TTDPatch 11 (Secondary cargo capacity)
Supported by OpenTTD 1.2 (r22713)1.2 Not supported by TTDPatch 1C (Custom cargo ageing period)
Supported by OpenTTD 1.2 (r23504)1.2 Not supported by TTDPatch 1F (Aircraft range)
  1. 1.0 1.1 These properties may only change their value when the vehicle is inside a depot. That means, if your vehicle supports autorefit and refitting can change these properties, you must use callback 15E to prevent the refitting.

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.