mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r1015) MFM r789
Replaced the slightly misleading SERVICE_INTERVAL by a function VehicleNeedsService()
This commit is contained in:
parent
5a3ef18c94
commit
0ba5123cef
@ -461,7 +461,7 @@ static void CheckIfAircraftNeedsService(Vehicle *v)
|
|||||||
if (_patches.servint_aircraft == 0)
|
if (_patches.servint_aircraft == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (SERVICE_INTERVAL)
|
if (!VehicleNeedsService(v))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (v->vehstatus & VS_STOPPED)
|
if (v->vehstatus & VS_STOPPED)
|
||||||
@ -997,7 +997,7 @@ static void ProcessAircraftOrder(Vehicle *v)
|
|||||||
|
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT &&
|
if (v->current_order.type == OT_GOTO_DEPOT &&
|
||||||
(v->current_order.flags & (OF_UNLOAD | OF_FULL_LOAD)) == (OF_UNLOAD | OF_FULL_LOAD) &&
|
(v->current_order.flags & (OF_UNLOAD | OF_FULL_LOAD)) == (OF_UNLOAD | OF_FULL_LOAD) &&
|
||||||
SERVICE_INTERVAL) {
|
!VehicleNeedsService(v)) {
|
||||||
v->cur_order_index++;
|
v->cur_order_index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,7 +569,7 @@ static void ProcessRoadVehOrder(Vehicle *v)
|
|||||||
|
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT &&
|
if (v->current_order.type == OT_GOTO_DEPOT &&
|
||||||
(v->current_order.flags & (OF_UNLOAD | OF_FULL_LOAD)) == (OF_UNLOAD | OF_FULL_LOAD) &&
|
(v->current_order.flags & (OF_UNLOAD | OF_FULL_LOAD)) == (OF_UNLOAD | OF_FULL_LOAD) &&
|
||||||
SERVICE_INTERVAL ) {
|
!VehicleNeedsService(v)) {
|
||||||
v->cur_order_index++;
|
v->cur_order_index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1433,7 +1433,7 @@ static void CheckIfRoadVehNeedsService(Vehicle *v)
|
|||||||
if (_patches.servint_roadveh == 0)
|
if (_patches.servint_roadveh == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (SERVICE_INTERVAL)
|
if (!VehicleNeedsService(v))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (v->vehstatus & VS_STOPPED)
|
if (v->vehstatus & VS_STOPPED)
|
||||||
|
@ -89,7 +89,7 @@ static void CheckIfShipNeedsService(Vehicle *v)
|
|||||||
if (_patches.servint_ships == 0)
|
if (_patches.servint_ships == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (SERVICE_INTERVAL)
|
if (!VehicleNeedsService(v))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (v->vehstatus & VS_STOPPED)
|
if (v->vehstatus & VS_STOPPED)
|
||||||
@ -214,7 +214,7 @@ static void ProcessShipOrder(Vehicle *v)
|
|||||||
|
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT &&
|
if (v->current_order.type == OT_GOTO_DEPOT &&
|
||||||
(v->current_order.flags & (OF_UNLOAD | OF_FULL_LOAD)) == (OF_UNLOAD | OF_FULL_LOAD) &&
|
(v->current_order.flags & (OF_UNLOAD | OF_FULL_LOAD)) == (OF_UNLOAD | OF_FULL_LOAD) &&
|
||||||
SERVICE_INTERVAL) {
|
!VehicleNeedsService(v)) {
|
||||||
v->cur_order_index++;
|
v->cur_order_index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1589,7 +1589,7 @@ static bool ProcessTrainOrder(Vehicle *v)
|
|||||||
|
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT &&
|
if (v->current_order.type == OT_GOTO_DEPOT &&
|
||||||
(v->current_order.flags & (OF_UNLOAD | OF_FULL_LOAD)) == (OF_UNLOAD | OF_FULL_LOAD) &&
|
(v->current_order.flags & (OF_UNLOAD | OF_FULL_LOAD)) == (OF_UNLOAD | OF_FULL_LOAD) &&
|
||||||
SERVICE_INTERVAL) {
|
!VehicleNeedsService(v)) {
|
||||||
v->cur_order_index++;
|
v->cur_order_index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2597,7 +2597,7 @@ static void CheckIfTrainNeedsService(Vehicle *v)
|
|||||||
if (_patches.servint_trains == 0)
|
if (_patches.servint_trains == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (SERVICE_INTERVAL)
|
if (!VehicleNeedsService(v))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (v->vehstatus & VS_STOPPED)
|
if (v->vehstatus & VS_STOPPED)
|
||||||
|
@ -22,6 +22,13 @@ void VehicleServiceInDepot(Vehicle *v)
|
|||||||
v->reliability = _engines[v->engine_type].reliability;
|
v->reliability = _engines[v->engine_type].reliability;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VehicleNeedsService(const Vehicle *v)
|
||||||
|
{
|
||||||
|
return _patches.servint_ispercent ?
|
||||||
|
(v->reliability < _engines[v->engine_type].reliability * (100 - v->service_interval) / 100) :
|
||||||
|
(v->date_of_last_service + v->service_interval < _date);
|
||||||
|
}
|
||||||
|
|
||||||
Order UnpackOldOrder(uint16 packed)
|
Order UnpackOldOrder(uint16 packed)
|
||||||
{
|
{
|
||||||
Order order;
|
Order order;
|
||||||
|
@ -390,6 +390,8 @@ int CheckStoppedInDepot(Vehicle *v);
|
|||||||
int ScheduleHasDepotOrders(const Order *schedule);
|
int ScheduleHasDepotOrders(const Order *schedule);
|
||||||
int CheckOrders(Vehicle *v);
|
int CheckOrders(Vehicle *v);
|
||||||
|
|
||||||
|
bool VehicleNeedsService(const Vehicle *v);
|
||||||
|
|
||||||
typedef struct GetNewVehiclePosResult {
|
typedef struct GetNewVehiclePosResult {
|
||||||
int x,y;
|
int x,y;
|
||||||
uint old_tile;
|
uint old_tile;
|
||||||
@ -449,7 +451,6 @@ VARDEF BackuppedOrders _backup_orders_data[1];
|
|||||||
|
|
||||||
#define INVALID_VEHICLE 0xffff
|
#define INVALID_VEHICLE 0xffff
|
||||||
|
|
||||||
#define SERVICE_INTERVAL (_patches.servint_ispercent ? (v->reliability > _engines[v->engine_type].reliability * (100 - v->service_interval) / 100) : (v->date_of_last_service + v->service_interval > _date))
|
|
||||||
#define MIN_SERVINT_PERCENT 5
|
#define MIN_SERVINT_PERCENT 5
|
||||||
#define MAX_SERVINT_PERCENT 90
|
#define MAX_SERVINT_PERCENT 90
|
||||||
#define MIN_SERVINT_DAYS 30
|
#define MIN_SERVINT_DAYS 30
|
||||||
|
Loading…
Reference in New Issue
Block a user