summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ai/default/default.c12
-rw-r--r--aircraft_cmd.c23
-rw-r--r--aircraft_gui.c2
-rw-r--r--command.c13
-rw-r--r--command.h5
-rw-r--r--roadveh_cmd.c24
-rw-r--r--roadveh_gui.c2
-rw-r--r--ship_cmd.c23
-rw-r--r--ship_gui.c2
-rw-r--r--train_cmd.c23
-rw-r--r--train_gui.c2
-rw-r--r--vehicle.c24
12 files changed, 40 insertions, 115 deletions
diff --git a/ai/default/default.c b/ai/default/default.c
index 150e0be92..8daaf239e 100644
--- a/ai/default/default.c
+++ b/ai/default/default.c
@@ -311,7 +311,7 @@ static void AiHandleReplaceTrain(Player *p)
AiRestoreVehicleOrders(GetVehicle(veh), orderbak);
DoCommandByTile(0, veh, 0, DC_EXEC, CMD_START_STOP_TRAIN);
- DoCommandByTile(0, veh, _ai_service_interval, DC_EXEC, CMD_CHANGE_TRAIN_SERVICE_INT);
+ DoCommandByTile(0, veh, _ai_service_interval, DC_EXEC, CMD_CHANGE_SERVICE_INT);
}
}
}
@@ -340,7 +340,7 @@ static void AiHandleReplaceRoadVeh(Player *p)
AiRestoreVehicleOrders(GetVehicle(veh), orderbak);
DoCommandByTile(0, veh, 0, DC_EXEC, CMD_START_STOP_ROADVEH);
- DoCommandByTile(0, veh, _ai_service_interval, DC_EXEC, CMD_CHANGE_TRAIN_SERVICE_INT);
+ DoCommandByTile(0, veh, _ai_service_interval, DC_EXEC, CMD_CHANGE_SERVICE_INT);
}
}
}
@@ -369,7 +369,7 @@ static void AiHandleReplaceAircraft(Player *p)
AiRestoreVehicleOrders(GetVehicle(veh), orderbak);
DoCommandByTile(0, veh, 0, DC_EXEC, CMD_START_STOP_AIRCRAFT);
- DoCommandByTile(0, veh, _ai_service_interval, DC_EXEC, CMD_CHANGE_TRAIN_SERVICE_INT);
+ DoCommandByTile(0, veh, _ai_service_interval, DC_EXEC, CMD_CHANGE_SERVICE_INT);
}
}
}
@@ -2450,7 +2450,7 @@ handle_nocash:
DoCommandByTile(0, loco_id, 0, DC_EXEC, CMD_START_STOP_TRAIN);
- DoCommandByTile(0, loco_id, _ai_service_interval, DC_EXEC, CMD_CHANGE_TRAIN_SERVICE_INT);
+ DoCommandByTile(0, loco_id, _ai_service_interval, DC_EXEC, CMD_CHANGE_SERVICE_INT);
if (p->ai.num_want_fullload != 0)
p->ai.num_want_fullload--;
@@ -3207,7 +3207,7 @@ static void AiStateBuildRoadVehicles(Player *p)
}
DoCommandByTile(0, loco_id, 0, DC_EXEC, CMD_START_STOP_ROADVEH);
- DoCommandByTile(0, loco_id, _ai_service_interval, DC_EXEC, CMD_CHANGE_TRAIN_SERVICE_INT);
+ DoCommandByTile(0, loco_id, _ai_service_interval, DC_EXEC, CMD_CHANGE_SERVICE_INT);
if (p->ai.num_want_fullload != 0) p->ai.num_want_fullload--;
if (--p->ai.num_loco_to_build == 0) p->ai.state = AIS_0;
@@ -3521,7 +3521,7 @@ static void AiStateBuildAircraftVehicles(Player *p)
DoCommandByTile(0, loco_id, 0, DC_EXEC, CMD_START_STOP_AIRCRAFT);
- DoCommandByTile(0, loco_id, _ai_service_interval, DC_EXEC, CMD_CHANGE_TRAIN_SERVICE_INT);
+ DoCommandByTile(0, loco_id, _ai_service_interval, DC_EXEC, CMD_CHANGE_SERVICE_INT);
if (p->ai.num_want_fullload != 0)
p->ai.num_want_fullload--;
diff --git a/aircraft_cmd.c b/aircraft_cmd.c
index a6fd64f53..710ca24d5 100644
--- a/aircraft_cmd.c
+++ b/aircraft_cmd.c
@@ -452,29 +452,6 @@ int32 CmdSendAircraftToHangar(int x, int y, uint32 flags, uint32 p1, uint32 p2)
return 0;
}
-/** Change the service interval for aircraft.
- * @param x,y unused
- * @param p1 vehicle ID that is being service-interval-changed
- * @param p2 new service interval
- */
-int32 CmdChangeAircraftServiceInt(int x, int y, uint32 flags, uint32 p1, uint32 p2)
-{
- Vehicle *v;
- uint16 serv_int = GetServiceIntervalClamped(p2); /* Double check the service interval from the user-input */
-
- if (serv_int != p2 || !IsVehicleIndex(p1)) return CMD_ERROR;
-
- v = GetVehicle(p1);
-
- if (v->type != VEH_Aircraft || !CheckOwnership(v->owner)) return CMD_ERROR;
-
- if (flags & DC_EXEC) {
- v->service_interval = serv_int;
- InvalidateWindowWidget(WC_VEHICLE_DETAILS, v->index, 7);
- }
-
- return 0;
-}
/** Refits an aircraft to the specified cargo type.
* @param x,y unused
diff --git a/aircraft_gui.c b/aircraft_gui.c
index 99dc2cedc..4bb83c1c4 100644
--- a/aircraft_gui.c
+++ b/aircraft_gui.c
@@ -415,7 +415,7 @@ do_change_service_int:
mod = GetServiceIntervalClamped(mod + v->service_interval);
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));
+ DoCommandP(v->tile, v->index, mod, NULL, CMD_CHANGE_SERVICE_INT | CMD_MSG(STR_018A_CAN_T_CHANGE_SERVICING));
break;
}
} break;
diff --git a/command.c b/command.c
index 5af67e458..7f28bb28b 100644
--- a/command.c
+++ b/command.c
@@ -77,7 +77,7 @@ DEF_COMMAND(CmdModifyOrder);
DEF_COMMAND(CmdSkipOrder);
DEF_COMMAND(CmdDeleteOrder);
DEF_COMMAND(CmdInsertOrder);
-DEF_COMMAND(CmdChangeTrainServiceInt);
+DEF_COMMAND(CmdChangeServiceInt);
DEF_COMMAND(CmdRestoreOrderIndex);
DEF_COMMAND(CmdBuildIndustry);
@@ -103,7 +103,6 @@ DEF_COMMAND(CmdSellAircraft);
DEF_COMMAND(CmdStartStopAircraft);
DEF_COMMAND(CmdBuildAircraft);
DEF_COMMAND(CmdSendAircraftToHangar);
-DEF_COMMAND(CmdChangeAircraftServiceInt);
DEF_COMMAND(CmdRefitAircraft);
DEF_COMMAND(CmdPlaceSign);
@@ -114,7 +113,6 @@ DEF_COMMAND(CmdStartStopRoadVeh);
DEF_COMMAND(CmdSellRoadVeh);
DEF_COMMAND(CmdSendRoadVehToDepot);
DEF_COMMAND(CmdTurnRoadVeh);
-DEF_COMMAND(CmdChangeRoadVehServiceInt);
DEF_COMMAND(CmdPause);
@@ -136,7 +134,6 @@ DEF_COMMAND(CmdStartStopShip);
DEF_COMMAND(CmdSellShip);
DEF_COMMAND(CmdBuildShip);
DEF_COMMAND(CmdSendShipToDepot);
-DEF_COMMAND(CmdChangeShipServiceInt);
DEF_COMMAND(CmdRefitShip);
DEF_COMMAND(CmdCloneOrder);
@@ -212,7 +209,7 @@ static const Command _command_proc_table[] = {
{CmdDeleteOrder, 0}, /* 44 */
{CmdInsertOrder, 0}, /* 45 */
- {CmdChangeTrainServiceInt, 0}, /* 46 */
+ {CmdChangeServiceInt, 0}, /* 46 */
{CmdBuildIndustry, 0}, /* 47 */
{CmdBuildCompanyHQ, 0}, /* 48 */
@@ -237,7 +234,7 @@ static const Command _command_proc_table[] = {
{CmdBuildAircraft, 0}, /* 61 */
{CmdSendAircraftToHangar, 0}, /* 62 */
- {CmdChangeAircraftServiceInt, 0}, /* 63 */
+ {NULL, 0}, /* 63 */
{CmdRefitAircraft, 0}, /* 64 */
{CmdPlaceSign, 0}, /* 65 */
@@ -248,7 +245,7 @@ static const Command _command_proc_table[] = {
{CmdSellRoadVeh, 0}, /* 69 */
{CmdSendRoadVehToDepot, 0}, /* 70 */
{CmdTurnRoadVeh, 0}, /* 71 */
- {CmdChangeRoadVehServiceInt, 0}, /* 72 */
+ {NULL, 0}, /* 72 */
{CmdPause, CMD_SERVER}, /* 73 */
@@ -271,7 +268,7 @@ static const Command _command_proc_table[] = {
{CmdSellShip, 0}, /* 87 */
{CmdBuildShip, 0}, /* 88 */
{CmdSendShipToDepot, 0}, /* 89 */
- {CmdChangeShipServiceInt, 0}, /* 90 */
+ {NULL, 0}, /* 90 */
{CmdRefitShip, 0}, /* 91 */
{NULL, 0}, /* 92 */
diff --git a/command.h b/command.h
index 9dd384bbb..249a6a072 100644
--- a/command.h
+++ b/command.h
@@ -58,7 +58,7 @@ enum {
CMD_DELETE_ORDER = 44,
CMD_INSERT_ORDER = 45,
- CMD_CHANGE_TRAIN_SERVICE_INT = 46,
+ CMD_CHANGE_SERVICE_INT = 46,
CMD_BUILD_INDUSTRY = 47,
@@ -81,7 +81,6 @@ enum {
CMD_START_STOP_AIRCRAFT = 60,
CMD_BUILD_AIRCRAFT = 61,
CMD_SEND_AIRCRAFT_TO_HANGAR = 62,
- CMD_CHANGE_AIRCRAFT_SERVICE_INT = 63,
CMD_REFIT_AIRCRAFT = 64,
CMD_PLACE_SIGN = 65,
@@ -92,7 +91,6 @@ enum {
CMD_SELL_ROAD_VEH = 69,
CMD_SEND_ROADVEH_TO_DEPOT = 70,
CMD_TURN_ROADVEH = 71,
- CMD_CHANGE_ROADVEH_SERVICE_INT = 72,
CMD_PAUSE = 73,
@@ -113,7 +111,6 @@ enum {
CMD_SELL_SHIP = 87,
CMD_BUILD_SHIP = 88,
CMD_SEND_SHIP_TO_DEPOT = 89,
- CMD_CHANGE_SHIP_SERVICE_INT = 90,
CMD_REFIT_SHIP = 91,
CMD_CLONE_ORDER = 99,
diff --git a/roadveh_cmd.c b/roadveh_cmd.c
index 840284bbb..599fbc9a9 100644
--- a/roadveh_cmd.c
+++ b/roadveh_cmd.c
@@ -410,30 +410,6 @@ int32 CmdTurnRoadVeh(int x, int y, uint32 flags, uint32 p1, uint32 p2)
return 0;
}
-/** Change the service interval for road vehicles.
- * @param x,y unused
- * @param p1 vehicle ID that is being service-interval-changed
- * @param p2 new service interval
- */
-int32 CmdChangeRoadVehServiceInt(int x, int y, uint32 flags, uint32 p1, uint32 p2)
-{
- Vehicle *v;
- uint16 serv_int = GetServiceIntervalClamped(p2); /* Double check the service interval from the user-input */
-
- if (serv_int != p2 || !IsVehicleIndex(p1)) return CMD_ERROR;
-
- v = GetVehicle(p1);
-
- if (v->type != VEH_Road || !CheckOwnership(v->owner)) return CMD_ERROR;
-
- if (flags & DC_EXEC) {
- v->service_interval = serv_int;
- InvalidateWindowWidget(WC_VEHICLE_DETAILS, v->index, 7);
- }
-
- return 0;
-}
-
static void MarkRoadVehDirty(Vehicle *v)
{
diff --git a/roadveh_gui.c b/roadveh_gui.c
index db045e920..3040e05d7 100644
--- a/roadveh_gui.c
+++ b/roadveh_gui.c
@@ -169,7 +169,7 @@ do_change_service_int:
mod = GetServiceIntervalClamped(mod + v->service_interval);
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));
+ DoCommandP(v->tile, v->index, mod, NULL, CMD_CHANGE_SERVICE_INT | CMD_MSG(STR_018A_CAN_T_CHANGE_SERVICING));
break;
}
} break;
diff --git a/ship_cmd.c b/ship_cmd.c
index a78a49880..bf18bdd9a 100644
--- a/ship_cmd.c
+++ b/ship_cmd.c
@@ -1008,29 +1008,6 @@ int32 CmdSendShipToDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2)
return 0;
}
-/** Change the service interval for ships.
- * @param x,y unused
- * @param p1 vehicle ID that is being service-interval-changed
- * @param p2 new service interval
- */
-int32 CmdChangeShipServiceInt(int x, int y, uint32 flags, uint32 p1, uint32 p2)
-{
- Vehicle *v;
- uint16 serv_int = GetServiceIntervalClamped(p2); /* Double check the service interval from the user-input */
-
- if (serv_int != p2 || !IsVehicleIndex(p1)) return CMD_ERROR;
-
- v = GetVehicle(p1);
-
- if (v->type != VEH_Ship || !CheckOwnership(v->owner)) return CMD_ERROR;
-
- if (flags & DC_EXEC) {
- v->service_interval = serv_int;
- InvalidateWindowWidget(WC_VEHICLE_DETAILS, v->index, 7);
- }
-
- return 0;
-}
/** Refits a ship to the specified cargo type.
* @param x,y unused
diff --git a/ship_gui.c b/ship_gui.c
index 3802941fd..19aaa1153 100644
--- a/ship_gui.c
+++ b/ship_gui.c
@@ -246,7 +246,7 @@ do_change_service_int:
mod = GetServiceIntervalClamped(mod + v->service_interval);
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));
+ DoCommandP(v->tile, v->index, mod, NULL, CMD_CHANGE_SERVICE_INT | CMD_MSG(STR_018A_CAN_T_CHANGE_SERVICING));
break;
}
} break;
diff --git a/train_cmd.c b/train_cmd.c
index 0c5ec1b8d..95bdd34cf 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -1897,29 +1897,6 @@ int32 CmdSendTrainToDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2)
return 0;
}
-/** Change the service interval for trains.
- * @param x,y unused
- * @param p1 vehicle ID that is being service-interval-changed
- * @param p2 new service interval
- */
-int32 CmdChangeTrainServiceInt(int x, int y, uint32 flags, uint32 p1, uint32 p2)
-{
- Vehicle *v;
- uint16 serv_int = GetServiceIntervalClamped(p2); /* Double check the service interval from the user-input */
-
- if (serv_int != p2 || !IsVehicleIndex(p1)) return CMD_ERROR;
-
- v = GetVehicle(p1);
-
- if (v->type != VEH_Train || !CheckOwnership(v->owner)) return CMD_ERROR;
-
- if (flags & DC_EXEC) {
- v->service_interval = serv_int;
- InvalidateWindowWidget(WC_VEHICLE_DETAILS, v->index, 8);
- }
-
- return 0;
-}
void OnTick_Train(void)
{
diff --git a/train_gui.c b/train_gui.c
index 858942185..d2d493223 100644
--- a/train_gui.c
+++ b/train_gui.c
@@ -1254,7 +1254,7 @@ do_change_service_int:
mod = GetServiceIntervalClamped(mod + v->service_interval);
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));
+ DoCommandP(v->tile, v->index, mod, NULL, CMD_CHANGE_SERVICE_INT | CMD_MSG(STR_018A_CAN_T_CHANGE_SERVICING));
break;
/* details buttons*/
case 9: // Cargo
diff --git a/vehicle.c b/vehicle.c
index 1193d2ebd..444bfaa10 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -1844,6 +1844,30 @@ int32 CmdNameVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2)
}
+/** Change the service interval of a vehicle
+ * @param x,y unused
+ * @param p1 vehicle ID that is being service-interval-changed
+ * @param p2 new service interval
+ */
+int32 CmdChangeServiceInt(int x, int y, uint32 flags, uint32 p1, uint32 p2)
+{
+ Vehicle* v;
+ uint16 serv_int = GetServiceIntervalClamped(p2); /* Double check the service interval from the user-input */
+
+ if (serv_int != p2 || !IsVehicleIndex(p1)) return CMD_ERROR;
+
+ v = GetVehicle(p1);
+
+ if (v->type == 0 || !CheckOwnership(v->owner)) return CMD_ERROR;
+
+ if (flags & DC_EXEC) {
+ v->service_interval = serv_int;
+ InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
+ }
+
+ return 0;
+}
+
static Rect _old_vehicle_coords;