Action2/Stations

From GRFSpecs
< Action2
Revision as of 19:21, 30 November 2011 by Frosch (talk | contribs) (Undo revision 2882; spritelayouts for stations are done via Action0)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Introduction

Defining station set-IDs.

For stations, Action2 is used to define set-IDs, similar to the way it works for vehicles. See the description below for details.

Do not skip an Action2 using Action9 (unless it skips the whole file). Action2 must not be skipped by Action9 or TTDPatch will most likely crash. Skip or modify Action3 instead. Skipping an Action2 with an Action7 has no effect.

Syntax

For stations, the data looks as follows:

<Sprite-number> * <Length> 02 04 <set-id> <numlittlesets> <numlotssets> <sets...>
Element Size Description
<Sprite-number> dec A sequential sprite number
<length> dec The total number of bytes used in this action
02 B Defines action2
04 B Stations is feature 4
<set-id> B What set-ID this action2 defines
<numlittlesets> B How many different cargo amounts to show when there is little cargo
<numlotssets> B Same but when there is lots of cargo
<sets...> W Sprite sets for each of the cargo amounts

Description

Sprite-number

This is just the number you are at.

Length

Count the number of bytes in this action.

Set-id

The set-ID that you want to define for this set. You can choose any value between 00 and FF, and you can reuse them within a grf file at a later point (if being equal to an existing set ID, the existing one is overwritten and the new one is used).

numlittlesets, numlotssets

Like for vehicles, this decides the graphics set to use depending on the amount of cargo waiting. There are two caveats, though. Firstly, a station can have 12 different cargoes waiting, not just a single one. Secondly, the maximum amount is 4095 for all stations and all cargo types.

Regarding the first issue, the amount of cargo this refers to depends on the action3 that triggered this action2:

  • if the cargo type matched exactly, it's the amount of the matching cargo (e.g. the action3 said "for coal, use this action2")
  • if the default was used, it's the amount of all cargo types added together
  • if the station is displayed for construction, the maximum amount is shown

Regarding the second issue, TTDPatch introduces the distinction between "little" and "lots of" cargo. The amount where this occurs is set by property 10, which is zero by default. But if set to a non-zero value, for example 200, then the range 0 to 199 is divided by numlittlesets, and the remaining range 200 to 4095 is divided by numlotssets. If property 10 is zero, the "little" sets are never used, and so numlittlesets may be zero. numlotssets must never be zero, however.

sets

The sets from the most recent action1 to use for this set-ID, for each stage of numlittlesets and numlotssets, i.e. in total numlittlesets+numlotssets entries.

Example

Something to go here