nml icon indicating copy to clipboard operation
nml copied to clipboard

Add AIR_DRAG_DEFAULT and AIR_DRAG_NONE constants

Open frosch123 opened this issue 4 years ago • 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.

frosch123 avatar Jun 03 '21 15:06 frosch123

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

FLHerne avatar Jun 03 '21 15:06 FLHerne

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.

FLHerne avatar Jul 02 '21 15:07 FLHerne