mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-20 13:09:15 +00:00
(svn r3367) Unify the 4 distinct CMD_CHANGE_{AIRCRAFT,ROADVEH,SHIP,TRAIN}_SERVICE_INT commands into one CMD_CHANGE_SERVICE_INT command.
As side effect this is a -Fix: The default AI tried to change the service intervals of vehicles via the CMD_CHANGE_TRAIN_SERVICE_INT command - regardless of the type of the vehicle - which of course failed for non-trains
This commit is contained in:
23
ship_cmd.c
23
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
|
||||
|
Reference in New Issue
Block a user