The International Simutrans Forum

Simutrans Extended => Simutrans-Extended development => Topic started by: fbfree on September 27, 2011, 01:30:13 AM

Title: Bug - Excessive revenue at beginning of month
Post by: fbfree on September 27, 2011, 01:30:13 AM
In the following savegame, http://simutrans-germany.com/files/upload/NA1842.sve (http://simutrans-germany.com/files/upload/NA1842.sve)

At the beginning of the next month, convoy 19 will earn an income of over $3000 when he should earn less than $20.  He seems to arrive at the station exactly at the beginning of the month.  This bug is reproducable, and has occured for both passengers and mail.

The revenue is earned for the month of November, but at the moment of earning the income, the charts for the convoy still show the October statistics, notably the one for distance.  These charts update for the new month shortly thereafter, but retain the high income.

This is using Experimental 10.1 linux x386 with pak-brit-exp 0.8
Title: Re: Bug - Excessive revenue at beginning of month
Post by: jamespetts on September 27, 2011, 09:04:59 AM
May I check - you are using the x386 version of the binary: are you also running a 32-bit version of Linux? I ask because running the 32-bit binary on a 64-bit version of Linux is known to cause problems.
Title: Re: Bug - Excessive revenue at beginning of month
Post by: fbfree on September 28, 2011, 12:44:28 AM
Hi James,

I am using a 32-bit kernel on this machine.

I'm running Ubuntu 10.04 with
Linux 2.6.32-33-generic kernel for i686
Title: Re: Bug - Excessive revenue at beginning of month
Post by: fbfree on September 28, 2011, 12:59:36 AM
It's a different effect than first thought:

It seem to be the first convoy to arrive at Faringford Parish Hall Stop after October 1 rather than the convoy arriving at the very beginning of the month that triggers the excess revenue.  In the two other times I had reproduced this bug, I had restarted the same game from January 1843, and every time, the first convoy arriving in October triggered the bug.

There's also two more symptoms:
1) Travel times seem to be distorted.  i.e. The endpoints of the line have shorter travel between them than to from them to intermediate stops.
2) Passengers are being routed 'via' an intermediate stop.
Title: Re: Bug - Excessive revenue at beginning of month
Post by: sdog on October 04, 2011, 04:20:06 AM
I had excessively high income too, with 64 bit binary on 64 bit linux. (10.x branch). I have only seen the bug so far in the income graph, so i can't give a good description of it occuring.

EDIT:
In this savegame (http://dl.dropbox.com/u/1876190/3.sve) line 42, engine 62 arriving during the first 10 minutes of October at Brentchester Terminus shall provide 450k revenue.
savegame requires 10.1 experimental with version 8.1 of the pak.


Delaying the arrival of the engine a little reduces the revenue hike.
6:30  400k
17m 100k
1h 60k (it even stopped at a different station the same month)
short-turning the convoy, this means setting it to reverse route one stop before the terminus only delayed the extreme profit. When it arrived at Brentchester Terminus the next month it received 50k
Title: Re: Bug - Excessive revenue at beginning of month
Post by: jamespetts on October 05, 2011, 12:46:10 AM
I have eventually tracked down this issue - thank you for the report. This was caused by an integer overflow in the average journey times code. This is fixed on 10.x. I should be grateful if anyone who can compile the code could test this. Also - can people check to see whether the fix adversely affects performance or memory consumption to a significant degree?
Title: Re: Bug - Excessive revenue at beginning of month
Post by: wlindley on October 05, 2011, 02:34:49 PM
October 5th snapshot seems almost identical in performance and memory to the 24 September version on my system (64-bit Fedora).  I had also seen this bug with the 24 Sept.; have not seen it with the latest.
Title: Re: Bug - Excessive revenue at beginning of month
Post by: dustNbone on October 10, 2011, 10:34:50 PM
I can confirm that this was present in 10.0 and absent in 10.2, savegame from affected version loaded by unaffected version seems to produce excess revenue initially, and then taper to normal within a year of game time.
Title: Re: Bug - Excessive revenue at beginning of month
Post by: jamespetts on October 10, 2011, 10:39:43 PM
Excellent - glad that it works! The excess revenue initially on loading saved games from earlier versions is to be expected, as the earlier incorrect values will be loaded.