Newcargos profit problem with the nightlies

Got a problem with TTDPatch? Get help here.

Moderator: TTDPatch Moderators

Post Reply
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Newcargos profit problem with the nightlies

Post by PikkaBird »

Hmm...

In one of my savegames (created with the nightlies), my custom cargos have somehow contrived to be worth considerably less to transport in 1940 than they did in 1921.

I'm not sure how to recreate it yet, but I'm just posting this as a heads-up.
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Post by PikkaBird »

Okay, here we go.

The graphs show a new cargo transport value compared to passengers and mail. First graph is when starting a new game. Second graph is after saving and loading the game in 1935, which is around when it starts going wrong. Third graph is after saving and loading the game in 1936.

1935 savegame is attached, it uses the UKRS Industries which you can get here.

Interestingly, I have a 1961 game from an older beta which can be loaded and resaved in the current one and the prices remain correct, so I suppose the bug must be a recently introduced one.
Attachments
graph.png
graph.png (7.99 KiB) Viewed 4755 times
TRP08.zip
(131.9 KiB) Downloaded 204 times
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Post by PikkaBird »

o...kay.

It still happens in r405, but the game in which I first noticed the bug now loads with correct values in both r405 and r392!

I must be going mad...
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Post by PikkaBird »

I'm now getting a crash when trying to load my savegame (in a mod version of r408, it loads in the regular r408). Could it be related?

Code: Select all

TTD V0019E200 Crash Log by TTDPatch 2.5 beta 5 r408mod (Windows)

Exception 80000003 at 001B:006000A0

EAX       EBX       ECX       EDX
07500000  00000013  00000001  FFFFF9A2

ESI       EDI       ESP       EBP
01BDDD74  00000C71  0006F8E8  0006F930

DS        ES        FS        GS        SS        Flags
0023      0023      003B      0000      0023      00000206
FFFFFFFF  FFFFFFFF  00000FFF  ########  FFFFFFFF (Segment limits)
00CFF300  00CFF300  0040F300  ########  00CFF300 (Access rights)

Bytes at DS:EIP
CC FF 25 88 C3 64 00 33 C0 BF 40 C3 64 00 33 C9

Stack Dump:
FFFFFFFE  006086A1  0006F930  00000005  00000078  0000000B  00000001  00000013
00610400  00609B73  00606F13  01BDDD82  01BDDD64  00000013  00000000  00000013
00000000  00000012  00420016  0060BB2D  00000078  01BDDD68  00420016  0006F958
0000000C  01BD74F0  0000020C  01BD7534  0060BA94  0060A9FD  0065D69B  004CBCF4

Handler Stack Dump (at 0023:0006F698):
00003FFF  00000000  00000000  00000000  00000000  0000003B  00000023  00000023
00000C71  01BDDD74  00000013  FFFFF9A2  00000001  07500000  0006F930  006000A0
0000001B  00000206  0006F8E8  00000023  0020027F  04900000  77C4FA29  0000001B
0006F89C  FFFF0023  00001F80  0000FFFF  00000001  00140178  0000FFFF  00000000

Patch flags:
DFEAFFFF  FFFFFFFD  FFFFFF7D  0000EFFF  00000000  00000000  00B9BE3E  A0800000
00000077  00601000  00001000  00000001  00000000  00003E80  009607D0  01900096
016D005A  FFFF0500  13B1C23D  02580320  13880258  05145555  0A28370A  140A1928
1E145014  14141450  3C1E1E14  143C5A3F  F0FFFF03  01F0F0F0

While processing sprites for GRF file newgrf/PB_UKRSI.GRF; Sprite number 0078 (hex).

Code: Select all

  120 * 25	 00 0B 08 01 13 0F 0E 10 04 11 FF 12 8D 13 00 00 13 54 14 54 15 01 16 20 00
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Post by PikkaBird »

And in yet more craziness, in regular r408 this ship type has now decided it wants to carry lumber (the newcargo to which the line above refers) as its default cargo, and not allow me to refit it...
Attachments
Scr41.png
Scr41.png (27.23 KiB) Viewed 4640 times
User avatar
Csaboka
Tycoon
Tycoon
Posts: 1202
Joined: 25 Nov 2002 16:30
Location: Tiszavasvári, Hungary
Contact:

Post by Csaboka »

Your crash log is about a division overflow, which probably happened while setting the cost multiplier of your cargo.

Since new cargo support should work with inflation, I can't just simply set the cost multiplier the GRF specifies. Instead of that, savegames store a reference cost (the multiplier of passengers, being inflated correctly from the beginning of the game), and uses this to adjust the given multiplier: new_multiplier = (reference / original_passenger_cost) * given_multiplier. I suspect the crash happened during the division, but I have no idea why that might happen.

Looking at the crazy symptoms, we may be dealing with random memory overwriting, and then the cause might be anywhere :?
Reality is that which, when you stop believing in it, doesn't go away.—Philip K. Dick
User avatar
Csaboka
Tycoon
Tycoon
Posts: 1202
Joined: 25 Nov 2002 16:30
Location: Tiszavasvári, Hungary
Contact:

Post by Csaboka »

OK, I found the problem for the wrong cargo cost problem. My division code was incorrect, giving wrong results, and crashing on some inputs... I think I've fixed it now, it should be working correctly in the next nightly.

I can't reproduce your other problem, unfortunately; the ships have their normal default cargoes and refit masks for me.

Thank you for your patience in reporting this bug :)
Reality is that which, when you stop believing in it, doesn't go away.—Philip K. Dick
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Post by PikkaBird »

Thanks Csaba. :)
User avatar
Csaboka
Tycoon
Tycoon
Posts: 1202
Joined: 25 Nov 2002 16:30
Location: Tiszavasvári, Hungary
Contact:

Post by Csaboka »

I could reproduce your second problem today, and together with Patchman, we could find the cause. It was a bug that has been around since alpha 68, which was released last December. It will be fixed in the next nightly. How it could go unnoticed for so long is a mistery, though...

Anyway, thank you for finding a half-year-old bug :D
Reality is that which, when you stop believing in it, doesn't go away.—Philip K. Dick
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Post by michael blunck »

Wasn´t there once a prize for tracking down the longest-standing bug? 8)

regards
Michael
Image
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

By the way, the reason that this bug stayed undetected for so long is that it doesn't trigger in the release versions, where the code in question would read a variable that had "reasonable" values, causing it to keep the ship refittable.

But in the nightlies, there's other data at the wrong place it read (due to additional debug information) and triggers the bug.
Josef Drexler

TTDPatch main | alpha/beta | nightly | manual | FAQ | tracker
No private messages please, you'll only get the answering machine there. Send email instead.
Post Reply

Return to “Problems with TTDPatch”

Who is online

Users browsing this forum: Semrush [Bot] and 36 guests