Sudden negative cargo payment rates

Got a problem with OpenTTD? Find some help here.

Moderator: OpenTTD Developers

Post Reply
Hungerford
Engineer
Engineer
Posts: 7
Joined: 07 Jan 2010 16:33

Sudden negative cargo payment rates

Post by Hungerford »

I am having a strange problem with my current OpenTTD game. My economy is set to stable but over the past few years of gameplay, my cargo payment rates have begun to fluctuate wildly. They have now reached the point where several key cargoes have become worthless to transport.

I have never encountered this problem before - I have played further on from the stage shown on the screenshot and it reaches a point where the payment rate for passengers becomes negative although the rate for coal becomes positive again. Effectively, I end up having to shut 90% of my network because of this issue.

Anybody have any ideas as to what is going on? I didn't even know that dynamic cargo rates were a feature of OpenTTD.
Attachments
Gordon & Co., 3rd Jan 2003.png
(128.08 KiB) Downloaded 4 times
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Sudden negative cargo payment rates

Post by planetmaker »

Do you have a savegame for us?
Wold
Transport Coordinator
Transport Coordinator
Posts: 318
Joined: 03 Aug 2006 19:32
Skype: woldy_bg
Location: Bulgaria

Re: Sudden negative cargo payment rates

Post by Wold »

planetmaker wrote:Do you have a savegame for us?
Inflation has probably something to do with that.
Image
Hungerford
Engineer
Engineer
Posts: 7
Joined: 07 Jan 2010 16:33

Re: Sudden negative cargo payment rates

Post by Hungerford »

Here is the saved file. I hope you can work out what's going on.
Attachments
Gordon & Co., 3rd Jan 2003.sav
(467.49 KiB) Downloaded 98 times
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: Sudden negative cargo payment rates

Post by Transportman »

Wold wrote:
planetmaker wrote:Do you have a savegame for us?
Inflation has probably something to do with that.
Given the sudden decline in operating profit and the upside down curves in the cargo payments rate (longer deliveries should mean lower profits, not lower losses), I think there is something else going on.

I can't load the savegame because I miss the rusrailw(1).grf.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
Hungerford
Engineer
Engineer
Posts: 7
Joined: 07 Jan 2010 16:33

Re: Sudden negative cargo payment rates

Post by Hungerford »

Transportman wrote:
Wold wrote:
planetmaker wrote:Do you have a savegame for us?
Inflation has probably something to do with that.
Given the sudden decline in operating profit and the upside down curves in the cargo payments rate (longer deliveries should mean lower profits, not lower losses), I think there is something else going on.

I can't load the savegame because I miss the rusrailw(1).grf.
Sent you a PM with the missing file.
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: Sudden negative cargo payment rates

Post by Transportman »

I have loaded your game and fastforwarded a couple of years, and noticed something strange in the Cargo Payments rate graphs. They go up like very fast, but when the 10 day delivery value hits something like €100,000k it changes to the negative side, to rise back up again.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
Hungerford
Engineer
Engineer
Posts: 7
Joined: 07 Jan 2010 16:33

Re: Sudden negative cargo payment rates

Post by Hungerford »

Transportman wrote:I have loaded your game and fastforwarded a couple of years, and noticed something strange in the Cargo Payments rate graphs. They go up like very fast, but when the 10 day delivery value hits something like €100,000k it changes to the negative side, to rise back up again.
It sounds like a bug somewhere, especially as I am using the default industries etc. The only newgrfs I have are for vehicles and stations.
Wold
Transport Coordinator
Transport Coordinator
Posts: 318
Joined: 03 Aug 2006 19:32
Skype: woldy_bg
Location: Bulgaria

Re: Sudden negative cargo payment rates

Post by Wold »

Well I don't know the insides of the game but I guess due to inflation the price overflows ( int32 - 2,147,483,647 ) and starts from -2,147,483,648 again. If you can attach rusrail(1).grf it would be great. A short term fix could be for the prices to be a signed int..
Image
Hungerford
Engineer
Engineer
Posts: 7
Joined: 07 Jan 2010 16:33

Re: Sudden negative cargo payment rates

Post by Hungerford »

Here is the newgrf file which is needed to load my savegame.
Attachments
rusrailw (1).grf
(620.38 KiB) Downloaded 101 times
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Sudden negative cargo payment rates

Post by Yexo »

Wold wrote:Well I don't know the insides of the game but I guess due to inflation the price overflows ( int32 - 2,147,483,647 ) and starts from -2,147,483,648 again. If you can attach rusrail(1).grf it would be great. A short term fix could be for the prices to be a signed int..
I'm not quite sure what exactly you are proposing. An int32 is a signed int.
User avatar
FLHerne
Tycoon
Tycoon
Posts: 1543
Joined: 12 Jul 2011 12:09
Location: St Ives, Cambs, UK

Re: Sudden negative cargo payment rates

Post by FLHerne »

Probably a typo for unsigned int. That would make more sense...
Temporary Permanent signature filling text. Content coming soon delayed indefinitely! Oh, and I have had a screenshot thread.
Linux user (XMonad DWM/KDE, Arch), IRC obsessive and rail enthusiast. No longer building robots; now I ring church bells.
Author of an incredibly boring stickied post about NewGRFs.
Eddi
Tycoon
Tycoon
Posts: 8276
Joined: 17 Jan 2007 00:14

Re: Sudden negative cargo payment rates

Post by Eddi »

internally, all places which handle prices should be "overflow-safe int64" (aka "Money"). the bug you see here is likely an oversight and should be trivial to solve, once the exact location where it goes wrong is found.

and "unsigned int" makes pretty much no sense...
Post Reply

Return to “OpenTTD Problems”

Who is online

Users browsing this forum: No registered users and 6 guests