|
|
|
@ -680,7 +680,10 @@ static RoadVehicle *RoadVehFindCloseTo(RoadVehicle *v, int x, int y, Direction d
|
|
|
|
|
|
|
|
|
|
if (update_blocked_ctr && ++front->blocked_ctr > 1480) return NULL;
|
|
|
|
|
|
|
|
|
|
return RoadVehicle::From(rvf.best);
|
|
|
|
|
RoadVehicle *rv = RoadVehicle::From(rvf.best);
|
|
|
|
|
if (rv != NULL && front->IsRoadVehicleOnLevelCrossing() && (rv->First()->cur_speed == 0 || rv->First()->IsRoadVehicleStopped())) return NULL;
|
|
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -851,7 +854,7 @@ static void RoadVehCheckOvertake(RoadVehicle *v, RoadVehicle *u)
|
|
|
|
|
|
|
|
|
|
/* When the vehicle in front of us is stopped we may only take
|
|
|
|
|
* half the time to pass it than when the vehicle is moving. */
|
|
|
|
|
v->overtaking_ctr = (od.u->cur_speed == 0 || (od.u->vehstatus & VS_STOPPED)) ? RV_OVERTAKE_TIMEOUT / 2 : 0;
|
|
|
|
|
v->overtaking_ctr = (od.u->cur_speed == 0 || od.u->IsRoadVehicleStopped()) ? RV_OVERTAKE_TIMEOUT / 2 : 0;
|
|
|
|
|
v->overtaking = RVSB_DRIVE_SIDE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1559,7 +1562,11 @@ static bool RoadVehController(RoadVehicle *v)
|
|
|
|
|
|
|
|
|
|
/* road vehicle has broken down? */
|
|
|
|
|
if (v->HandleBreakdown()) return true;
|
|
|
|
|
if (v->vehstatus & VS_STOPPED) return true;
|
|
|
|
|
if (v->IsRoadVehicleStopped()) {
|
|
|
|
|
v->cur_speed = 0;
|
|
|
|
|
v->SetLastSpeed();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProcessOrders(v);
|
|
|
|
|
v->HandleLoading();
|
|
|
|
@ -1629,7 +1636,7 @@ bool RoadVehicle::Tick()
|
|
|
|
|
this->tick_counter++;
|
|
|
|
|
|
|
|
|
|
if (this->IsFrontEngine()) {
|
|
|
|
|
if (!(this->vehstatus & VS_STOPPED)) this->running_ticks++;
|
|
|
|
|
if (!(this->IsRoadVehicleStopped())) this->running_ticks++;
|
|
|
|
|
return RoadVehController(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|