mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
This commit is contained in:
parent
b4cf633f66
commit
85628544ee
|
@ -529,7 +529,7 @@ static void CheckIfAircraftNeedsService(Vehicle *v)
|
|||
if (_patches.servint_aircraft == 0)
|
||||
return;
|
||||
|
||||
if (v->date_of_last_service + v->service_interval > _date)
|
||||
if (SERVICE_INTERVAL)
|
||||
return;
|
||||
|
||||
if (v->vehstatus & VS_STOPPED)
|
||||
|
@ -1061,7 +1061,7 @@ static void ProcessAircraftOrder(Vehicle *v)
|
|||
}
|
||||
|
||||
if ((v->next_order & (OT_MASK|OF_UNLOAD|OF_FULL_LOAD)) == (OT_GOTO_DEPOT|OF_UNLOAD|OF_FULL_LOAD) &&
|
||||
v->date_of_last_service+v->service_interval > _date) {
|
||||
SERVICE_INTERVAL) {
|
||||
v->cur_order_index++;
|
||||
}
|
||||
|
||||
|
|
|
@ -309,6 +309,9 @@ static void AircraftDetailsWndProc(Window *w, WindowEvent *e)
|
|||
switch(e->event) {
|
||||
case WE_PAINT:
|
||||
w->disabled_state = v->owner == _local_player ? 0 : (1 << 2);
|
||||
if (!_patches.servint_aircraft) // disable service-scroller when interval is set to disabled
|
||||
w->disabled_state |= (1 << 5) | (1 << 6);
|
||||
|
||||
SET_DPARAM16(0, v->string_id);
|
||||
SET_DPARAM16(1, v->unitnumber);
|
||||
DrawWindowWidgets(w);
|
||||
|
@ -356,7 +359,7 @@ static void AircraftDetailsWndProc(Window *w, WindowEvent *e)
|
|||
{
|
||||
SET_DPARAM16(0, v->service_interval);
|
||||
SET_DPARAM16(1, v->date_of_last_service);
|
||||
DrawString(13, 103, STR_883C_SERVICING_INTERVAL_DAYS, 0);
|
||||
DrawString(13, 103, _patches.servint_ispercent?STR_SERVICING_INTERVAL_PERCENT:STR_883C_SERVICING_INTERVAL_DAYS, 0);
|
||||
}
|
||||
|
||||
DrawAircraftImage(v, 3, 57, INVALID_VEHICLE);
|
||||
|
@ -403,14 +406,19 @@ static void AircraftDetailsWndProc(Window *w, WindowEvent *e)
|
|||
break;
|
||||
|
||||
case 5: /* increase int */
|
||||
mod = 10;
|
||||
mod = _ctrl_pressed? 5 : 10;
|
||||
goto change_int;
|
||||
case 6: /* decrease int */
|
||||
mod = -10;
|
||||
mod = _ctrl_pressed?- 5 : -10;
|
||||
change_int:
|
||||
mod += v->service_interval;
|
||||
if (!IS_INT_INSIDE(mod, 30, 800+1))
|
||||
|
||||
/* %-based service interval max 5%-90%
|
||||
day-based service interval max 30-800 days */
|
||||
mod = _patches.servint_ispercent ? clamp(mod, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : clamp(mod, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS+1);
|
||||
if (mod == v->service_interval)
|
||||
return;
|
||||
|
||||
DoCommandP(v->tile, v->index, mod, NULL,
|
||||
CMD_CHANGE_AIRCRAFT_SERVICE_INT | CMD_MSG(STR_018A_CAN_T_CHANGE_SERVICING));
|
||||
break;
|
||||
|
|
|
@ -1003,13 +1003,13 @@ STR_CONFIG_PATCHES_AI_BUILDS_SHIPS :{LTBLUE}Disable ships for computer: {ORANGE
|
|||
|
||||
STR_CONFIG_PATCHES_AINEW_ACTIVE :{LTBLUE}Enable new AI (alpha): {ORANGE}{STRING}
|
||||
|
||||
STR_CONFIG_PATCHES_SERVINT_TRAINS :{LTBLUE}Default service interval for trains: {ORANGE}{STRING} days
|
||||
STR_CONFIG_PATCHES_SERVINT_TRAINS :{LTBLUE}Default service interval for trains: {ORANGE}{STRING} days/%
|
||||
STR_CONFIG_PATCHES_SERVINT_TRAINS_DISABLED :{LTBLUE}Default service interval for trains: {ORANGE}disabled
|
||||
STR_CONFIG_PATCHES_SERVINT_ROADVEH :{LTBLUE}Default service interval for road vehicles: {ORANGE}{STRING} days
|
||||
STR_CONFIG_PATCHES_SERVINT_ROADVEH :{LTBLUE}Default service interval for road vehicles: {ORANGE}{STRING} days/%
|
||||
STR_CONFIG_PATCHES_SERVINT_ROADVEH_DISABLED :{LTBLUE}Default service interval for road vehicles: {ORANGE}disabled
|
||||
STR_CONFIG_PATCHES_SERVINT_AIRCRAFT :{LTBLUE}Default service interval for aircraft: {ORANGE}{STRING} days
|
||||
STR_CONFIG_PATCHES_SERVINT_AIRCRAFT :{LTBLUE}Default service interval for aircraft: {ORANGE}{STRING} days/%
|
||||
STR_CONFIG_PATCHES_SERVINT_AIRCRAFT_DISABLED :{LTBLUE}Default service interval for aircraft: {ORANGE}disabled
|
||||
STR_CONFIG_PATCHES_SERVINT_SHIPS :{LTBLUE}Default service interval for ships: {ORANGE}{STRING} days
|
||||
STR_CONFIG_PATCHES_SERVINT_SHIPS :{LTBLUE}Default service interval for ships: {ORANGE}{STRING} days/%
|
||||
STR_CONFIG_PATCHES_SERVINT_SHIPS_DISABLED :{LTBLUE}Default service interval for ships: {ORANGE}disabled
|
||||
|
||||
STR_CONFIG_PATCHES_COLORED_NEWS_DATE :{LTBLUE}Coloured news appears in: {ORANGE}{STRING}
|
||||
|
@ -1033,6 +1033,7 @@ STR_CONFIG_PATCHES_INT32 :{INT32}
|
|||
STR_CONFIG_PATCHES_CURRENCY :{CURRENCY}
|
||||
|
||||
STR_CONFIG_PATCHES_QUERY_CAPT :{WHITE}Change setting value
|
||||
STR_CONFIG_PATCHES_SERVICE_INTERVAL_INCOMPATIBLE :{WHITE}Some or all of the default service interval(s) below are incompatible with chosen setting! 5-90% and 30-800 days are valid
|
||||
|
||||
STR_TEMPERATE_LANDSCAPE :temperate landscape
|
||||
STR_SUB_ARCTIC_LANDSCAPE :sub-arctic landscape
|
||||
|
@ -1151,6 +1152,7 @@ STR_RAIL_REFIT_VEHICLE :{BLACK}Refit train
|
|||
STR_RAIL_SELECT_TYPE_OF_CARGO_FOR :{BLACK}Select type of cargo for train to carry
|
||||
STR_RAIL_REFIT_TO_CARRY_HIGHLIGHTED :{BLACK}Refit train to carry highlighted cargo type
|
||||
STR_RAIL_CAN_T_REFIT_VEHICLE :{WHITE}Can't refit train...
|
||||
STR_CONFIG_PATCHES_SERVINT_ISPERCENT :{LTBLUE}Service intervals are in percents: {ORANGE}{STRING}
|
||||
|
||||
TEMP_AI_IN_PROGRESS :{WHITE}Welcome to this new AI, in progress. You can expect problems. When you do, make a screenshot and post it at the forum. Enjoy!
|
||||
TEMP_AI_ACTIVATED :{WHITE}Warning: this new AI is still alpha! Currently, only trucks and busses work!
|
||||
|
@ -2261,6 +2263,7 @@ STR_8839_CAN_T_SELL_RAILROAD_VEHICLE :{WHITE}Can't sell railway vehicle...
|
|||
STR_883A_UNABLE_TO_FIND_ROUTE_TO :{WHITE}Unable to find route to local depot
|
||||
STR_883B_CAN_T_STOP_START_TRAIN :{WHITE}Can't stop/start train...
|
||||
STR_883C_SERVICING_INTERVAL_DAYS :{BLACK}Servicing interval: {LTBLUE}{COMMA16}days{BLACK} Last service: {LTBLUE}{DATE_LONG}
|
||||
STR_SERVICING_INTERVAL_PERCENT :{BLACK}Servicing interval: {LTBLUE}{COMMA16}%{BLACK} Last service: {LTBLUE}{DATE_LONG}
|
||||
STR_883D_TRAINS_CLICK_ON_TRAIN_FOR :{BLACK}Trains - click on train for information
|
||||
STR_883E_BUILD_NEW_TRAINS_REQUIRES :{BLACK}Build new trains (requires train depot)
|
||||
STR_883F_TRAINS_CLICK_ON_TRAIN_FOR :{BLACK}Trains - click on train for info., drag vehicle to add/remove from train
|
||||
|
|
|
@ -651,7 +651,7 @@ static void ProcessRoadVehOrder(Vehicle *v)
|
|||
}
|
||||
|
||||
if ((v->next_order & (OT_MASK|OF_UNLOAD|OF_FULL_LOAD)) == (OT_GOTO_DEPOT|OF_UNLOAD|OF_FULL_LOAD) &&
|
||||
v->date_of_last_service+v->service_interval > _date) {
|
||||
SERVICE_INTERVAL ) {
|
||||
v->cur_order_index++;
|
||||
}
|
||||
|
||||
|
@ -1500,7 +1500,7 @@ static void CheckIfRoadVehNeedsService(Vehicle *v)
|
|||
if (_patches.servint_roadveh == 0)
|
||||
return;
|
||||
|
||||
if (v->date_of_last_service + v->service_interval > _date)
|
||||
if (SERVICE_INTERVAL)
|
||||
return;
|
||||
|
||||
if (v->vehstatus & VS_STOPPED)
|
||||
|
|
|
@ -39,6 +39,9 @@ static void RoadVehDetailsWndProc(Window *w, WindowEvent *e)
|
|||
switch(e->event) {
|
||||
case WE_PAINT:
|
||||
w->disabled_state = v->owner == _local_player ? 0 : (1 << 2);
|
||||
if (!_patches.servint_roadveh) // disable service-scroller when interval is set to disabled
|
||||
w->disabled_state |= (1 << 5) | (1 << 6);
|
||||
|
||||
SET_DPARAM16(0, v->string_id);
|
||||
SET_DPARAM16(1, v->unitnumber);
|
||||
DrawWindowWidgets(w);
|
||||
|
@ -86,7 +89,7 @@ static void RoadVehDetailsWndProc(Window *w, WindowEvent *e)
|
|||
{
|
||||
SET_DPARAM16(0, v->service_interval);
|
||||
SET_DPARAM16(1, v->date_of_last_service);
|
||||
DrawString(13, 90, STR_883C_SERVICING_INTERVAL_DAYS, 0);
|
||||
DrawString(13, 90, _patches.servint_ispercent?STR_SERVICING_INTERVAL_PERCENT:STR_883C_SERVICING_INTERVAL_DAYS, 0);
|
||||
}
|
||||
|
||||
DrawRoadVehImage(v, 3, 57, INVALID_VEHICLE);
|
||||
|
@ -118,14 +121,19 @@ static void RoadVehDetailsWndProc(Window *w, WindowEvent *e)
|
|||
break;
|
||||
|
||||
case 5: /* increase int */
|
||||
mod = 10;
|
||||
mod = _ctrl_pressed? 5 : 10;
|
||||
goto change_int;
|
||||
case 6: /* decrease int */
|
||||
mod = -10;
|
||||
mod = _ctrl_pressed? -5 : -10;
|
||||
change_int:
|
||||
mod += v->service_interval;
|
||||
if (!IS_INT_INSIDE(mod, 30, 800+1))
|
||||
|
||||
/* %-based service interval max 5%-90%
|
||||
day-based service interval max 30-800 days */
|
||||
mod = _patches.servint_ispercent ? clamp(mod, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : clamp(mod, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS+1);
|
||||
if (mod == v->service_interval)
|
||||
return;
|
||||
|
||||
DoCommandP(v->tile, v->index, mod, NULL, CMD_CHANGE_ROADVEH_SERVICE_INT | CMD_MSG(STR_018A_CAN_T_CHANGE_SERVICING));
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -835,6 +835,7 @@ static const SettingDesc patch_settings[] = {
|
|||
{"max_aircraft", SDT_UINT8, (void*)40,(void*)offsetof(Patches, max_aircraft)},
|
||||
{"max_ships", SDT_UINT8, (void*)50,(void*)offsetof(Patches, max_ships)},
|
||||
|
||||
{"servint_ispercent", SDT_BOOL, (void*)false,(void*)offsetof(Patches, servint_ispercent)},
|
||||
{"servint_trains", SDT_UINT16, (void*)150,(void*)offsetof(Patches, servint_trains)},
|
||||
{"servint_roadveh", SDT_UINT16, (void*)150,(void*)offsetof(Patches, servint_roadveh)},
|
||||
{"servint_ships", SDT_UINT16, (void*)360,(void*)offsetof(Patches, servint_ships)},
|
||||
|
|
|
@ -684,6 +684,34 @@ int32 InvisibleTreesActive(int32 p1)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32 InValidateDetailsWindow(int32 p1)
|
||||
{
|
||||
InvalidateWindowClasses(WC_VEHICLE_DETAILS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check service intervals of vehicles, p1 is value of % or day based servicing */
|
||||
int32 CheckInterval(int32 p1)
|
||||
{
|
||||
bool warning;
|
||||
if (p1) {
|
||||
warning = ( (IS_INT_INSIDE(_patches.servint_trains, 5, 90+1) || _patches.servint_trains == 0) &&
|
||||
(IS_INT_INSIDE(_patches.servint_roadveh, 5, 90+1) || _patches.servint_roadveh == 0) &&
|
||||
(IS_INT_INSIDE(_patches.servint_aircraft, 5, 90+1) || _patches.servint_aircraft == 0) &&
|
||||
(IS_INT_INSIDE(_patches.servint_ships, 5, 90+1) || _patches.servint_ships == 0) );
|
||||
} else {
|
||||
warning = ( (IS_INT_INSIDE(_patches.servint_trains, 30, 800+1) || _patches.servint_trains == 0) &&
|
||||
(IS_INT_INSIDE(_patches.servint_roadveh, 30, 800+1) || _patches.servint_roadveh == 0) &&
|
||||
(IS_INT_INSIDE(_patches.servint_aircraft, 30, 800+1) || _patches.servint_aircraft == 0) &&
|
||||
(IS_INT_INSIDE(_patches.servint_ships, 30, 800+1) || _patches.servint_ships == 0) );
|
||||
}
|
||||
|
||||
if (!warning)
|
||||
ShowErrorMessage(-1, STR_CONFIG_PATCHES_SERVICE_INTERVAL_INCOMPATIBLE, 0, 0);
|
||||
|
||||
return InValidateDetailsWindow(0);
|
||||
}
|
||||
|
||||
typedef int32 PatchButtonClick(int32);
|
||||
|
||||
typedef struct PatchEntry {
|
||||
|
@ -754,10 +782,11 @@ static const PatchEntry _patches_vehicles[] = {
|
|||
{PE_UINT8, 0, STR_CONFIG_PATCHES_MAX_AIRCRAFT, &_patches.max_aircraft, 0, 240, 10},
|
||||
{PE_UINT8, 0, STR_CONFIG_PATCHES_MAX_SHIPS, &_patches.max_ships, 0, 240, 10},
|
||||
|
||||
{PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_SERVINT_TRAINS, &_patches.servint_trains, 30, 1200, 10},
|
||||
{PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_SERVINT_ROADVEH, &_patches.servint_roadveh, 30, 1200, 10},
|
||||
{PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_SERVINT_AIRCRAFT, &_patches.servint_aircraft, 30, 1200, 10},
|
||||
{PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_SERVINT_SHIPS, &_patches.servint_ships, 30, 1200, 10},
|
||||
{PE_BOOL, 0, STR_CONFIG_PATCHES_SERVINT_ISPERCENT, &_patches.servint_ispercent, 0, 0, 0, &CheckInterval},
|
||||
{PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_SERVINT_TRAINS, &_patches.servint_trains, 5, 800, 5, &InValidateDetailsWindow},
|
||||
{PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_SERVINT_ROADVEH, &_patches.servint_roadveh, 5, 800, 5, &InValidateDetailsWindow},
|
||||
{PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_SERVINT_AIRCRAFT, &_patches.servint_aircraft, 5, 800, 5, &InValidateDetailsWindow},
|
||||
{PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_SERVINT_SHIPS, &_patches.servint_ships, 5, 800, 5, &InValidateDetailsWindow},
|
||||
};
|
||||
|
||||
static const PatchEntry _patches_stations[] = {
|
||||
|
|
|
@ -88,7 +88,7 @@ static void CheckIfShipNeedsService(Vehicle *v)
|
|||
if (_patches.servint_ships == 0)
|
||||
return;
|
||||
|
||||
if (v->date_of_last_service + v->service_interval > _date)
|
||||
if (SERVICE_INTERVAL)
|
||||
return;
|
||||
|
||||
if (v->vehstatus & VS_STOPPED)
|
||||
|
@ -206,7 +206,7 @@ static void ProcessShipOrder(Vehicle *v)
|
|||
}
|
||||
|
||||
if ((v->next_order & (OT_MASK|OF_UNLOAD|OF_FULL_LOAD)) == (OT_GOTO_DEPOT|OF_UNLOAD|OF_FULL_LOAD) &&
|
||||
v->date_of_last_service+v->service_interval > _date) {
|
||||
SERVICE_INTERVAL) {
|
||||
v->cur_order_index++;
|
||||
}
|
||||
|
||||
|
|
16
ship_gui.c
16
ship_gui.c
|
@ -154,6 +154,9 @@ static void ShipDetailsWndProc(Window *w, WindowEvent *e)
|
|||
switch(e->event) {
|
||||
case WE_PAINT:
|
||||
w->disabled_state = v->owner == _local_player ? 0 : (1 << 2);
|
||||
if (!_patches.servint_ships) // disable service-scroller when interval is set to disabled
|
||||
w->disabled_state |= (1 << 5) | (1 << 6);
|
||||
|
||||
SET_DPARAM16(0, v->string_id);
|
||||
SET_DPARAM16(1, v->unitnumber);
|
||||
DrawWindowWidgets(w);
|
||||
|
@ -201,7 +204,7 @@ static void ShipDetailsWndProc(Window *w, WindowEvent *e)
|
|||
{
|
||||
SET_DPARAM16(0, v->service_interval);
|
||||
SET_DPARAM16(1, v->date_of_last_service);
|
||||
DrawString(13, 90, STR_883C_SERVICING_INTERVAL_DAYS, 0);
|
||||
DrawString(13, 90, _patches.servint_ispercent?STR_SERVICING_INTERVAL_PERCENT:STR_883C_SERVICING_INTERVAL_DAYS, 0);
|
||||
}
|
||||
|
||||
DrawShipImage(v, 3, 57, INVALID_VEHICLE);
|
||||
|
@ -232,14 +235,19 @@ static void ShipDetailsWndProc(Window *w, WindowEvent *e)
|
|||
ShowQueryString(v->string_id, STR_9831_NAME_SHIP, 31, 150, w->window_class, w->window_number);
|
||||
break;
|
||||
case 5: /* increase int */
|
||||
mod = 10;
|
||||
mod = _ctrl_pressed? 5 : 10;
|
||||
goto change_int;
|
||||
case 6: /* decrease int */
|
||||
mod = -10;
|
||||
mod = _ctrl_pressed?- 5 : -10;
|
||||
change_int:
|
||||
mod += v->service_interval;
|
||||
if (!IS_INT_INSIDE(mod, 30, 800+1))
|
||||
|
||||
/* %-based service interval max 5%-90%
|
||||
day-based service interval max 30-800 days */
|
||||
mod = _patches.servint_ispercent ? clamp(mod, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : clamp(mod, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS+1);
|
||||
if (mod == v->service_interval)
|
||||
return;
|
||||
|
||||
DoCommandP(v->tile, v->index, mod, NULL, CMD_CHANGE_SHIP_SERVICE_INT | CMD_MSG(STR_018A_CAN_T_CHANGE_SERVICING));
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1549,7 +1549,7 @@ static bool ProcessTrainOrder(Vehicle *v)
|
|||
}
|
||||
|
||||
if ((v->next_order & (OT_MASK|OF_UNLOAD|OF_FULL_LOAD)) == (OT_GOTO_DEPOT|OF_UNLOAD|OF_FULL_LOAD) &&
|
||||
v->date_of_last_service+v->service_interval > _date) {
|
||||
SERVICE_INTERVAL) {
|
||||
v->cur_order_index++;
|
||||
}
|
||||
|
||||
|
@ -2541,7 +2541,7 @@ static void CheckIfTrainNeedsService(Vehicle *v)
|
|||
if (_patches.servint_trains == 0)
|
||||
return;
|
||||
|
||||
if (v->date_of_last_service + v->service_interval > _date)
|
||||
if (SERVICE_INTERVAL)
|
||||
return;
|
||||
|
||||
if (v->vehstatus & VS_STOPPED)
|
||||
|
|
17
train_gui.c
17
train_gui.c
|
@ -959,6 +959,9 @@ static void DrawTrainDetailsWindow(Window *w)
|
|||
if (v->owner != _local_player)
|
||||
w->disabled_state |= (1 << 2);
|
||||
|
||||
if (!_patches.servint_trains) // disable service-scroller when interval is set to disabled
|
||||
w->disabled_state |= (1 << 6) | (1 << 7);
|
||||
|
||||
SET_DPARAM16(0, v->string_id);
|
||||
SET_DPARAM16(1, v->unitnumber);
|
||||
DrawWindowWidgets(w);
|
||||
|
@ -994,7 +997,7 @@ static void DrawTrainDetailsWindow(Window *w)
|
|||
|
||||
SET_DPARAM16(0, v->service_interval);
|
||||
SET_DPARAM16(1, v->date_of_last_service);
|
||||
DrawString(x + 11, 141, STR_883C_SERVICING_INTERVAL_DAYS, 0);
|
||||
DrawString(x + 11, 141, _patches.servint_ispercent?STR_SERVICING_INTERVAL_PERCENT:STR_883C_SERVICING_INTERVAL_DAYS, 0);
|
||||
|
||||
x = 1;
|
||||
y = 57;
|
||||
|
@ -1045,16 +1048,20 @@ static void TrainDetailsWndProc(Window *w, WindowEvent *e)
|
|||
ShowQueryString(v->string_id, STR_8865_NAME_TRAIN, 31, 150, w->window_class, w->window_number);
|
||||
break;
|
||||
case 6: /* inc serv interval */
|
||||
mod = 10;
|
||||
mod = _ctrl_pressed? 5 : 10;
|
||||
goto do_change_service_int;
|
||||
|
||||
case 7: /* dec serv interval */
|
||||
mod = -10;
|
||||
mod = _ctrl_pressed? -5 : -10;
|
||||
do_change_service_int:
|
||||
v = &_vehicles[w->window_number];
|
||||
mod += v->service_interval;
|
||||
if (!IS_INT_INSIDE(mod, 30, 800+1))
|
||||
return;
|
||||
|
||||
/* %-based service interval max 5%-90%
|
||||
day-based service interval max 30-800 days */
|
||||
mod = _patches.servint_ispercent ? clamp(mod, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : clamp(mod, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS+1);
|
||||
if (mod == v->service_interval)
|
||||
return;
|
||||
|
||||
DoCommandP(v->tile, v->index, mod, NULL, CMD_CHANGE_TRAIN_SERVICE_INT | CMD_MSG(STR_018A_CAN_T_CHANGE_SERVICING));
|
||||
break;
|
||||
|
|
|
@ -118,6 +118,7 @@ typedef struct Patches {
|
|||
byte max_aircraft; //max planes in game per player
|
||||
byte max_ships; //max ships in game per player
|
||||
|
||||
bool servint_ispercent; // service intervals are in percents
|
||||
uint16 servint_trains; // service interval for trains
|
||||
uint16 servint_roadveh; // service interval for road vehicles
|
||||
uint16 servint_aircraft;// service interval for aircraft
|
||||
|
|
|
@ -414,4 +414,10 @@ VARDEF BackuppedOrders _backup_orders_data[1];
|
|||
|
||||
#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 MAX_SERVINT_PERCENT 90
|
||||
#define MIN_SERVINT_DAYS 30
|
||||
#define MAX_SERVINT_DAYS 800
|
||||
|
||||
#endif /* VEHICLE_H */
|
||||
|
|
Loading…
Reference in New Issue