FS#2138 - Unexpected cargo appears

Attached to Project: OpenTTD
Opened by George (George) - Friday, 11 July 2008, 13:17 GMT
Last edited by frosch (frosch) - Saturday, 25 October 2008, 14:25 GMT
Type Bug
Category NewGRF → NewIndustries
Status Closed
Assigned To frosch (frosch)
Operating System Windows
Severity Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
  • George (George) (2008-10-06)
Private No


Undelivered cargo appears at unserviced industry
This task depends upon

Closed by  frosch (frosch)
Saturday, 25 October 2008, 14:25 GMT
Reason for closing:  Fixed
Additional comments about closing:  in r14530
Comment by frosch (frosch) - Friday, 11 July 2008, 16:12 GMT
From newgrf specs (callback 3D):
"This callback should be used in conjunction with callback 2B, since the acceptance of the tiles and the acceptance of the industry itself should always agree. If you disable accepting a cargo via callback 3D, but forget to remove the acceptance from the tiles, the station will keep accepting the cargo and the player will keep getting the money, but the industry won't receive the cargo. On the other hand, if you remove acceptance from the tiles, but forget using callback 3D, your industry may still get the cargo. (For example, there may be another industry nearby whose tiles accept the cargo. This makes the station accept the cargo, and send it to the nearest industry, which happens to be yours, even though its tiles don't accept the cargo.)"

You can add ", instead it will be delivered to the nearest accepting industry no matter how far away" behind "but the industry won't receive the cargo."

If this is not the case, please report back.
Comment by George (George) - Friday, 11 July 2008, 18:02 GMT
There is no tourist transportation in that save. Not me nor AI transport any tourist. It theoretically could be negative value in production callback, but then this should affect every industry, not the single one.
Comment by frosch (frosch) - Friday, 11 July 2008, 19:06 GMT
Green company, road vehicle 8.

Btw. you added ECSBasic Vector in game. You should not add newgrfs in game, esp. not grfs containing new cargos or new industries.
Comment by George (George) - Friday, 11 July 2008, 19:21 GMT
Hm, yes. But it transports tourists between 2 hotels, which have constant accepting and production. How can it affect industries?
Comment by frosch (frosch) - Friday, 11 July 2008, 19:50 GMT
Thanks, 'accepted by a house' was the hint I needed. When tourists are delivered to the station, it proceeds like:

1) The station accepts tourists because there are tourist accepting tiles (houses) around it.

2) If the cargo has a 'town effect' like water or food, the town is noticed of the delivery.

3) Then the cargo is delivered to the nearest industry, that accepts the cargo.

This causes these problems:
1) When an industry accepts a cargo with a town effect, the whole cargo is delivered to both the industry and the town.
2) When there are only houses around, which accept the cargo, it will also get delivered to the nearest industry accepting the cargo.

So basically cargos which are accepted both by industries and houses cause trouble currently. We need to find some way, to decide if the cargo is delivered to an industry or to a town/house. And if you deliver e.g. food to an industry, how shall it be distributed between town and industry?

IMO no easy questions...
Comment by George (George) - Saturday, 12 July 2008, 04:48 GMT
Imho industries (whose tiles can accept cargo and are covered by a station) should get all the cargo first, and the cargo they can't accept should go to houses. Of cause the cargo that goes to the station that does not cover the industry, should go to houses only.
Comment by frosch (frosch) - Saturday, 12 July 2008, 09:50 GMT
Well, but is it sufficient that only one industry tile with 1/8 acceptance is covered by the station, to give everything to the industry. Or does the industry need 8/8 to accept it.
Also what about the standard steel mill, which accepts about 2/8 passengers when covered completely.

So I can think of:
1) Decide station acceptance by suming up all tile acceptances in the coverage area (like it is done now). All cargo goes to the nearest industry with at least 1/8 acceptance in the station area. Remaining cargo goes to the town. Note: This will render callback 0x3D obsolete. Also players might complain that when they build a station near an industry, and when the town removes some houses, the station stops accepting the cargo.

