Negative Cargos

Got a problem with TTDPatch? Get help here.

Moderator: TTDPatch Moderators

Post Reply
Stoney
Engineer
Engineer
Posts: 29
Joined: 21 Apr 2004 18:58

Negative Cargos

Post by Stoney »

All of a sudden several stations are showing Goods quantities of anywhere from -1 to -30,000. And they never go positive. :?
...and His train filled the temple.
Isaiah 6:1
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

Did you by any chance turn off newcargos just before this happened?

It should be fixable by using "Cht: ResetThisStation" on the stations in question.
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.
User avatar
Csaboka
Tycoon
Tycoon
Posts: 1202
Joined: 25 Nov 2002 16:30
Location: Tiszavasvári, Hungary
Contact:

Post by Csaboka »

This could also happen if newcargos is on and there's much cargo on the station. The newcargos switch allows up to 65,535 units to be waiting, but TTD won't display them correctly above 32,767 (negative values will be shown instead).
Reality is that which, when you stop believing in it, doesn't go away.—Philip K. Dick
Stoney
Engineer
Engineer
Posts: 29
Joined: 21 Apr 2004 18:58

Post by Stoney »

Thanks Csaboka,

That's exactly what is happening. Plus once a station cargo goes negative, it never seems to be able to go positive again; I have a couple of station cargos that get down to -1 but go positive unless I reset the station. Is this a fixable bug or just something to live with?
...and His train filled the temple.
Isaiah 6:1
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

"Up to -1", stoney. -1 is the upper limit on amount of cargo waiting. From low to high cargo waiting, you have 0..32767, -32768..-1.

Csaboka, any particular reason you didn't change all those "print-signed-word"s to "print-unsigned-word"s?
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
Csaboka
Tycoon
Tycoon
Posts: 1202
Joined: 25 Nov 2002 16:30
Location: Tiszavasvári, Hungary
Contact:

Post by Csaboka »

It's rather easy to fix this, and I really have no reason not doing that until now. When I finished the hard part of newcargos, I though this one can wait and no one will hit the limit anyway. (After all, the old limit was 4095, and no one complained about it being too low.) The only slight problem is that newcargo GRF coders will have to change the print-signed-word character to print-unsigned-word manually in their GRFs, I can't fix that one automatically. Oh, and I really hope no one will ever want to display negative cargo amounts, because it will be impossible after the change...

Well, I may just decide to lower the limit to 32K and forget about it...
Reality is that which, when you stop believing in it, doesn't go away.—Philip K. Dick
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

It would be possible to fix existing grf texts (look through them for \7C and change it to \7E. But that's probably not worth the effort.

Limiting it to 32K is fine by me too, after all that's still 8 times more than what it used to be.
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.
User avatar
Csaboka
Tycoon
Tycoon
Posts: 1202
Joined: 25 Nov 2002 16:30
Location: Tiszavasvári, Hungary
Contact:

Post by Csaboka »

OK, then. The limit will be lowered to 32K in the next alpha, and will possibly stay that way. Displaying negative cargo amounts may be useful in the future, so it's just cleaner to disallow using the sign bit.
Reality is that which, when you stop believing in it, doesn't go away.—Philip K. Dick
User avatar
Rob
Tycoon
Tycoon
Posts: 4355
Joined: 31 Dec 2002 16:52
Location: Ven-Zelderheide, The Netherlands

Post by Rob »

If it's not to much work could you make that a parameter, since I don't mind it going negative.
This way I'm allerted that there is too much cargo waiting and I have the time (until -32K) to get the cargo transported.
But like I said if it's to much trouble, forget it 32 K wil do too. :)
Wie zich gelukkig voelt met het geluk van anderen, bezit een rijkdom zonder grenzen. (F.Daels)
Image
Still the best OS around
User avatar
Csaboka
Tycoon
Tycoon
Posts: 1202
Joined: 25 Nov 2002 16:30
Location: Tiszavasvári, Hungary
Contact:

Post by Csaboka »

I'd rather not add a switch that can confuse newcomers (and possibly trigger false bug reports). And it's confusing indeed: When it reaches 32,767 units, it wraps around to -32,768, but after that, it increases again, so the maximum value is represented as -1 (that would wrap around to 0 if TTDPatch allowed it to be increased).
Reality is that which, when you stop believing in it, doesn't go away.—Philip K. Dick
User avatar
Rob
Tycoon
Tycoon
Posts: 4355
Joined: 31 Dec 2002 16:52
Location: Ven-Zelderheide, The Netherlands

Post by Rob »

Oh well I guess I'll learn to live with a 32 K limit. :wink:
Wie zich gelukkig voelt met het geluk van anderen, bezit een rijkdom zonder grenzen. (F.Daels)
Image
Still the best OS around
Post Reply

Return to “Problems with TTDPatch”

Who is online

Users browsing this forum: No registered users and 17 guests