mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-10 08:00:05 +00:00
Fix: Use of unstable sort when distributing cargo production can cause desyncs
This commit is contained in:
parent
6fce05689c
commit
c1d79398d5
@ -4080,7 +4080,7 @@ uint MoveGoodsToStation(CargoID type, uint amount, SourceType source_type, Sourc
|
|||||||
|
|
||||||
/* If there is some cargo left due to rounding issues distribute it among the best rated stations. */
|
/* If there is some cargo left due to rounding issues distribute it among the best rated stations. */
|
||||||
if (amount > moving) {
|
if (amount > moving) {
|
||||||
std::sort(used_stations.begin(), used_stations.end(), [type](const StationInfo &a, const StationInfo &b) {
|
std::stable_sort(used_stations.begin(), used_stations.end(), [type](const StationInfo &a, const StationInfo &b) {
|
||||||
return b.first->goods[type].rating < a.first->goods[type].rating;
|
return b.first->goods[type].rating < a.first->goods[type].rating;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user