diff options
author | rubidium <rubidium@openttd.org> | 2008-04-10 10:18:03 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-04-10 10:18:03 +0000 |
commit | 2964ba2d3498abf707f4ff6a135c6e6178d8b92f (patch) | |
tree | f1e81a713f50ffd83601dcff9cd89386c310bad6 /src/order_cmd.cpp | |
parent | 00d5b516bfb25cfa24e53df59d9ce12302b2bff4 (diff) | |
download | openttd-2964ba2d3498abf707f4ff6a135c6e6178d8b92f.tar.xz |
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
-Feature: ability to force a vehicle to not unload at a station.
Diffstat (limited to 'src/order_cmd.cpp')
-rw-r--r-- | src/order_cmd.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index 60064fae0..f9a3b0618 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -796,12 +796,14 @@ CommandCost CmdModifyOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) break; case MOF_UNLOAD: - if ((data & ~(OUFB_UNLOAD | OUFB_TRANSFER)) != 0) return CMD_ERROR; + if ((data & ~(OUFB_UNLOAD | OUFB_TRANSFER | OUFB_NO_UNLOAD)) != 0) return CMD_ERROR; + /* Unload and no-unload are mutual exclusive and so are transfer and no unload. */ + if (data != 0 && ((data & (OUFB_UNLOAD | OUFB_TRANSFER)) != 0) == ((data & OUFB_NO_UNLOAD) != 0)) return CMD_ERROR; if (data == order->GetUnloadType()) return CMD_ERROR; break; case MOF_LOAD: - if (data > OLF_FULL_LOAD_ANY || data == 1) return CMD_ERROR; + if (data > OLFB_NO_LOAD || data == 1) return CMD_ERROR; if (data == order->GetLoadType()) return CMD_ERROR; break; @@ -822,6 +824,12 @@ CommandCost CmdModifyOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) if ((data & OUFB_UNLOAD) != 0) { order->SetLoadType((OrderLoadFlags)(order->GetLoadType() & ~(OLFB_FULL_LOAD | OLF_FULL_LOAD_ANY))); } + if ((data & (OUFB_NO_UNLOAD | OUFB_TRANSFER)) != 0) { + if ((order->GetLoadType() & OLFB_NO_LOAD) != 0 && (data & OUFB_TRANSFER) != 0) { + order->SetUnloadType((OrderUnloadFlags)(data | OUFB_UNLOAD)); + } + order->SetLoadType((OrderLoadFlags)(order->GetLoadType() & ~OLFB_NO_LOAD)); + } break; case MOF_LOAD: @@ -830,6 +838,15 @@ CommandCost CmdModifyOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) if ((data & OLFB_FULL_LOAD) != 0) { order->SetUnloadType((OrderUnloadFlags)(order->GetUnloadType() & ~OUFB_UNLOAD)); } + if ((data & OLFB_NO_LOAD) != 0) { + if ((order->GetUnloadType() & OUFB_TRANSFER) != 0) { + /* No load + transfer == unload + transfer */ + order->SetUnloadType((OrderUnloadFlags)(order->GetUnloadType() | OUFB_UNLOAD)); + order->SetLoadType((OrderLoadFlags)(data & ~OLFB_NO_LOAD)); + } else { + order->SetUnloadType((OrderUnloadFlags)(order->GetUnloadType() & ~OUFB_NO_UNLOAD)); + } + } break; case MOF_DEPOT_ACTION: |