Feature #930

sanity / rounding error check on supplied values

Added by planetmaker over 9 years ago.

Status:NewStart date:2010-05-10
Priority:NormalDue date:
Assignee:-% Done:


Target version:-


Just a brief copy from IRC:

<Rubidium> Yexo: maybe you should add (or already have added?) some parameter so it will warn if the in-game value is not available and it will be rounded
<planetmaker> I don't think it's done - or I haven't figured it out
<planetmaker> in general it's quite difficult though. Either you warn every time when dealing with float (and conversion factors often are a float value like 3.2 or so) - or you warn never
<planetmaker> so for small rounding issues I don't think that a rounding warning is required
<Rubidium> really? People are already complaining that rail tile prices aren't added to tunnel construction
<Rubidium> or that the 225 didn't go 225 km/h anymore
<planetmaker> hm, also true
<Rubidium> but yes, with floats determining whether a different value will be chosen is going to be tricky
<planetmaker> but that's actually what exactly the unit conversion shall make easier: to enter a value and get the nearest NFO equivalent
<planetmaker> so... it's useful. Sometimes. I guess a run-time option or flag would be nice.
<Rubidium> nevertheless, any train weight with .25, .5 or .75 will be rounded
<planetmaker> yes, of course :-)
<planetmaker> but road vehicles would work. But that cannot be entered right now ;-)
<Rubidium> and if you enter 100 km/h you expect that to be the value that you get in-game
<planetmaker> intuitively yes
<planetmaker> so a sanity check has to reverse-calculate the hex value and see whether it results ingame in the chosen speed in the given units
<Rubidium> yep
<Rubidium> and what you could do if 100 gives you 99 (due to rounding), try 101 to see whether that gives you 100 in-game
<planetmaker> yes

Related issues

Related to NewGRF Meta Language - Bug #1629: Review conversion for speed property Closed 2010-10-11

Also available in: Atom PDF