OpenTTD/nml

Add AIR_DRAG_DEFAULT and AIR_DRAG_NONE constants

Opened this issue · 2 comments

The air_drag_coefficient property of trains and road vehicles has some magic values:

  • Integer 0: use some default max_speed-dependent value.
  • Integer 1: apply no air drag.

Currently NML applies unit conversion to this value, so to get no air drag you have to set "1/255", while "0" does something entirely different.

nitpick: Most NML constants have the 'enum name' first, so these should probably be AIR_DRAG_DEFAULT and AIR_DRAG_NONE or similar.

We should also ensure that the unit conversion handles this properly -- i.e. generate 1 for zero and 2 for other values below 2/255.

EDIT: of course, that would break grfs using 1/255 as the workaround you mentioned... might need a warning.