Page 1 of 1

[0.17.79] Inventory split does not round properly for Cargo Wagons

Posted: Sun Jan 19, 2020 6:39 pm
by n_slash_a
What did you do?
I have an assembly machine making cargo wagons. They are deposited in a chest, with an inserter circuit controlled to only put 16 wagons in (I am using 1-8 trains, so this is enough wagons for 2 trains).
I don't have logistic bots yet, so I grab the wagons manually. I just wanted to make 1 train, so I ctrl+right-clicked on the chest to grab 8 wagons.

What happened?
Instead of grabbing 8 wagons, I grabbed 6 wagons, leaving 10 in the box. I waited for the chest to refill, and when I tried a second time, I grabbed 7 wagons, leaving 9 in the box. A third try worked, grabbing 8. A fourth attempt yielded 7.

What did you expect to happen instead? It might be obvious to you, but do it anyway!
I would expect to grab 8 wagons every time. I suspect the issue has to do with stack size. I believe the game is grabbing half of each stack, which is resulting in rounding errors.
I would expect the game to look at the total contents of the chest first, find the number to grab, and then extract that amount of items.

Re: [0.17.79] Inventory split does not round properly for Cargo Wagons

Posted: Sun Jan 19, 2020 7:06 pm
by Loewchen
Ctrl + right click on a chest will move half of every stack in its inventory, rounded down but at least one of every stack. Assuming those 16 cargo wagons distribute along 3x5 and 1x1 it should move 7 into the player inventory and when I try it this is the case.

Re: [0.17.79] Inventory split does not round properly for Cargo Wagons

Posted: Sun Jan 19, 2020 11:33 pm
by Rseding91
Thanks for the report. It works as Loewchen says.

Re: [0.17.79] Inventory split does not round properly for Cargo Wagons

Posted: Mon Jan 20, 2020 2:51 am
by n_slash_a
Okay, thanks.

Re: [0.17.79] Inventory split does not round properly for Cargo Wagons

Posted: Sat Mar 13, 2021 11:45 am
by dasiro
neither for locomotives and their stack size is 5. Having 2 stacks in a chest results in grabbing only 4 loco's instead of 5 because each stack is rounded down to 2, a difference of 20% :(