summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-01-16 15:45:20 +0000
committerrubidium <rubidium@openttd.org>2007-01-16 15:45:20 +0000
commitf3796eee66f9163fecbb36560d3742641caae04b (patch)
treece9f0aba36df8824453df58a7d761923fa98762e /src
parentccbe68d5bc1098858f1ff57f527de8c1180259fc (diff)
downloadopenttd-f3796eee66f9163fecbb36560d3742641caae04b.tar.xz
(svn r8157) -Fix (r3136): moving cargo during auto replaces did not update the cached vehicle weight for trains properly. This caused (in network games) the server to have a different cached vehicle weight than newly joined clients would have, which causes desyncs.
Diffstat (limited to 'src')
-rw-r--r--src/vehicle.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index d2a44652d..07399e101 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -1901,6 +1901,14 @@ static void MoveVehicleCargo(Vehicle *dest, Vehicle *source)
} while (source->cargo_count > 0 && (dest = dest->next) != NULL);
dest = v;
} while ((source = source->next) != NULL);
+
+ /*
+ * The of the train will be incorrect at this moment. This is due
+ * to the fact that removing the old wagon updates the weight of
+ * the complete train, which is without the weight of cargo we just
+ * moved back into some (of the) new wagon(s).
+ */
+ if (dest->type == VEH_Train) TrainConsistChanged(dest->first);
}
static bool VerifyAutoreplaceRefitForOrders(const Vehicle *v, const EngineID engine_type)