From e9c1572f03190bc0f321e857507364d5832d88c3 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 21 Jan 2024 02:41:23 +0000 Subject: [PATCH] Disallow setting scheduled dispatch schedule duration to 0 --- src/schdispatch_cmd.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/schdispatch_cmd.cpp b/src/schdispatch_cmd.cpp index 536dccd0b0..40bb201978 100644 --- a/src/schdispatch_cmd.cpp +++ b/src/schdispatch_cmd.cpp @@ -155,7 +155,7 @@ CommandCost CmdScheduledDispatchSetDuration(TileIndex tile, DoCommandFlag flags, uint schedule_index = GB(p1, 20, 12); 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); if (ret.Failed()) return ret; @@ -330,7 +330,7 @@ CommandCost CmdScheduledDispatchAddNewSchedule(TileIndex tile, DoCommandFlag fla VehicleID veh = GB(p1, 0, 20); 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); if (ret.Failed()) return ret;