Changeset - r25865:f0554c949dd2
[Not reviewed]
master
0 1 0
dP - 3 years ago 2021-07-31 19:46:36
dp@dpointer.org
Fix: Use of unstable sort when distributing cargo production can cause desyncs
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/station_cmd.cpp
Show inline comments
 
@@ -4080,7 +4080,7 @@ uint MoveGoodsToStation(CargoID type, ui
 

	
 
	/* 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;
 
		});
 

	
0 comments (0 inline, 0 general)