-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #1629: change the value written for the speed property to that th…
…e displayed value in OpenTTD matches the original value
- Loading branch information
Showing
7 changed files
with
59 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,29 @@ | ||
|
||
units = {} | ||
|
||
units['nfo'] = {'type': 'nfo', 'convert': 1} #don't convert, take value literal | ||
units['nfo'] = {'type': 'nfo', 'convert': 1, 'ottd_mul': 1, 'ottd_shift': 0} #don't convert, take value literal | ||
|
||
# Conversion factor works like this: | ||
# 1 reference_unit = convert other_unit | ||
# So nfo_value = property_value / convert * property_specific_conversion_factor | ||
|
||
# ottd_mul and ottd_shift are the values taken from OpenTTD's src/strings.cpp and | ||
# are used to calculate the displayed value by OpenTTD. If possible, adjust_values | ||
# increases or decreases the NFO value so that the desired display value is actually | ||
# achieved | ||
|
||
#Speed (reference: m/s) | ||
units['mph'] = {'type': 'speed', 'convert': 2.236936} | ||
units['km/h'] = {'type': 'speed', 'convert': 3.6} | ||
units['m/s'] = {'type': 'speed', 'convert': 1} | ||
units['mph'] = {'type': 'speed', 'convert': 2.236936, 'ottd_mul': 1, 'ottd_shift': 0} | ||
units['km/h'] = {'type': 'speed', 'convert': 3.6, 'ottd_mul': 103, 'ottd_shift': 6} | ||
units['m/s'] = {'type': 'speed', 'convert': 1, 'ottd_mul': 1831, 'ottd_shift': 12} | ||
|
||
#Power (reference: hpI (imperial hp)) | ||
units['hp'] = {'type': 'power', 'convert': 1} # Default to imperial hp | ||
units['kW'] = {'type': 'power', 'convert': 0.745699} | ||
units['hpM'] = {'type': 'power', 'convert': 1.013869} | ||
units['hpI'] = {'type': 'power', 'convert': 1} | ||
units['hp'] = {'type': 'power', 'convert': 1, 'ottd_mul': 1, 'ottd_shift': 0} # Default to imperial hp | ||
units['kW'] = {'type': 'power', 'convert': 0.745699, 'ottd_mul': 6109, 'ottd_shift': 13} | ||
units['hpM'] = {'type': 'power', 'convert': 1.013869, 'ottd_mul': 4153, 'ottd_shift': 12} | ||
units['hpI'] = {'type': 'power', 'convert': 1, 'ottd_mul': 1, 'ottd_shift': 0} | ||
|
||
#Weight (reference: ton) | ||
units['ton'] = {'type': 'weight', 'convert': 1} | ||
units['tons'] = {'type': 'weight', 'convert': 1} | ||
units['kg'] = {'type': 'weight', 'convert': 1000.0} | ||
units['ton'] = {'type': 'weight', 'convert': 1, 'ottd_mul': 1, 'ottd_shift': 0} | ||
units['tons'] = {'type': 'weight', 'convert': 1, 'ottd_mul': 1, 'ottd_shift': 0} | ||
units['kg'] = {'type': 'weight', 'convert': 1000.0, 'ottd_mul': 1000, 'ottd_shift': 0} |