summaryrefslogtreecommitdiff
path: root/src/order_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-04-12 14:11:14 +0000
committerrubidium <rubidium@openttd.org>2009-04-12 14:11:14 +0000
commit5790293af6404ab5eb941ba9f67141631ecf621d (patch)
tree3db95c099e2a5c153a8ac783d99515c243755588 /src/order_cmd.cpp
parente85e8ca4dbd6344630c934acd6b69c487aba0236 (diff)
downloadopenttd-5790293af6404ab5eb941ba9f67141631ecf621d.tar.xz
(svn r16037) -Feature: allow (per order) to let a train stop at the near end, middle or far end of a platform from the point of view of the driver of the train that enters the station.
Diffstat (limited to 'src/order_cmd.cpp')
-rw-r--r--src/order_cmd.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index b980d1711..b9f1a0e4f 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -454,6 +454,20 @@ CommandCost CmdInsertOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
case OUF_UNLOAD_IF_POSSIBLE: case OUFB_UNLOAD: case OUFB_TRANSFER: case OUFB_NO_UNLOAD: break;
default: return CMD_ERROR;
}
+
+ /* Filter invalid stop locations */
+ switch (new_order.GetStopLocation()) {
+ case OSL_PLATFORM_NEAR_END:
+ case OSL_PLATFORM_MIDDLE:
+ if (v->type != VEH_TRAIN) return CMD_ERROR;
+ /* FALL THROUGH */
+ case OSL_PLATFORM_FAR_END:
+ break;
+
+ default:
+ return CMD_ERROR;
+ }
+
break;
}
@@ -878,6 +892,11 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
if (data == order->GetNonStopType()) return CMD_ERROR;
break;
+ case MOF_STOP_LOCATION:
+ if (v->type != VEH_TRAIN) return CMD_ERROR;
+ if (data >= OSL_END) return CMD_ERROR;
+ break;
+
case MOF_UNLOAD:
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. */
@@ -939,6 +958,10 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
order->SetNonStopType((OrderNonStopFlags)data);
break;
+ case MOF_STOP_LOCATION:
+ order->SetStopLocation((OrderStopLocation)data);
+ break;
+
case MOF_UNLOAD:
order->SetUnloadType((OrderUnloadFlags)data);
if ((data & OUFB_NO_UNLOAD) != 0 && (order->GetLoadType() & OLFB_NO_LOAD) != 0) {