1
0
Fork 0

(svn r12106) -Fix(r12105): Kill warnings and raise an error when the transport type is not supported

release/0.6
belugas 2008-02-11 03:22:44 +00:00
parent 9a50fcd281
commit d8b3526840
1 changed files with 11 additions and 5 deletions

View File

@ -202,13 +202,10 @@ CommandCost CmdBuildBridge(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p
/* unpack parameters */ /* unpack parameters */
bridge_type = GB(p2, 0, 8); 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; if (p1 >= MapSize()) return CMD_ERROR;
transport_type = (TransportType)GB(p2, 15, 2);
/* type of bridge */ /* type of bridge */
switch (transport_type) { switch (transport_type) {
case TRANSPORT_ROAD: case TRANSPORT_ROAD:
@ -220,6 +217,11 @@ CommandCost CmdBuildBridge(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p
railtype = (RailType)GB(p2, 8, 8); railtype = (RailType)GB(p2, 8, 8);
if (!ValParamRailtype(railtype)) return CMD_ERROR; if (!ValParamRailtype(railtype)) return CMD_ERROR;
break; 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); 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_start, owner, bridge_type, dir, roadtypes);
MakeRoadBridgeRamp(tile_end, owner, bridge_type, ReverseDiagDir(dir), roadtypes); MakeRoadBridgeRamp(tile_end, owner, bridge_type, ReverseDiagDir(dir), roadtypes);
break; break;
default:
NOT_REACHED();
break;
} }
MarkTileDirtyByTile(tile_start); MarkTileDirtyByTile(tile_start);
MarkTileDirtyByTile(tile_end); MarkTileDirtyByTile(tile_end);