Difference between revisions of "Callback: Articulated engine"

From GRFSpecs
Jump to navigationJump to search
(more strict var 10/18 masking)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Articulated engine (16) ==
 
== Articulated engine (16) ==
   
This allows building articulated engines or wagons, i.e. vehicles made from several individual vehicles. If this callback is in use, additional vehicles will be added until the callback returns FF.
+
This allows building articulated engines or wagons, i.e. vehicles made from several individual vehicles.
  +
If this callback is in use, additional vehicles will be added as long as the callback says so.
   
  +
{{grfTill|7}} For GRF version 7 and below the return value uses 8 bits.
The callback return is interpreted as the ID of the vehicle to add. If 80 is added to the ID, the vehicle will be reversed (as if Ctrl was held while bought).
+
Bit 0 to 6 define the ID of the vehicle to add. If 80 is added to the ID, the vehicle will be reversed. Returning FF means to finish the articulated vehicle, and not attach more parts.
   
  +
{{grfFrom|8}} For GRF version 8 and above the return value uses 15 bits.
Note that since the train is not yet built, you cannot use train variables in action 2. Instead, use variable 10 (extra callback info 1), which is set to 01 for the first articulated part, 02 for the second and so on.
 
  +
Bit 0 to 13 define the ID of the vehicle to add. If 4000 is added to the ID, the vehicle will be reversed. Returning 7FFF means to finish the articulated vehicle, and not attach more parts.
   
 
Note that since the train is not yet built, you cannot use train variables in action 2. Instead, use the first byte of variable 10 (extra callback info 1), which is set to 01 for the first articulated part, 02 for the second and so on.
{{ottdp| |2.5|ttdprev=beta 8}} If more than the first vehicle contains cargo, the callback must work in the buy menu as well. This means that it will be called with cargo type FF in the action 3. Otherwise, the cargo amount shown in the buy menu will only be for the first part of the articulated vehicle.
 
  +
 
{{ottdp|0.6|2.5|ttdprev=beta 8}} If more than the first vehicle contains cargo, the callback must work in the buy menu as well. This means that it will be called with cargo type FF in the action 3. Otherwise, the cargo amount shown in the buy menu will only be for the first part of the articulated vehicle.
   
 
{{ottd| }} In OpenTTD the cargo class of the first road vehicles is used to determine whether the vehicle can stop at bus or truck stops regardless of the capacity of the first vehicle. If the cargo class bit for passengers is set it can go to bus stops when the is not set it can go to truck stops. See also the page about  [[VehicleRefitting|vehicle refitting]].
 
{{ottd| }} In OpenTTD the cargo class of the first road vehicles is used to determine whether the vehicle can stop at bus or truck stops regardless of the capacity of the first vehicle. If the cargo class bit for passengers is set it can go to bus stops when the is not set it can go to truck stops. See also the page about  [[VehicleRefitting|vehicle refitting]].

Latest revision as of 12:21, 18 April 2015

Articulated engine (16)

This allows building articulated engines or wagons, i.e. vehicles made from several individual vehicles. If this callback is in use, additional vehicles will be added as long as the callback says so.

GRFv≤7 For GRF version 7 and below the return value uses 8 bits. Bit 0 to 6 define the ID of the vehicle to add. If 80 is added to the ID, the vehicle will be reversed. Returning FF means to finish the articulated vehicle, and not attach more parts.

GRFv≥8 For GRF version 8 and above the return value uses 15 bits. Bit 0 to 13 define the ID of the vehicle to add. If 4000 is added to the ID, the vehicle will be reversed. Returning 7FFF means to finish the articulated vehicle, and not attach more parts.

Note that since the train is not yet built, you cannot use train variables in action 2. Instead, use the first byte of variable 10 (extra callback info 1), which is set to 01 for the first articulated part, 02 for the second and so on.

Supported by OpenTTD 0.60.6 Supported by TTDPatch 2.5 (beta 8)2.5 If more than the first vehicle contains cargo, the callback must work in the buy menu as well. This means that it will be called with cargo type FF in the action 3. Otherwise, the cargo amount shown in the buy menu will only be for the first part of the articulated vehicle.

Supported by OpenTTD In OpenTTD the cargo class of the first road vehicles is used to determine whether the vehicle can stop at bus or truck stops regardless of the capacity of the first vehicle. If the cargo class bit for passengers is set it can go to bus stops when the is not set it can go to truck stops. See also the page about  vehicle refitting.