Moderator: OpenTTD Developers
It's my first patch and my first c++ in 10 years, so any feedback is welcome.
It works as follows:
When the game tries to deliver the cargo from the unloading vehicle to the industry instead of finding the first one and drop all the items in that industry it first checks how much accepting industries there are.
If there is only one it will drop the cargo on that one.
If there is more than one it will divide the amount of cargo evenly over all the industries, and buffer the remaining cargo for the next run.
Eg: 5 items of cargo delivered to 2 factories mean both factories will get 2 items and 1 item will be buffered. When the next 5 units arrive it will add the 1 still buffered and deliver 3 cargo to the factories.
The buffered cargo isn't saved when saving (As far as I know, I don't know how data is getting saved), so saving and loading may cause some lost cargo, but this is only a small amount (< num factories for the station per station). I don't think it's worth
I'm not sure how this patch will work in multiplayer or if it will cause desyncs, I've got no knowledge about how the multiplayer code works.
Note that when applying the patch to an already patched game or newer version it may be needed to manually adjust the savegame version in saveload.cpp and settings.ini
There is a setting to toggle the function on and off, By default, it is off. So you have to enable this manually.
I've also tried adding a "buffered cargo", which i called "fraction cargo" but instead of making it part of the station struct, I made it part of the Industry instead.
It didn't do as well as yours. I was getting a high degree of variance on cargo delivered per industry.
When I tried yours, I got a better picture.
Wish I had the code to show you, but I gave up on it.
saving is essential for multiplayer-safety. all players must get the exact same game state, which is done by transferring a savegame.Bartje321 wrote:The buffered cargo isn't saved when saving [...] I don't think it's worth
I'm not sure how this patch will work in multiplayer or if it will cause desyncs
so even if you think one or two cargo pieces is not that relevant, it's exactly that one or two difference that will cause a desync in multiplayer. (this is also why we cannot use floating point numbers, because we cannot have any rounding errors)
Users browsing this forum: No registered users and 3 guests