1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-21 21:49:10 +00:00

(svn r23713) -Codechange: split VehicleMove() into two functions, to minimalize the work done where possible

This commit is contained in:
truebrain
2012-01-02 13:44:30 +00:00
parent 19004a77f8
commit 0d929e877f
11 changed files with 70 additions and 52 deletions

View File

@@ -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;
}
}