Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inaccurate display of velocites #3870

Closed
DorpsGek opened this issue Jun 7, 2010 · 8 comments
Closed

Fix inaccurate display of velocites #3870

DorpsGek opened this issue Jun 7, 2010 · 8 comments
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay

Comments

@DorpsGek
Copy link
Member

DorpsGek commented Jun 7, 2010

Krille opened the ticket and wrote:

If you set the units to metric or SI then the value is converted twice when displaying a {VELOCITY}. First it's converted from the internal kph to mph, then to kph or m/s, depending on the setting.

This causes rounding errors which get especially noticeable for high values (e.g. fast planes).

The first part of the patch changes that to do at most one conversion. For metric units there's none at all.

Since the max speed conditional orders stored the conditional value in mph this is also fixed during afterload. This probably needs a bump of the savegame version which I haven't done yet. The case is simmilar for my other patch from #3835. It sounds like a good idea to commit both at the same time so that only one version bump is necessary.

One unnecessary cast is also removed by the patch.

I've attached a few pictures showing the effects of the patch.

The second patch adds/fixes a number of descriptive comments I made while working on the first patch.

Attachments

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/3870
@DorpsGek
Copy link
Member Author

DorpsGek commented Jun 7, 2010

Rubidium wrote:

I think http://vcs.openttd.org/svn/changeset/8464 says enough.


This comment was imported from FlySpray: https://bugs.openttd.org/task/3870#comment8121

@DorpsGek
Copy link
Member Author

DorpsGek commented Jun 7, 2010

Krille wrote:

I know of this changeset. However I couldn't make sense of the log message. Did he say that 1 mph = 1.6 kph isn't precise enough? The exact factor is 1 mph = 1.609344 kph.

If you look closer at the two pictures with imperial units you'll notice that the patch makes no difference there. But there is a difference for metric units. With the patch the displayed values exactly match those listed in the tables in the source. The conversion for SI units is also very accurate, sometimes more accurate than before, or at least about the same.

So the patch makes a (sometimes larger) improvement for metric units and changes about nothing for the other units.

Finally: All these points don't concern the second part of the patch in any way.


This comment was imported from FlySpray: https://bugs.openttd.org/task/3870#comment8125

@DorpsGek
Copy link
Member Author

DorpsGek commented Jun 7, 2010

frosch wrote:

What rubidium wanted to point out. The conversions were already fixed once in r4322.
After lots of complains that e.g. vehicles no longer drove 100 km/h though they were previously designed to do so, it was reverted in r8464.


This comment was imported from FlySpray: https://bugs.openttd.org/task/3870#comment8126

@DorpsGek
Copy link
Member Author

DorpsGek commented Jun 8, 2010

Krille wrote:

I still don't get the point. When would the vehicles not reach their designed speed? Does it have something to do with NewGRF? Are there some of the complaints available to read? I'm unable to find the problem in my testing. Maybe things have changed since then? A lot of time and changes to the code have passed.

If nothing can be done the situation has to be described in the source, perhaps at the conversion table? Otherwise the next patch like this will appear sooner or later.

And how about my second part of the patch? It doesn't change anything in the code, it just adds useful (I think) documentation.


This comment was imported from FlySpray: https://bugs.openttd.org/task/3870#comment8128

@DorpsGek
Copy link
Member Author

DorpsGek commented Jun 8, 2010

frosch wrote:

The point about the speed unit conversions is, that it does not matter how fast a vehicle moves exactly. You cannot distinguish 99 km/h from 100 km/h in game.

But for a lot of people and especially GRF authors it is important that a vehicles states it does 100 km/h, if that is the number written in the datasheet of the real engine. So they do a lot of trial&error until the GUI tells the numbers they want. For the game the precise speed is not important at all.

Now, when changing the conversions, there is no change in gameplay. But the GUI will show other numbers than it showed when the GRFs were created, and thus different numbers than intended. The number is important, not the relation to other units.


This comment was imported from FlySpray: https://bugs.openttd.org/task/3870#comment8130

@DorpsGek
Copy link
Member Author

Krille wrote:

Thanks for sharing this insight. I'd suggest to put this description somewhere where it stays visible after closing this ticket, so other people having the same idea can find it.

For me the whole thing started when I looked at the aircraft code and noticed that they should taxi at 200 km/h but the display shows 201.

Just two things remain for me:
* What's the difference between plain km/h and km-ish/h?
* It seems that for aircrafts 1 unit is indeed 12.9 km-ish/h and not 12.8, which has been noted in table/engines.h. See e. g. r8973.


This comment was imported from FlySpray: https://bugs.openttd.org/task/3870#comment8136

@DorpsGek
Copy link
Member Author

Rubidium wrote:

The difference between km/h and km-ish/h is a factor 1.00584 (km-ish/h is the bigger of the two).
Back in r8973 km-ish/h wasn't coined yet, though they mean km-ish/h. As such 200 km-ish/h becomes 201.168, which rounded down is 201.

Furthermore I think that the new aircraft code was (initially) written in the time the base was km/h (i.e. before r8464), but nobody ever caught it being "wrong" before. So that part should be fixed.


This comment was imported from FlySpray: https://bugs.openttd.org/task/3870#comment8338

@DorpsGek
Copy link
Member Author

Rubidium closed the ticket.

Reason for closing: Fixed

In r20164


This comment was imported from FlySpray: https://bugs.openttd.org/task/3870

@DorpsGek DorpsGek added Core flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay labels Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay
Projects
None yet
Development

No branches or pull requests

1 participant