New Results

GRF version 8 restricted all callbacks with boolean results to only return values 0 and 1, and no longer zero and non-zero. As a result of that, it is now possible to extent those callbacks with additional results for new features. This page collects some applications for that.


Slopes and foundations

CB 30/14E/150: Decide drawing foundations

New results:

TODO figure out the best result values

CB 3C/14F/15D: Disable autosloping

New results:

TODO figure out the best result values

Slope information in industry layout

There is often the desire for a better way for construction of industries (but actually also for objects and airports at some point) on sloped terrain.

The basic idea to archieve this is as follows:

Example: Farm with two houses and some fenced grass-area around them.

Option 1: CB 2F/157: Slope check


Register 100: ffggyyss

Option 2: Property

Allow specifying tilegroups and slope requirements via a property.

TODO figure out the best method

Industry / house acceptance, stockpiles

Cargo acceptance at stations/industries has currently various problems:

This results in these problems:

CB 3D: Industry acceptance

To solve the stockpiling problem CB 3D is extended.

New results:

Note: CB 3D should also add a note to the industry GUI.

Deciding cargo acceptance at stations

To solve the acceptance inconsistencies, the algorithm within OpenTTD is modified. (No GRF (spec) changes required)

Implementation details:

CB 1F/2B, 2A/2C: Tile acceptance

The results of callbacks 2A/2C have only 5 bit per cargotype, so only the first 32 entries of the cargo translation table can be returned.

New results for CB 1F/2B:

TODO is there a more clever usage of regs 100... for this?

CB 37: Industry window acceptance/cargo text (implemented in r27752)

Industries with production callbacks display cargo amounts "to be processed" in the industry window. This text appears weird

New results for CB 37:

CB 3B: Control special industry effect

This allows industries to plant/remove objects around the industry. This can be used for farms or mines to plant/remove fields, mining excavations, ... Note that objects are not neccessarily user-buildable, so there can be specific objects only used by industries which do not appear in the build object window for the user.

New results for effect 0:

Note: reg 100 contains both a grf local object id, and the view, or a special value for 'random view'

New results for effect 1:

Note: reg 100 contains a grf local object id and a view, or a special value for 'any view'

TODO: Some way to enable/disable cargo production on successful planting/removal. E.g. a flag to call the production callback immediately after successful/failed planting/cutting (with special value in var 10/18 to distinguish it) This should also disable the default tree->wood production implication.

TODO: Some variables to check presence of objects nearby.

TODO: Some way to influence the position of the object. Either random position, or specific positition relative to industry (e.g. to add additional production buildings or similar)