2) Sum tile acceptance separately for houses and industries [or even for each industry separately]. Station accepts cargo only if houses or industry [or a single industry] reaches 8/8 acceptance. Note: This will break compatibility as stations near e.g. original steelmill and only a few houses might no longer accept passengers. [Even worse if industry acceptance is summed separately]

3) Station accepts cargo if houses and industries reach 8/8 acceptance together. Cargo is distributed to all houses and industries in the catchment area according to their fraction of the tile acceptance sum. Note: The player can no longer force the cargo to be delivered to only one industry by placing the station near to it. Also this will again render callback 0x3D obsolete.

4) Threat houses like industries, e.g. if a single house with 1/8 acceptance is nearer than a industry everything goes to the town/house. Note: Players will go nuts, if the town decides to build a new house near their station, which causes the cargo to be no longer delivered to any industry.

Comment by George (George) - Saturday, 12 July 2008, 11:58 GMT
1) CB 3D is used when two industries accept the same cargo. When the first one overflows, the second one starts to accept all the cargo. Also CB 3D can be used in the theoretical case when industry should accept cargo with its' tiles, but not take it into procession (some sort of my parameters to make game easier)

3) sounds good for several industries, but absolutely bad for houses, because a player can hardly control their appearing and disappearing.

4) yes, very hard to control.

I like the most the idea to distribute the cargo among the industries according to their tiles accepting (modified 3) ). Industries, whose callback 3D declines this cargo accepting, are ignored (there are industries in ECS, factory for example, who accept cargo (coal) with its' tiles, but do not accept it as an industry). Houses are also ignored. If no industry wants to get the cargo, houses get all the cargo.
Comment by DaleStan (DaleStan) - Tuesday, 15 July 2008, 17:07 GMT
TTD and TTDPatch do deliver cargo to both towns and industries, but they only deliver to an industry if it is sufficiently close to the station. (see CS:00137C74, 00560CAC, and checkstationindustrydist (at patches/fixmisc.asm:3469)) I recommend OpenTTD follow this lead.

1,3) I don't really mind rendering 3D obsolete, as long as it still works as documented -- 3D must still be called before the industry receives cargo.

And then there's the easy solution:
5) Industries (as opposed to industry tiles) must not accept cargoes that are accepted by houses, and vice versa.
Comment by George (George) - Wednesday, 16 July 2008, 18:30 GMT
5) Houses accept food, goods, tourists and tourists centres accept them too. I see no reason to break it.

as for 1,3 I think it would be better to divide cargo between industries, not to give all the cargo to only one industry. IMHO
Comment by George (George) - Tuesday, 07 October 2008, 19:16 GMT
Please change the Severity of the task to critical. I think it is a very important problem
Comment by George (George) - Wednesday, 08 October 2008, 05:46 GMT
Frosh, what did you mean with that?
Comment by Jean-Francois Claeys (Belugas) - Wednesday, 08 October 2008, 16:52 GMT
A High Severity means the game is crippled with a serious problem that may, in short term, stop it to work, like a desynch or an imminent crash.
In this case, we are talking about a behaviour that is not acceptable, but does not render the game useless.
It's understood you consider it a very serious bug. But would the game crash with it? no. That's the point
Comment by George (George) - Wednesday, 08 October 2008, 18:22 GMT
But why to change it to "Low"?
Comment by Jean-Francois Claeys (Belugas) - Wednesday, 15 October 2008, 02:32 GMT
You would prefer Very Low?
Does it matter, for you, how Low it has been set?
It's not the level of severity that dictates how fast it's going to be fixed.
It depends more on if we have an idea to fix it or not. But the level only affects the sorting of the bugs.

And by the way, i've heard someone is trying to fix it.
Not me, since I barely have time to check stuff around.
Comment by George (George) - Wednesday, 15 October 2008, 03:14 GMT
Well, may be I'm mistaking, but I think devs fix problems that are on the top of the list first.