Changeset - r8531:c49e85243dd4
[Not reviewed]
master
0 1 0
belugas - 16 years ago 2008-02-11 03:22:44
belugas@openttd.org
(svn r12106) -Fix(r12105): Kill warnings and raise an error when the transport type is not supported
1 file changed with 11 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/tunnelbridge_cmd.cpp
Show inline comments
 
@@ -202,12 +202,9 @@ CommandCost CmdBuildBridge(TileIndex end
 
	/* unpack parameters */
 
	bridge_type = GB(p2, 0, 8);
 

	
 
	if (p1 >= MapSize()) return CMD_ERROR;
 

	
 
	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;
 

	
 
	/* type of bridge */
 
	switch (transport_type) {
 
@@ -220,6 +217,11 @@ CommandCost CmdBuildBridge(TileIndex end
 
			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
 
				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);
0 comments (0 inline, 0 general)