Difference between revisions of "VariationalAction2/BaseStation"

From GRFSpecs
Jump to navigationJump to search
m (→‎Variables: column order and broken link)
(Move version info into variable table)
Line 7: Line 7:
 
!Variable!![[GRFActionsDetailed|'''Size''']]!!Version!!Description
 
!Variable!![[GRFActionsDetailed|'''Size''']]!!Version!!Description
 
|-
 
|-
|48||D||{{ottdp| | }}||Bitmask of accepted cargos
+
|48||D||{{ottdp| |2.5|ttdprev=alpha 55 vcs 3}}||Bitmask of accepted cargos
 
|-
 
|-
|60||D||{{ottdp| | }}||Amount of cargo waiting
+
|60||D||{{ottdp| |2.5|ttdprev=alpha 55 vcs 3}}||Amount of cargo waiting
 
|-
 
|-
|61||D||{{ottdp| | }}||Time since the cargo was last picked up
+
|61||D||{{ottdp| |2.5|ttdprev=alpha 55 vcs 3}}||Time since the cargo was last picked up
 
|-
 
|-
|62||D||{{ottdp| | }}||Rating of the cargo
+
|62||D||{{ottdp| |2.5|ttdprev=alpha 55 vcs 3}}||Rating of the cargo
 
|-
 
|-
|63||D||{{ottdp| | }}||Time spent en-route
+
|63||D||{{ottdp| |2.5|ttdprev=alpha 55 vcs 3}}||Time spent en-route
 
|-
 
|-
|64||W||{{ottdp| | }}||Information about the last vehicle picking this cargo up
+
|64||W||{{ottdp| |2.5|ttdprev=alpha 55 vcs 3}}||Information about the last vehicle picking this cargo up
 
|-
 
|-
|65||B||{{ottdp| | }}||Amount of cargo acceptance
+
|65||B||{{ottdp| |2.5|ttdprev=beta 2}}||Amount of cargo acceptance
 
|-
 
|-
 
|69||D||{{ottdp| | }}||Information about cargo accepted in the past
 
|69||D||{{ottdp| | }}||Information about cargo accepted in the past
Line 35: Line 35:
   
 
=== Bitmask of accepted cargos (48) ===
 
=== Bitmask of accepted cargos (48) ===
 
(This variable is available from TTDPatch 2.0.1 alpha 55 vcs 3 only)
 
   
 
Returns a doubleword where the '''n'''th bit is set if and only if the station accepts the cargo whose climate-dependent ID is '''n'''. If newcargos is off, bits 12..31 are guaranteed to be zero. If you need to check acceptance for a climate-independent ID, you can use variable 65 instead.
 
Returns a doubleword where the '''n'''th bit is set if and only if the station accepts the cargo whose climate-dependent ID is '''n'''. If newcargos is off, bits 12..31 are guaranteed to be zero. If you need to check acceptance for a climate-independent ID, you can use variable 65 instead.
 
'''NOTE''':Variables 60..64 are available from TTDPatch 2.0.1 alpha 55 vcs 3 only!
 
   
 
=== Amount of cargo waiting (60) ===
 
=== Amount of cargo waiting (60) ===
Line 63: Line 59:
   
 
=== Amount of cargo acceptance (65) ===
 
=== Amount of cargo acceptance (65) ===
 
(From TTDPatch 2.5 beta 2)
 
   
 
The parameter is a cargo number (see note below). The return value contains the acceptance of the given cargo type in 1/8 units. The station accepts the cargo if its acceptance is at least 8/8 units. Without newcargos, the returned value is between 0 and 15 (inclusive). With newcargos enabled, the return value is either 8 or 0.
 
The parameter is a cargo number (see note below). The return value contains the acceptance of the given cargo type in 1/8 units. The station accepts the cargo if its acceptance is at least 8/8 units. Without newcargos, the returned value is between 0 and 15 (inclusive). With newcargos enabled, the return value is either 8 or 0.

Revision as of 20:59, 1 August 2011

Introduction to Base Stations

This page lists the variables common to all station types, currently (rail) stations and airports

Variables

