summaryrefslogtreecommitdiff
path: root/vehicle.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-02-07 18:57:16 +0000
committerpeter1138 <peter1138@openttd.org>2006-02-07 18:57:16 +0000
commit6bc6c34b5ac3217e6306b734d58da48634b91f64 (patch)
tree298afe9585d01cd4b86ea70cd5ada7ff80bb0777 /vehicle.c
parentf491fa733b07b6016ac634e35579fb67b6eaad07 (diff)
downloadopenttd-6bc6c34b5ac3217e6306b734d58da48634b91f64.tar.xz
(svn r3571) - When loading a game, call TrainConsistChanged() for each train head separately before updating images, as v->first is used extensively in GetTrainImage() for custom graphics. This gives a significant speed improvement on loading a game.
Diffstat (limited to 'vehicle.c')
-rw-r--r--vehicle.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/vehicle.c b/vehicle.c
index 5d67f6200..281053e74 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -218,6 +218,11 @@ void AfterLoadVehicles(void)
FOR_ALL_VEHICLES(v) {
v->first = NULL;
+ if (v->type == VEH_Train && (IsFrontEngine(v) || IsFreeWagon(v)))
+ TrainConsistChanged(v);
+ }
+
+ FOR_ALL_VEHICLES(v) {
if (v->type != 0) {
switch (v->type) {
case VEH_Train: v->cur_image = GetTrainImage(v, v->direction); break;
@@ -234,9 +239,6 @@ void AfterLoadVehicles(void)
v->left_coord = INVALID_COORD;
VehiclePositionChanged(v);
-
- if (v->type == VEH_Train && (IsFrontEngine(v) || IsFreeWagon(v)))
- TrainConsistChanged(v);
}
}
}