You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The "improved loading" setting should have the effect that multiple "full load" consists loading at the same station should only load in parallel if there is enough cargo to fill them all. Otherwise the consists arriving later should wait with their loading until more cargo is available. However, there are certain corner cases where this doesn't work. See the attached savegame as example. If you just load it and let it run you will notice train 2 and 3 arriving at Duston North in quick succession, unloading there and starting to load. However, instead of filling one of them completely and one only partly the game will fill one to 98% and one to 35%. Obviously the improved loading fails.
This is due to an inconsistency in how cargo is "reserved" in the cargo_left array in SaveUnloadVehicle. When unloading cargo, as we don't know how much cargo will be unloaded, only the free capacity is reserved. The free capacity can grow as more cargo is unloaded, but the available cargo which should be loaded into the additional free capacity, can in the mean time (as it's not reserved, yet) be loaded by a different consist.
Furthermore, the reservation is only performed in ticks where no loading or unloading is done ("if (front->load_unload_ticks != 0)" in economy.cpp:1250). This means in ticks where a consist actually unloads, any later consist is free to "steal" cargo from it.
step1.sav actually shows a different effect. Due to station rating cargo can disappear while vehicles are loading. 333.sav shows the real thing. And there is a trivial fix for it, too. While a vehicle is unloading we can just reserve for its full capacity. If the reservation is decreased later not much harm is done. It will look to any following consist like new cargo appearing at the station.
The comment about not reserving while unloading is not true, as we're running the same reservation thing again in economy.cpp:1568ff. However, there we only run it if not autorefitting, which could potentially create other funny corner cases. The attached patch runs that part also in autorefit and still reserves for the vehicle in case it's unloading.
fonsinchen opened the ticket and wrote:
Attachments
Reported version: trunk
Operating system: All
This issue was imported from FlySpray: https://bugs.openttd.org/task/5438
The text was updated successfully, but these errors were encountered: