(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.

This commit is contained in:
rubidium
2009-03-11 23:23:08 +00:00
parent 655b0ccc2e
commit cf21547814
2 changed files with 22 additions and 13 deletions

View File

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