summaryrefslogtreecommitdiff
path: root/src/train_cmd.cpp
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2012-01-02 13:44:37 +0000
committertruebrain <truebrain@openttd.org>2012-01-02 13:44:37 +0000
commit091bc25a90bb68118f7dbd0e4d750de266cbf855 (patch)
tree77aaea1eca3aa6705991e37d915c3e0aa5e4ce44 /src/train_cmd.cpp
parent0d929e877faf9572a80803db382ab973702e02c0 (diff)
downloadopenttd-091bc25a90bb68118f7dbd0e4d750de266cbf855.tar.xz
(svn r23714) -Codechange: don't mix Viewport with non-viewport code
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r--src/train_cmd.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 5ab9bb330..0dc5f59cd 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -1542,12 +1542,14 @@ static void UpdateStatusAfterSwap(Train *v)
/* We have just left the wormhole, possibly set the
* "goingdown" bit. UpdateInclination() can be used
* because we are at the border of the tile. */
+ VehicleUpdatePosition(v);
v->UpdateInclination(true, true);
return;
}
}
}
+ VehicleUpdatePosition(v);
v->UpdateViewport(true, true);
}
@@ -2155,10 +2157,8 @@ static bool CheckTrainStayInDepot(Train *v)
v->vehstatus &= ~VS_HIDDEN;
v->cur_speed = 0;
- v->UpdateDeltaXY(v->direction);
- v->cur_image = v->GetImage(v->direction, EIT_ON_MAP);
+ v->UpdateViewport(true, true);
VehicleUpdatePosition(v);
- VehicleUpdateViewport(v, false);
UpdateSignalsOnSegment(v->tile, INVALID_DIAGDIR, v->owner);
v->UpdateAcceleration();
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
@@ -3321,6 +3321,7 @@ bool TrainController(Train *v, Vehicle *nomove, bool reverse)
v->x_pos = gp.x;
v->y_pos = gp.y;
+ VehicleUpdatePosition(v);
/* update the Z position of the vehicle */
int old_z = v->UpdateInclination(gp.new_tile != gp.old_tile, false);
@@ -3488,7 +3489,10 @@ static void ChangeTrainDirRandomly(Train *v)
/* Refrain from updating the z position of the vehicle when on
* a bridge, because UpdateInclination() will put the vehicle under
* the bridge in that case */
- if (v->track != TRACK_BIT_WORMHOLE) v->UpdateInclination(false, false);
+ if (v->track != TRACK_BIT_WORMHOLE) {
+ VehicleUpdatePosition(v);
+ v->UpdateInclination(false, false);
+ }
}
} while ((v = v->Next()) != NULL);
}