summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2008-02-11 03:22:44 +0000
committerbelugas <belugas@openttd.org>2008-02-11 03:22:44 +0000
commitd8b35268405d4a76322c7c12ebc7f8c41fa582d7 (patch)
tree4fcb8fdd354b5b70a6422f44cb4897e75eb02cc8 /src
parent9a50fcd281a52e539458dd2714ce51b1f13b3bd5 (diff)
downloadopenttd-d8b35268405d4a76322c7c12ebc7f8c41fa582d7.tar.xz
(svn r12106) -Fix(r12105): Kill warnings and raise an error when the transport type is not supported
Diffstat (limited to 'src')
-rw-r--r--src/tunnelbridge_cmd.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index c61cdff76..f23920f79 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -202,13 +202,10 @@ CommandCost CmdBuildBridge(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p
/* unpack parameters */
bridge_type = GB(p2, 0, 8);
- transport_type = (TransportType)GB(p2, 15, 2);
- /* For now, only TRANSPORT_RAIL and TRANSPORT_ROAD are allowed.
- * But let not this stops us for preparing the future */
- if (transport_type >= TRANSPORT_WATER) return CMD_ERROR;
-
if (p1 >= MapSize()) return CMD_ERROR;
+ transport_type = (TransportType)GB(p2, 15, 2);
+
/* type of bridge */
switch (transport_type) {
case TRANSPORT_ROAD:
@@ -220,6 +217,11 @@ CommandCost CmdBuildBridge(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p
railtype = (RailType)GB(p2, 8, 8);
if (!ValParamRailtype(railtype)) return CMD_ERROR;
break;
+
+ default:
+ /* For now, only TRANSPORT_RAIL and TRANSPORT_ROAD are allowed.
+ * But let not this stops us for preparing the future */
+ return CMD_ERROR;
}
x = TileX(end_tile);
@@ -356,6 +358,10 @@ CommandCost CmdBuildBridge(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p
MakeRoadBridgeRamp(tile_start, owner, bridge_type, dir, roadtypes);
MakeRoadBridgeRamp(tile_end, owner, bridge_type, ReverseDiagDir(dir), roadtypes);
break;
+
+ default:
+ NOT_REACHED();
+ break;
}
MarkTileDirtyByTile(tile_start);
MarkTileDirtyByTile(tile_end);