summaryrefslogtreecommitdiff
path: root/src/train_cmd.cpp
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2012-01-02 13:44:30 +0000
committertruebrain <truebrain@openttd.org>2012-01-02 13:44:30 +0000
commit0d929e877faf9572a80803db382ab973702e02c0 (patch)
treef19cea6421726b0719b1cfc7c403a8ac6262bc60 /src/train_cmd.cpp
parent19004a77f843fccd0850cc980dd2c80de6d81462 (diff)
downloadopenttd-0d929e877faf9572a80803db382ab973702e02c0.tar.xz
(svn r23713) -Codechange: split VehicleMove() into two functions, to minimalize the work done where possible
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r--src/train_cmd.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index cfce4b819..5ab9bb330 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -595,7 +595,7 @@ static CommandCost CmdBuildRailWagon(TileIndex tile, DoCommandFlag flags, const
_new_vehicle_id = v->index;
- VehicleMove(v, false);
+ VehicleUpdatePosition(v);
v->First()->ConsistChanged(false);
UpdateTrainGroupID(v->First());
@@ -657,7 +657,7 @@ static void AddRearEngineToMultiheadedTrain(Train *v)
v->SetMultiheaded();
u->SetMultiheaded();
v->SetNext(u);
- VehicleMove(u, false);
+ VehicleUpdatePosition(u);
/* Now we need to link the front and rear engines together */
v->other_multiheaded_part = u;
@@ -726,7 +726,7 @@ CommandCost CmdBuildRailVehicle(TileIndex tile, DoCommandFlag flags, const Engin
v->SetFrontEngine();
v->SetEngine();
- VehicleMove(v, false);
+ VehicleUpdatePosition(v);
if (rvi->railveh_type == RAILVEH_MULTIHEAD) {
AddRearEngineToMultiheadedTrain(v);
@@ -2157,7 +2157,8 @@ static bool CheckTrainStayInDepot(Train *v)
v->UpdateDeltaXY(v->direction);
v->cur_image = v->GetImage(v->direction, EIT_ON_MAP);
- VehicleMove(v, false);
+ VehicleUpdatePosition(v);
+ VehicleUpdateViewport(v, false);
UpdateSignalsOnSegment(v->tile, INVALID_DIAGDIR, v->owner);
v->UpdateAcceleration();
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
@@ -3309,7 +3310,8 @@ bool TrainController(Train *v, Vehicle *nomove, bool reverse)
} else {
v->x_pos = gp.x;
v->y_pos = gp.y;
- VehicleMove(v, !(v->vehstatus & VS_HIDDEN));
+ VehicleUpdatePosition(v);
+ if ((v->vehstatus & VS_HIDDEN) == 0) VehicleUpdateViewport(v, true);
continue;
}
}