The code for industries consists of three parts:
The definition sets the feature properties of the industry like input and ouput cargo types and amounts, production parameters, etc. Please note that an industry definition may only occur after a prior grfinit() function call for the newGRF file.
The industry performance functions are used to evaluate game-intrinsic variables, and make them accessible to the industry's activation function.
The industry activation instantiates the industry by finally assigning callback or other variable-referencing functions to this particular industry-ID. This is done by supplying a list of references to the industry's activation function. See below.
| Function | Meaning |
| defineindustry(<Industry-ID>, <block>) | Industry definition |
| makeindustry(<Industry-ID>, <List::ref()>) | Industry activation |
This function defines an industry. Its parameters are the industry's ID and a block of property-defining functions, where the relative position of the property functions is irrelevant.
defineindustry(_SALTER, substitutetype(5) industrytype(ORGANIC) flags(ONWATER) callbacks(CB_PERIODIC, CB_LOCATION, CB_TEXT) industrytext(INCR, _increasetext) industrytext(NAME, _nametext) outcargotypes(SALT) incargotypes(NONE) productionmultipliers(0) randomsounds(0x34, 0x39, 0x44, 0x48) probstart(16) probgame(5) mapcolour(PINK) prospectingsuccess(75 %) )
makeindustry(<Industry-ID>, <List::ref()>)
This function activates a previously defined industry. Its parameters are an industry-ID and a list of references. The number of references given must match the number of industries to assign the references, respectively the number of consecutive industry-IDs allocated internally:
makeindustry(_SALTER, ref(7))