Prevent adding train slot state conditional orders to non-train vehicles
This commit is contained in:
@@ -1005,6 +1005,7 @@ CommandCost CmdInsertOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
|||||||
if (occ >= OCC_END) return CMD_ERROR;
|
if (occ >= OCC_END) return CMD_ERROR;
|
||||||
switch (new_order.GetConditionVariable()) {
|
switch (new_order.GetConditionVariable()) {
|
||||||
case OCV_SLOT_OCCUPANCY: {
|
case OCV_SLOT_OCCUPANCY: {
|
||||||
|
if (v->type != VEH_TRAIN) return CMD_ERROR;
|
||||||
TraceRestrictSlotID slot = new_order.GetXData();
|
TraceRestrictSlotID slot = new_order.GetXData();
|
||||||
if (slot != INVALID_TRACE_RESTRICT_SLOT_ID && !TraceRestrictSlot::IsValidID(slot)) return CMD_ERROR;
|
if (slot != INVALID_TRACE_RESTRICT_SLOT_ID && !TraceRestrictSlot::IsValidID(slot)) return CMD_ERROR;
|
||||||
if (occ != OCC_IS_TRUE && occ != OCC_IS_FALSE) return CMD_ERROR;
|
if (occ != OCC_IS_TRUE && occ != OCC_IS_FALSE) return CMD_ERROR;
|
||||||
@@ -1579,6 +1580,7 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
|||||||
|
|
||||||
case MOF_COND_VARIABLE:
|
case MOF_COND_VARIABLE:
|
||||||
if (data == OCV_FREE_PLATFORMS && v->type != VEH_TRAIN) return CMD_ERROR;
|
if (data == OCV_FREE_PLATFORMS && v->type != VEH_TRAIN) return CMD_ERROR;
|
||||||
|
if (data == OCV_SLOT_OCCUPANCY && v->type != VEH_TRAIN) return CMD_ERROR;
|
||||||
if (data >= OCV_END) return CMD_ERROR;
|
if (data >= OCV_END) return CMD_ERROR;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user