Callback: Vehicle Start/stop check

From GRFSpecs
Revision as of 13:36, 13 May 2025 by Frosch (talk | contribs) (→‎Vehicle Start/stop check (31))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

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).

GRFv≤7 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.

GRFv≥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.
40F Supported by OpenTTD 1515 Not supported by TTDPatch Display error message using text ID from register 0x100. (not limited to D0xx texts)

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