FS#723 - 64bit<->32bit money conversion bugs

Attached to Project: OpenTTD
Opened by HMage (HMage) - Sunday, 08 April 2007, 12:43 GMT
Last edited by Peter Nelson (peter1138) - Wednesday, 23 May 2007, 16:27 GMT
Type Bug
Category Core
Status Closed
Assigned To No-one
Operating System All
Severity Medium
Priority Normal
Reported Version 0.5.0
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


The 64-bit money value is being truncated in many places into a negative value, as a result, some features become unavailable, others misbehave.

* If you have more than signed 32bit value of money, you're not allowed to send money to another player, says 'you're not allowed to send loaned money'
* If you try to build something that costs too much, either you're not allowed to do that, or you get income, or there's an error message when the requested action was done correctly, or the action isn't done completely.
This task depends upon

Closed by  Remko Bijker (Rubidium)
Tuesday, 19 June 2007, 00:05 GMT
Reason for closing:  Fixed
Additional comments about closing:  In r10212.
Comment by HMage (HMage) - Sunday, 08 April 2007, 12:48 GMT
I must apologize, but I didn't fill correct data for openttd version.

This report is for nightly, revision 9570. If it's possible could anyone fix this? I can't.
Comment by ewanm89 (ewanm89) - Monday, 14 May 2007, 08:14 GMT
Could you create a save without all the NewGRF files loaded please?
Comment by qery (qery) - Wednesday, 23 May 2007, 09:05 GMT
just connect to any network game which is about year 3000 any youll see it yourself
Comment by ewanm89 (ewanm89) - Wednesday, 23 May 2007, 14:11 GMT
Accept I'm testing against current svn, there aren't usually any current svn servers (compatibility checking stops different versions joining), let alone ones that are year 3000.
Comment by qery (qery) - Wednesday, 23 May 2007, 14:48 GMT
i have a save game if you want (0.5.1) year 2681.
Comment by Jean-Francois Claeys (Belugas) - Wednesday, 23 May 2007, 14:55 GMT
Just for the record, we are aware of that "bug". It needs a different method of handling the amounts internally. It will be addressed, but not in the near future. I've already started an attempt, but it is a long and tedious process. All versions of OpenTTD are "poised" with that problem. If anyone wants to try and solve the problem, i've included my attempt, which is still a big WIP and WILL NOT COMPILE. Just to show a possible road. Feel free to expand it
Comment by ewanm89 (ewanm89) - Wednesday, 23 May 2007, 16:01 GMT
Thanks guys, I'm looking into it also.
Comment by ewanm89 (ewanm89) - Wednesday, 23 May 2007, 16:08 GMT
Could someone set status to confirmed then.