The m4nfo User manual and Technical Report

Technical Report

Ship properties, functions and callbacks


Content

Ship property functions

m4nfo ship properties are based on plain nfo's action0 properties. Most of them are mapped in a straightforward way, but some of m4nfo's ship property functions are based on custom calculations, or based on using more than one nfo property.

m4nfo function nfo property custom
callbacks0x12yes
canalspeed0x15yes
capacity0x0D 
cargoaging0x1D
cargoclasses0x18 + 0x19yes
cargolist0x1E + 0x1F 
cargomask0x11
cargotype0x0C
climate0x06
flags0x17
intro0x00 + 0x1Ayes
loadamount0x07 
modlife0x04
newgraphics0x08
oceanspeed0x14yes
price0x0A 
refitcost0x13yes
refittable0x09 
reliability0x02
retire0x16
runningcost0x0F
seteffect0x1C
soundeffect0x10
sortbefore0x1B
speed0x0Byes
vehlife0x03 

Flag label Bit Value
2CC10x02
AUTOREFITTING40x10
CARGOMULTIPLIER50x20
NOBRKEFFECT60x40

callbacks(<List::Callbacks>)

Enabling callbacks in plain nfo means to set bits in property (0x12). Unfortunately, these bits have no numerical relation to the corresponding callback values returned by nfo's variable (0x0C). In m4nfo, both property function callbacks() and performance function callback() are using the same callback labels.

canalspeed/oceanspeed(<Byte> | <Unit-term>)

Speed fractions can be given either as a byte value as in plain nfo, or directly as a percent value.

cargoclasses(<List::(+|-)CargoClass>)

This m4nfo property function combines the two nfo properties for cargo class inclusion (0x18) and exclusion (0x19).

intro(<Date>)

Unline nfo, which again uses two properties for the introduction date (0x00 and 0x1A), this m4nfo function takes an introduction date in different formats and re-formats it for the appropriate nfo properties, i.e. if the given year is after 1920, only nfo property 00 will be used.

refitcost(<Byte> | <Unit-term>)

In m4nfo, the refit cost can be given either as a Byte value, with its maximum value "255" correlating to 50% of the vehicle's purchase price cost base (this is the original nfo behaviour), or directly as a percent value.

speed(<Unit-term>)

Plain nfo allows to specify the speed of a ship in units of mph*3.2, i.e. approximately km/h only, but m4nfo allows to use either [km/h, KM/H, mph, MPH].

Ship performance functions

m4nfo ship performance functions are based on plain nfo's Variational Action2 variables. Again, most of them are mapped in a straightforward way, but some of m4nfo's ship performance functions are based on custom calculations, or based on use of more than one nfo variable.

Please note that functions return either Byte, Word or Dword values, depending on the context they're used in.

m4nfo function nfo var Byte Word
ageindays0xC081 C0 00 FF85 C0 00 FF FF
animation0x4682 46 08 03 
autoreplace0x1081 10 00 FF
callback0x0C81 0C 00 FF85 0C 00 FF FF
cargo0xB981 B9 00 FF 
direction0x9F81 9F 00 FF
displaymode0x1081 10 00 FF
elsen/a 
indepot0xE282 E2 00 FF
lastmaintenance0x9281/82 92 00 FF85/86 92 00 FF FF
property0x1081 10 00 FF 
rcost_cargotype0x1081 10 00 FF
rcost_cargosubtype0x1081 10 08 FF
rcost_cargoclass0x1081 10 10 FF
refitted0xF281/82 F2 00 FF
reliabilitystate0xCE81 CE 00 FF85 CE 00 FF FF
soundevent0x1081 10 00 FF 
veh_cargoclass0x4781 47 10 FF
veh_cargotype0x4781 47 00 FF
veh_cargoweight0x4781 47 08 FF
veh_currentload0xBC81 BC 00 FF
veh_id0xC681/82 C6 00 FF
veh_status0xB281 B2 00 FF
yearbuilt0x49 / 0xC4(custom)

yearbuilt(<block>)

Ship callbacks

m4nfo ship callbacks are based on plain nfo's callbacks. They're all mapped in a straightforward way. Callbacks from the first section of the table below have to be enabled by property function callbacks(), but those from the second section do not need to be: they're always active and will be used automatically if needed.

m4nfo callback nfo callback
CB_LOAD0x12
CB_RCAP0x15
CB_RCOL0x2D
CB_SOUND0x33
CB_TSFX0x19
CB_ARVS0x18
CB_PROP0x36
CB_RCOST0x15E
CB_STOP0x31
CB_TEXT0x23
CB_32DAY0x32

Callback helper functions

Callback helper functions are based on m4nfo's function cbr() which returns a parameter as a callback return value.

m4nfo function definition
effectcbr($1)
seteffort(custom)
autorefitcbr(eval($1 | 16384))
refsndcbr(_S_$1)
grftextcbr($1)
reftxtcb(custom)

Random functions

In nfo, randomized Action2s are used to randomize the ship (0x80).

m4nfo function nfo random Action2 type
randomrel0x80