GrfLoadingStages

From GRFSpecs
Revision as of 03:32, 17 November 2005 by dmccoy (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Stages of loading a GRF file

The stages of loading a grf file

(WARNING: Some parts of this page are known to be incorrect.)

Every .grf file is processed in two stages. The first stage, initialization, is run only once. In this stage, TTDPatch records the GRF IDs, and resolves all cargo IDs and sprite IDs as well as doing some other bookkeeping tasks.

During initialization, actions 3, 4, 5, 7, and E are ignored. Action 7 is ignored because otherwise the sprite IDs and cargo IDs that are skipped won't be resolved. Action 8 has the GRF ID recorded so that it can be looked up later.

During activation, actions 1, 2, F, 10, and 11 are ignored, because they only need to be processed once at initialization.

Action C is always ignored.

A .grf file is activated only if it was active when the game was started. If a game is loaded, only its active .grfs will be reactivated, unless "loadallgraphics on" is used. A .grf file is considered active if its action 8 has been processed, i.e. its action 8 hasn't been skipped using an action 7.

This table shows exactly which actions are processed when.

||Action|Init|Activate|Notes

0|*|Yes|Processed during initialization for features 05, 07, 09, and 0A only

1|Yes|No|

2|Yes|No|

3|No|Yes|

4|Yes|Yes|

5|Yes|Yes|

6|Yes|*|Processed during activation in a51 and later.

7|No|Yes|

8|Yes|Yes|

9|Yes|Yes|

A|No|Yes|

B|*|Yes|Processed during initialization only if bit 7 of severity is set.

C|No|No|

D|Yes|Yes|

E|No|Yes|

F|Yes|No|

10|Yes|No|

11|Yes|No| ||