The International Simutrans Forum

Simutrans Extended => Simutrans-Extended development => Topic started by: knightly on July 05, 2009, 08:52:13 AM

Title: [Bug v4.5] An Easy Way to Become a Billionnaire ^_^
Post by: knightly on July 05, 2009, 08:52:13 AM
Colin has spotted a bug : if you try to add or remove electrification, you will find that your money increases drastically.

Title: Re: [Bug v4.5] A Easy Way to Become a Billionnaire ^_^
Post by: jamespetts on July 05, 2009, 09:58:10 AM
Thank you for the report - problem found and will be fixed in the next version :-)
Title: Re: [Bug v4.5] A Easy Way to Become a Billionnaire ^_^
Post by: Nathan Samson on July 05, 2009, 10:28:47 AM
WTF, this has been a problem in simutrans-standard a long time ago... and it was not in the 4.4 version...

Why is this problem always comping back...
Title: Re: [Bug v4.5] A Easy Way to Become a Billionnaire ^_^
Post by: jamespetts on July 05, 2009, 11:12:23 AM
Because the base values for the price of the way object is an unsigned integer. If that is used in the accounting without casting, where a - is used, it overflows and becomes a very high number. The fix is to cast it to a signed integer somewhere, but, if the code is changed around, somebody might well forget to cast it back again.
Title: Re: [Bug v4.5] A Easy Way to Become a Billionnaire ^_^
Post by: Nathan Samson on July 05, 2009, 11:56:43 AM
Quote from: jamespetts on July 05, 2009, 11:12:23 AM
Because the base values for the price of the way object is an unsigned integer. If that is used in the accounting without casting, where a - is used, it overflows and becomes a very high number. The fix is to cast it to a signed integer somewhere, but, if the code is changed around, somebody might well forget to cast it back again.

That explains it
Title: Re: [Bug v4.5] An Easy Way to Become a Billionnaire ^_^
Post by: Colin on July 05, 2009, 04:44:07 PM
Quote from: Nathan Samson on July 05, 2009, 11:56:43 AM
That explains it
Quote from: Nathan Samson on July 05, 2009, 10:28:47 AM
WTF, this has been a problem in simutrans-standard a long time ago... and it was not in the 4.4 version...

Why is this problem always coming back...

This post by Nathan is strange to me because, the many years that I have been playing Simutrans this is the first time I have come across this particular phenomenon. I must have missed a version somewhere down the track.
Title: Re: [Bug v4.5] An Easy Way to Become a Billionnaire ^_^
Post by: Nathan Samson on July 05, 2009, 09:25:45 PM
Quote from: Colin on July 05, 2009, 04:44:07 PM
This post by Nathan is strange to me because, the many years that I have been playing Simutrans this is the first time I have come across this particular phenomenon. I must have missed a version somewhere down the track.

I think I made a mistake:
I interpreted electrifaction as laying power lines between a power factory and another factory, but what was meant here was electrification of tracks
Title: Re: [Bug v4.5] An Easy Way to Become a Billionnaire ^_^
Post by: Colin on July 05, 2009, 09:30:13 PM
Quote from: Nathan Samson on July 05, 2009, 09:25:45 PM
I think I made a mistake:
I interpreted electrifaction as laying power lines between a power factory and another factory, but what was meant here was electrification of tracks

I thought I had'nt seen this bug before. Yes it is electrification of Tram & Train lines.
Title: Re: [Bug v4.5] An Easy Way to Become a Billionnaire ^_^
Post by: Nathan Samson on July 05, 2009, 09:36:26 PM
Quote from: Colin on July 05, 2009, 09:30:13 PM
I thought I had'nt seen this bug before. Yes it is electrification of Tram & Train lines.

Thats what I mean, this particular bug indeed didn't exist before (as far as I know), but a similar bug with powerlines did
Title: Re: [Bug v4.5] An Easy Way to Become a Billionnaire ^_^
Post by: cwlau9 on July 28, 2009, 05:40:44 PM
This bug seems to be reappeared in ver 6.1 again.
Title: Re: [Bug v4.5] An Easy Way to Become a Billionnaire ^_^
Post by: jamespetts on July 29, 2009, 08:15:02 AM
Thank you for the report - I will have to look into this...

Edit: I cannot reproduce this. Can you give more details about the circumstances in which it occurs?
Title: Re: [Bug v4.5] An Easy Way to Become a Billionnaire ^_^
Post by: Hanczar on July 29, 2009, 08:43:26 PM
QuoteI interpreted electrifaction as laying power lines between a power factory and another factory, but what was meant here was electrification of tracks
QuoteThats what I mean, this particular bug indeed didn't exist before (as far as I know), but a similar bug with powerlines did

For me it looks now exactly as this.  Construct power line on every title gives me ~43000000 $ .
It happens when I have exe built from sources, or downloaded from http://www.43-1.org/~simutrans/simutrans-exp/i386/.
I have used clean configs but all time the same.  Build 5.1 ( released 17 VII 2009 ) works ok , build 6.1 ( released 26 VII 2009 ) gives 43M per power line title.

Ubuntu 9.04, 32-bit
EDIT: I tested pak64 and pak128 on both problem is reproducible.
Title: Re: [Bug v4.5] An Easy Way to Become a Billionnaire ^_^
Post by: jamespetts on July 29, 2009, 09:55:22 PM
Ahh, sorry, I thought that it was to way electrification that reference was being made. I have found this and fixed it, and the fix will be available with the next release.
Title: Re: [Bug v4.5] An Easy Way to Become a Billionnaire ^_^
Post by: Hanczar on July 30, 2009, 11:04:10 PM
Could you commit fix to github? Current version because of this bug has very limited playability - no power lines at all
Title: Re: [Bug v4.5] An Easy Way to Become a Billionnaire ^_^
Post by: jamespetts on July 31, 2009, 10:09:45 AM
That'll be done to-morrow - I can't do it in advance of a release, because the Linux nightlies will then automatically build, and I don't want them being built with a half-baked version.