The m4nfo User manual and Technical Report

Technical Report

General and global functions


Content

Global functions

Global functions are available for every TTD feature. Exactly like feature-related performance functions, they are used for querying actual game data inside a control chain:

m4nfo function nfo var Byte Word DWord
anim_counter0x0A81 0A85 0A 
calculate  Custom
getparameter0x7F81 7F 00 FF85 7F 00 FF FF
current_climate0x02Custom 
current_date0x23 89 23 00 FF FF FF FF
dayofmonth0x0281 02 08 1F 
dayofyear0x02 85 02 10 FF FF 
game_level0x2281 22 00 FF 
game_mode0x1281 12 00 FF
getcolour / getcolour_pluscc / getcolour_plus2cc 0x7F Custom 
leapyear0x0281 02 0F 01 
month0x0281 02 00 FF
setregistersCustom
snowline0x2081 20 00 FF 
subroutine0x7E81 7E $1 00 FF 
trafficside0x0681 06 00 10
year0x01/0x2481 01 00 FF85 24 00 FF FF 

General functions

General functions are feature-independent functions for parameter and error handling, branching inside the newGRF, definition of text strings, etc. Unlike global functions, they are never used inside a control chain, but either stand-alone or as parameters to other functions:

  m4nfo function nfo action/var
InitializationgrfinitAction14
grfdescription
grfminversion
grfname
grfpalette
grfurl
grfversion
grfparameter
grfsetting
setdescription
setname
settype
Flow of control / parameter handling defCustom
deflabel
getothergrfparameterAction0D
getowngrfparameterCustom
patchvar
pcalcAction0D
placelabelAction10
refCustom
reflabel
setparameterAction0D
setbitCustom
skipAction7/9
skipif
Error handlingdeactivatesetAction0E
errorAction0B
Auxiliary functionsengine / industry / townCustom
little / lots
load / move
maymodify
nibble / pos
signed
param
shiftmask
Callback helper functions cbfail
cbr
addveh / addvehrev
attach
customcargo
animcontrol/animframe
effect
seteffort
autorefit
refsnd
grftext
Sound handlingdefsnd
soundtable
Recolouringcolourtable
 grf_overrideGeneral Action0 (11)
incrbasecostGeneral Action0 (08)
insertcommentAction0C
setpropertiesAction0
setrefreshbox0x93 ... 0x96
snowlinetableGeneral action0 (10)