LS,

I compared R3786 to current trunk and found the folowing

In current the in simfab, distribute_ware_t there is this code :

` 1273 prissi ware = w;`

5030 turfit // ensure overfull stations compare equal allowing tie breaker clause (amount waiting)

5030 turfit ratio_free_space = max(space_left,0) / max(space_total>>fabrik_t::precision_bits,1);

1273 prissi }

1273 prissi distribute_ware_t() {}

4434 dwachs

4434 dwachs static bool compare(const distribute_ware_t &dw1, const distribute_ware_t &dw2)

4434 dwachs {

4434 dwachs return (dw1.ratio_free_space > dw2.ratio_free_space)

5030 turfit || (dw1.ratio_free_space == dw2.ratio_free_space && dw1.amount_waiting <= dw2.amount_waiting);

4434 dwachs }

in R3786 there was not yet a compare function but the usage was computed as follows :

`const sint32 usage = (space_left << precision_bits) / space_total;`

So difference is the usage of precision_bits on space_left vs space_total

For calling the dist_list_insert current trunk code is :

` 4614 prissi if( !welt->get_settings().get_just_in_time() ) {`

4780 prissi // without production stop when target overflowing, distribute to least overflow target

5030 turfit dist_list.insert_ordered( distribute_ware_t( halt, ziel_fab->get_eingang()[w].max, ziel_fab->get_eingang()[w].menge, (sint32)halt->get_ware_fuer_zielpos(ausgang[produkt].get_typ(),ware.get_zielpos()), ware ), distribute_ware_t::compare );

4434 dwachs }

In R3786 the code was

` if(!welt->get_einstellungen()->get_just_in_time()) {`

// distribution also to overflowing factories

if(still_overflow && !overflown) {

// not overflowing factory found

still_overflow = false;

dist_list.clear();

}

if(still_overflow || !overflown) {

dist_list.insert( distribute_ware_t( halt, halt_left, halt->get_capacity(2), ware ) );

So the difference is swapping the capacity and space_left parameters in the distribute_ware(...)

Changing the current back to R3786 code :

in distribute_ware_t

`// ratio_free_space = max(space_left,0) / max(space_total>>fabrik_t::precision_bits,1);`

ratio_free_space = (space_left << fabrik_t::precision_bits) / space_total;

and verteile waren

` const sint32 ziel_left = ziel_fab->get_eingang()[w].max - ziel_fab->get_eingang()[w].menge;`

dist_list.insert_ordered( distribute_ware_t( halt, ziel_left, ziel_fab->get_eingang()[w].max, (sint32)halt->get_ware_fuer_zielpos(ausgang[produkt].get_typ(),ware.get_zielpos()), ware ), distribute_ware_t::compare );

// dist_list.insert_ordered( distribute_ware_t( halt, ziel_fab->get_eingang()[w].max, ziel_fab->get_eingang()[w].menge, (sint32)halt->get_ware_fuer_zielpos(ausgang[produkt].get_typ(),ware.get_zielpos()), ware ), distribute_ware_t::compare );

restores the functional behaviour of distribution of goods from one factory to multiple consumers.

Herman