summaryrefslogtreecommitdiff
path: root/src/roadveh_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-03-11 23:23:08 +0000
committerrubidium <rubidium@openttd.org>2009-03-11 23:23:08 +0000
commitcf2154781443a1d7e83ee9bdea1148175035a3f1 (patch)
tree73723c985bcb7e6ab94063941b576ac50be805f0 /src/roadveh_cmd.cpp
parent655b0ccc2ec4cba709a35f4a5fff9f0858a24aa3 (diff)
downloadopenttd-cf2154781443a1d7e83ee9bdea1148175035a3f1.tar.xz
(svn r15677) -Fix [FS#2546]: vehicle images would be determined during the process of moving the vehicle which means that only the (orientation) data for the vehicles in front of it is valid. Now the data for the vehicles behind the vehicle are valid too.
Diffstat (limited to 'src/roadveh_cmd.cpp')
-rw-r--r--src/roadveh_cmd.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index eecf6741f..fa68a9247 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -1248,7 +1248,6 @@ static bool RoadVehLeaveDepot(Vehicle *v, bool first)
v->u.road.state = tdir;
v->u.road.frame = RVC_DEPOT_START_FRAME;
- v->cur_image = v->GetImage(v->direction);
v->UpdateDeltaXY(v->direction);
SetRoadVehPosition(v, x, y);
@@ -1377,7 +1376,6 @@ static bool IndividualRoadVehicleController(Vehicle *v, const Vehicle *prev)
if (IsTileType(gp.new_tile, MP_TUNNELBRIDGE) && HasBit(VehicleEnterTile(v, gp.new_tile, gp.x, gp.y), VETS_ENTERED_WORMHOLE)) {
/* Vehicle has just entered a bridge or tunnel */
- v->cur_image = v->GetImage(v->direction);
v->UpdateDeltaXY(v->direction);
SetRoadVehPosition(v, gp.x, gp.y);
return true;
@@ -1524,7 +1522,6 @@ again:
v->cur_speed -= v->cur_speed >> 2;
}
- v->cur_image = v->GetImage(v->direction);
v->UpdateDeltaXY(v->direction);
RoadZPosAffectSpeed(v, SetRoadVehPosition(v, x, y));
return true;
@@ -1590,7 +1587,6 @@ again:
v->cur_speed -= v->cur_speed >> 2;
}
- v->cur_image = v->GetImage(v->direction);
v->UpdateDeltaXY(v->direction);
RoadZPosAffectSpeed(v, SetRoadVehPosition(v, x, y));
return true;
@@ -1631,7 +1627,6 @@ again:
v->cur_speed -= (v->cur_speed >> 2);
if (old_dir != v->u.road.state) {
/* The vehicle is in a road stop */
- v->cur_image = v->GetImage(v->direction);
v->UpdateDeltaXY(v->direction);
SetRoadVehPosition(v, v->x_pos, v->y_pos);
/* Note, return here means that the frame counter is not incremented
@@ -1755,7 +1750,6 @@ again:
* in a depot or entered a tunnel/bridge */
if (!HasBit(r, VETS_ENTERED_WORMHOLE)) v->u.road.frame++;
- v->cur_image = v->GetImage(v->direction);
v->UpdateDeltaXY(v->direction);
RoadZPosAffectSpeed(v, SetRoadVehPosition(v, x, y));
return true;
@@ -1813,6 +1807,14 @@ static void RoadVehController(Vehicle *v)
if (j >= adv_spd && RoadVehCheckTrainCrash(v)) break;
}
+ for (Vehicle *u = v; u != NULL; u = u->Next()) {
+ if ((u->vehstatus & VS_HIDDEN) != 0) continue;
+
+ uint16 old_image = u->cur_image;
+ u->cur_image = u->GetImage(u->direction);
+ if (old_image != u->cur_image) VehicleMove(u, true);
+ }
+
if (v->progress == 0) v->progress = j;
}