Bug #7918

ottd_display_speed outdated

Added by juzza1 over 3 years ago. Updated over 1 year ago.

Status:NewStart date:2015-12-25
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

OpenTTD display speed calculation was changed in revision 23945, but the ottd_display_speed function in nmlc (actions/action0properties.py) has not been updated to reflect this change.

Diff of OpenTTD strings.cpp between revisions 23944 and 23945 https://paste.openttdcoop.org/pvetrqwje

19:23 < juzza1> strings.cpp line 748 begins the conversion from kmhish->display, it then calls the ToDisplay (line 647) of the unit, with the input value multiplied by 10, and only after the ToDisplay function is done, is the value divided by 16. In nmlc, the value is divided right after multiplication by 10. Am I reading this right? So ottd_display_speed in nmlc should be changed to divide by 16 after other calculations
19:23 < juzza1> I am referring to this strings.cpp http://git.openttd.org/?p=trunk.git;a=blob;f=src/strings.cpp;h=d2ce762b70cf5a4d47967baaace620ee066a2f1c;hb=HEAD
19:23 < juzza1> ottd_display_speed is at line 257 in http://git.openttd.org/?p=trunk.git;a=blob;f=src/strings.cpp;h=d2ce762b70cf5a4d47967baaace620ee066a2f1c;hb=HEAD
19:24 < juzza1> If I do that fix, the values seem right in the output nfo
19:24 < juzza1> whoops, ottd_display_speed here http://dev.openttdcoop.org/projects/nml/repository/entry/nml/actions/action0properties.py
19:47 < Rubidium> then the implementation in NML might be "wrong" 
19:48 < juzza1> "svn diff -r 23944:23945 src/strings.cpp" at the ottd source shows the change, before that the division was done earlier (as is in nmlc currently)
19:48 < Rubidium> does "(int(value.value / divisor) * 10 * unit.ottd_mul >> unit.ottd_shift) // 16" work?
19:49 < juzza1> yes

History

#1 Updated by juzza1 over 3 years ago

IRC paste in saner format: https://paste.openttdcoop.org/pes8pzyp7

Also available in: Atom PDF