Disallow setting scheduled dispatch schedule duration to 0
This commit is contained in:
@@ -155,7 +155,7 @@ CommandCost CmdScheduledDispatchSetDuration(TileIndex tile, DoCommandFlag flags,
|
|||||||
uint schedule_index = GB(p1, 20, 12);
|
uint schedule_index = GB(p1, 20, 12);
|
||||||
|
|
||||||
Vehicle *v = Vehicle::GetIfValid(veh);
|
Vehicle *v = Vehicle::GetIfValid(veh);
|
||||||
if (v == nullptr || !v->IsPrimaryVehicle()) return CMD_ERROR;
|
if (v == nullptr || !v->IsPrimaryVehicle() || p2 == 0) return CMD_ERROR;
|
||||||
|
|
||||||
CommandCost ret = CheckOwnership(v->owner);
|
CommandCost ret = CheckOwnership(v->owner);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
@@ -330,7 +330,7 @@ CommandCost CmdScheduledDispatchAddNewSchedule(TileIndex tile, DoCommandFlag fla
|
|||||||
VehicleID veh = GB(p1, 0, 20);
|
VehicleID veh = GB(p1, 0, 20);
|
||||||
|
|
||||||
Vehicle *v = Vehicle::GetIfValid(veh);
|
Vehicle *v = Vehicle::GetIfValid(veh);
|
||||||
if (v == nullptr || !v->IsPrimaryVehicle()) return CMD_ERROR;
|
if (v == nullptr || !v->IsPrimaryVehicle() || p2 == 0) return CMD_ERROR;
|
||||||
|
|
||||||
CommandCost ret = CheckOwnership(v->owner);
|
CommandCost ret = CheckOwnership(v->owner);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
|
Reference in New Issue
Block a user