From cf2154781443a1d7e83ee9bdea1148175035a3f1 Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 11 Mar 2009 23:23:08 +0000 Subject: (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. --- src/roadveh_cmd.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/roadveh_cmd.cpp') 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; } -- cgit v1.2.3-70-g09d2