The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: Dwachs on December 14, 2012, 08:23:38 PM

Title: [patch] just-in-time and cargo distribution
Post by: Dwachs on December 14, 2012, 08:23:38 PM
Currently, the distribution of goods to factories is broken: If all consumers of a factories' good do not have anything in their storage, then the output goods is always sent to the same factory.

Patch attached. I do not know whether it break something else. Overflowing target factories still should be treated equally.

Title: Re: [patch] just-in-time and cargo distribution
Post by: prissi on December 14, 2012, 09:36:44 PM
Does this problem only occur for just_in_time off?

Another solution would be to use the in transit number to distribute to the factories with least in store + in transit. This would also prefer closer factories more.
Title: Re: [patch] just-in-time and cargo distribution
Post by: Dwachs on December 14, 2012, 09:42:06 PM
It effects only the just-in-time=off branch. There factories that are empty are not treated equally, the factory with the largest storage always wins.

The patch uses maximum storage and available storage at target factory in the same way as halt capacity and available halt capacity are used with just-in-time on.
Title: Re: [patch] just-in-time and cargo distribution
Post by: prissi on December 15, 2012, 12:38:01 AM
Since we record now, how much is in transit: Maybe now the factory with the least percentage of goods in (storage+in transit)*100/max should get the delivery? (If possible)
Title: Re: [patch] just-in-time and cargo distribution
Post by: Dwachs on December 15, 2012, 09:11:03 AM
I rather would first fix this, before thinking about alternatives.

Edit: Commited.