Difference between revisions of "Callback: Vehicle Start/stop check"

From GRFSpecs
Jump to navigationJump to search
m (Create a separate page for each callback)
 
(grf version 8)
Line 5: Line 5:
 
bit 1 of variable B2. If set, the vehicle is currently stopped and if clear, the vehicle is moving (or at least, not stopped manually).
 
bit 1 of variable B2. If set, the vehicle is currently stopped and if clear, the vehicle is moving (or at least, not stopped manually).
   
  +
{{grf|7}} For GRF version 7 and below the valid return values are:
The return value is a D0xx text to use as second line of an error message, or FF to indicate that the start/stop action should succeed.
 
  +
{| |-
  +
|00..FE|| Display error message using D0xx (D000..D0FE) text as second line.
  +
|-
  +
|FF|| Start/stop action shall succeed.
  +
|-
  +
|100..1FE|| Display error message using D0xx (D100..D1FE) text as second line.
  +
|-
  +
|200..2FE|| Display error message using D0xx (D200..D2FE) text as second line.
  +
|-
  +
|300..3FE|| Display error message using D0xx (D300..D3FE) text as second line.
  +
|}
  +
  +
{{grf|8}} For GRF version 8 and above the valid return values are:
  +
{| |-
  +
|00..3FF|| Display error message using D0xx (D000..D3FF) text as second line.
  +
|-
  +
|400|| Start/stop action shall succeed.
  +
|}
  +
 
The callback is always used when defined, no bit in the action 0 property needs to be set to activate it.
 
The callback is always used when defined, no bit in the action 0 property needs to be set to activate it.
  +
 
[[Category:Callbacks]]
 
[[Category:Callbacks]]

Revision as of 00:57, 9 November 2011

Vehicle Start/stop check (31)

This callback is called whenever a player (or the AI) tries to start or stop a vehicle. This is mainly useful for preventing vehicles from leaving the depot unless a given condition is met. To check whether a vehicle is being started or stopped, check bit 1 of variable B2. If set, the vehicle is currently stopped and if clear, the vehicle is moving (or at least, not stopped manually).

GRFv7 For GRF version 7 and below the valid return values are:

00..FE Display error message using D0xx (D000..D0FE) text as second line.
FF Start/stop action shall succeed.
100..1FE Display error message using D0xx (D100..D1FE) text as second line.
200..2FE Display error message using D0xx (D200..D2FE) text as second line.
300..3FE Display error message using D0xx (D300..D3FE) text as second line.

GRFv8 For GRF version 8 and above the valid return values are:

00..3FF Display error message using D0xx (D000..D3FF) text as second line.
400 Start/stop action shall succeed.

The callback is always used when defined, no bit in the action 0 property needs to be set to activate it.