- GRF loading stages:
- The stages are processed after each other. All GRFs are processed for the same stage before advancing.
- # Initialiation stage
- for newgrf in configured_newgrfs:
- # Each NewGRF peforms checks on its own wrt. its parameters and general game variables (like climate).
- if newgrf.is_happy_with_parameters():
- # Shout out "hello" to other GRFs.
- else:
- # disable newgrf
- # Reservation stage
- for newgrf in configured_newgrfs:
- # Each NewGRF may check what other GRFs called "hello", and may choose to leave the room if they don't like them,
- # and the other one did not leave again on its own.
- if newgrf.is_happy_with_other_grfs():
- # Make promises what this NewGRF provides wrt. shared items, like cargo and railtype definitions.
- newgrf.provide_cargos()
- newgrf.provide_railtypes()
- else:
- # disable newgrf
- # Activation stage
- for newgrf in configured_newgrfs:
- # Each NewGRF provides all the stuff, sometimes depending on what cargos and railtypes were promised by other GRFs.
- # Erroring out here is considered rude.
- newgrf.provide_stuff(available_cargotypes, available_railtypes)