summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordP <dp@dpointer.org>2021-07-31 22:46:36 +0300
committerrubidium42 <rubidium42@users.noreply.github.com>2021-08-01 07:43:49 +0200
commitc1d79398d57b4b8a013fcca62e72a5ce9efc137f (patch)
treed072445a3756f390b63ef9a8758d7047a18c4962 /src
parent6fce05689cd6828c215156bb41950178ed9a8708 (diff)
downloadopenttd-c1d79398d57b4b8a013fcca62e72a5ce9efc137f.tar.xz
Fix: Use of unstable sort when distributing cargo production can cause desyncs
Diffstat (limited to 'src')
-rw-r--r--src/station_cmd.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index a58c7b1f2..6a5cabc8d 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -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 (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;
});