Variable Size Version Description
48 D Supported by OpenTTD Supported by TTDPatch 2.5 (alpha 55 vcs 3)2.5 Bitmask of accepted cargos
60 D Supported by OpenTTD Supported by TTDPatch 2.5 (alpha 55 vcs 3)2.5 Amount of cargo waiting
61 D Supported by OpenTTD Supported by TTDPatch 2.5 (alpha 55 vcs 3)2.5 Time since the cargo was last picked up
62 D Supported by OpenTTD Supported by TTDPatch 2.5 (alpha 55 vcs 3)2.5 Rating of the cargo
63 D Supported by OpenTTD Supported by TTDPatch 2.5 (alpha 55 vcs 3)2.5 Time spent en-route
64 W Supported by OpenTTD Supported by TTDPatch 2.5 (alpha 55 vcs 3)2.5 Information about the last vehicle picking this cargo up
65 B Supported by OpenTTD Supported by TTDPatch 2.5 (beta 2)2.5 Amount of cargo acceptance
69 D Supported by OpenTTD Supported by TTDPatch Information about cargo accepted in the past
F0 B Supported by OpenTTD Supported by TTDPatch Bit mask of facilities attached to station (not appropriate for irregular stations)
FA W Supported by OpenTTD Supported by TTDPatch Date when station was built in days since 1920

For other 80+x variables confer the TTD station structure. Note that you have to subtract 0x10 from the offsets there, or else the facility bit mask and construction date would not be accessible; instead you lose access to variables 00..0F which are meaningless anyway.

WARNING: Please do not use variables 8C..EB directly. The meaning of these variables changes if the newcargos switch is on. Use the variables 60..64 instead (see the specific station type's description). Those always work correctly.

Description

Bitmask of accepted cargos (48)

Returns a doubleword where the nth bit is set if and only if the station accepts the cargo whose climate-dependent ID is n. If newcargos is off, bits 12..31 are guaranteed to be zero. If you need to check acceptance for a climate-independent ID, you can use variable 65 instead.

Amount of cargo waiting (60)

The parameter is a cargo number (see note below). Currently, the returned value is between 0 and 32767, but this may later change to support the range -32768..32767.

Time since the cargo was last picked up (61)

The parameter is a cargo number (see note below). The unit is 185 ticks (approx. 2.5 TTD days). If the given type has never been seen on the station, the returned value is zero, otherwise, the return value isn't larger than 255.

Rating of the cargo (62)

The parameter is a cargo number (see note below). The returned value is between 0 and 255 (255 means 100% rating), or FFFFFFFFh if the cargo is unrated.

Time spent en-route (63)

The parameter is a cargo number (see note below). Returns the time elapsed since the cargo appeared on a station. If the cargo has never been seen on the station, the returned value is 0, otherwise it's between 0 and 255. The unit is 185 ticks (approx. 2.5 TTD days).

Information about the last vehicle picking this cargo up (64)

The parameter is a cargo number (see note below). Bits 0..7 contain the speed of the last vehicle, while bits 8..15 contain the age of the last vehicle in years. If no vehicle has attempted to pick up this cargo yet, the result is FF00h.

Amount of cargo acceptance (65)

The parameter is a cargo number (see note below). The return value contains the acceptance of the given cargo type in 1/8 units. The station accepts the cargo if its acceptance is at least 8/8 units. Without newcargos, the returned value is between 0 and 15 (inclusive). With newcargos enabled, the return value is either 8 or 0.

NOTE: In GRF version 6, parametrized variables 60..65 accept a climate-dependent cargo number. In GRF version 7 and later, these variables accept a climate-independent cargo ID. If your GRF has a cargo translation table, then this ID is the index in that table; otherwise, it's the cargo bit.

Information about cargo accepted in the past (69)

The parameter of this variable has the same format as for variables 60..65. The returned value looks like this:

Bits Meaning
0 Set if the given cargo was ever accepted at this station
1 Set if the given cargo was accepted last month
2 Set if the given cargo was accepted this month
3 Set if the given cargo was accepted since last periodic processing (which happens every 250 ticks)
4..31 Undefined, reserved for future use

The information required for this variable is stored in the station2 structure, and therefore works only if the station2 structure is present. The station2 structure is present if any of the following is true:

  • Generalfixes is on, and miscmods.noextendstationrange is off
  • Any of fifoloading, newcargos or irregularstations is on

If the station2 structure isn't present, the returned value is always zero.