Old NewGRF roadtypes 1

This work is in parallel with rail types.

Contents

Road type labels

These work in the same way as cargo labels. The default road type labels are:

By default, with no translation table in place, ROAD and TRAM are used.

This changes with a translation table, and the selected road type is used directly. If the roadtype is unavailable then the vehicle becomes unavailable.

The translation table is loaded by action 0, feature 8, property 13.

Roadtype fallbacks

Testing of different road types can be provided by use of action 7:

Action 0: Install table consisting of ROAD TRAM TRAC
Action 7: Skip next line if HWAY exists
Action 0: Install table consisting of ROAD TRAM ROAD

This will cause road vehicles of the third rail type to be HWAY if that type exists, or ROAD if it doesn't, allowing some flexibility.

Road type translation table (action 0, feature 8, property 13)

This is a list of labels and works in the same way as cargo translation tables.

This is an example table that sets up four road type translations:

1 * 30      00 08 01 04 00 13 "ROAD" "TRAM" "HWAY" "TRAC"

Road type properties (action 0, feature 11)

Property Format Description
08 dword Label
09 word String ID of roadype
xx byte (dword ...) Compatible road type list (list of labels, turned into a bitmask internally)
xx byte (dword ...) Powered road type list (list of labels, turned into a bitmask internally)

In NFO, road type IDs will be GRF local, with an ID to label mapping. Therefore to modify an existing road type, specify its label in property 08. To create a new road type, again just specify its label in property 08. This way there is no need for complex GRM mechanisms to allocate IDs. If a label 'clashes' with another GRF, then one GRF will end up modifying the properties instead of creating a new road type.

Road type Action3/2/1 scheme

Action 1

Just a regular action 1 for sprites.

Action 2

Like normal, used to assign sprites from action 1 to 'cargo ids'. There are no variables for road types.

Action 3

For road types the cargo type byte specifies the type of sprites being assigned. These are as follows:

'Cargo' type Sprite type Sprites Usage

Not all types need to be defined, if the type is not going to be used anyway.

Executing a varaction for every road tile would probably be quite slow, so for the moment it is done once on starting a game. For this reason, no global varaction 2 variables should be used.

Action 7/9 additions

Condition Description
0F Skip if the road type label is not defined
10 Skip if the road type label is defined