(svn r21912) -Codechange: let road vehicles use gcache.last_speed/SetLastSpeed as well

This commit is contained in:
rubidium
2011-01-26 17:31:44 +00:00
parent 0f411f9899
commit aa1f02c248
3 changed files with 4 additions and 9 deletions

View File

@@ -651,7 +651,6 @@ static void RoadVehArrivesAt(const RoadVehicle *v, Station *st)
*/
static int RoadVehAccelerate(RoadVehicle *v)
{
uint oldspeed = v->cur_speed;
uint accel = v->overtaking != 0 ? 256 : 0;
accel += (_settings_game.vehicle.roadveh_acceleration_model == AM_ORIGINAL) ? 256 : v->GetAcceleration();
uint spd = v->subspeed + accel;
@@ -673,13 +672,6 @@ static int RoadVehAccelerate(RoadVehicle *v)
first->cur_speed = min(first->cur_speed, GetBridgeSpec(GetBridgeType(v->tile))->speed * 2);
}
/* Update statusbar only if speed has changed to save CPU time */
if (oldspeed != v->cur_speed) {
if (_settings_client.gui.vehicle_speed) {
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
}
int scaled_spd = v->GetAdvanceSpeed(spd);
scaled_spd += v->progress;
@@ -1497,6 +1489,8 @@ static bool RoadVehController(RoadVehicle *v)
if (j >= adv_spd && RoadVehCheckTrainCrash(v)) break;
}
v->SetLastSpeed();
for (RoadVehicle *u = v; u != NULL; u = u->Next()) {
if ((u->vehstatus & VS_HIDDEN) != 0) continue;