Changeset - r9498:789e6631bf2f
[Not reviewed]
master
0 1 0
smatz - 16 years ago 2008-06-11 17:10:36
smatz@openttd.org
(svn r13478) -Codechange: don't use GetBridgeSpec() for aqueducts
1 file changed with 18 insertions and 25 deletions:
0 comments (0 inline, 0 general)
src/tunnelbridge_cmd.cpp
Show inline comments
 
@@ -735,22 +735,20 @@ static CommandCost ClearTile_TunnelBridg
 
 * @param axis Orientation of bridge.
 
 * @param type Bridge type.
 
 * @param x Sprite X position of front pillar.
 
 * @param y Sprite Y position of front pillar.
 
 * @param z_bridge Absolute height of bridge bottom.
 
 */
 
static void DrawBridgePillars(const PalSpriteID *psid, const TileInfo* ti, Axis axis, BridgeType type, int x, int y, int z_bridge)
 
static void DrawBridgePillars(const PalSpriteID *psid, const TileInfo* ti, Axis axis, bool drawfarpillar, int x, int y, int z_bridge)
 
{
 
	/* Do not draw bridge pillars if they are invisible */
 
	if (IsInvisibilitySet(TO_BRIDGES)) return;
 

	
 
	SpriteID image = psid->sprite;
 

	
 
	if (image != 0) {
 
		bool drawfarpillar = !HasBit(GetBridgeSpec(type)->flags, 0);
 

	
 
		/* "side" specifies the side the pillars stand on.
 
		 * The length of the pillars is then set to the height of the bridge over the corners of this edge.
 
		 *
 
		 *                axis==AXIS_X  axis==AXIS_Y
 
		 *   side==false      SW            NW
 
		 *   side==true       NE            SE
 
@@ -1038,54 +1036,49 @@ void DrawBridgeMiddle(const TileInfo* ti
 
	 *
 
	 */
 

	
 
	/* Z position of the bridge sprites relative to bridge height (downwards) */
 
	static const int BRIDGE_Z_START = 3;
 

	
 
	const PalSpriteID *psid;
 
	uint base_offset;
 
	TileIndex rampnorth;
 
	TileIndex rampsouth;
 
	TransportType transport_type;
 
	Axis axis;
 
	uint piece;
 
	BridgeType type;
 
	int x;
 
	int y;
 
	uint z;
 

	
 
	if (!IsBridgeAbove(ti->tile)) return;
 

	
 
	rampnorth = GetNorthernBridgeEnd(ti->tile);
 
	rampsouth = GetSouthernBridgeEnd(ti->tile);
 
	transport_type = GetTunnelBridgeTransportType(rampsouth);
 
	TileIndex rampnorth = GetNorthernBridgeEnd(ti->tile);
 
	TileIndex rampsouth = GetSouthernBridgeEnd(ti->tile);
 
	TransportType transport_type = GetTunnelBridgeTransportType(rampsouth);
 

	
 
	axis = GetBridgeAxis(ti->tile);
 
	piece = CalcBridgePiece(
 
	Axis axis = GetBridgeAxis(ti->tile);
 
	uint piece = CalcBridgePiece(
 
		GetTunnelBridgeLength(ti->tile, rampnorth) + 1,
 
		GetTunnelBridgeLength(ti->tile, rampsouth) + 1
 
	);
 
	type = GetBridgeType(rampsouth);
 

	
 
	const PalSpriteID *psid;
 
	bool drawfarpillar;
 
	if (transport_type != TRANSPORT_WATER) {
 
		BridgeType type =  GetBridgeType(rampsouth);
 
		drawfarpillar = !HasBit(GetBridgeSpec(type)->flags, 0);
 

	
 
		uint base_offset;
 
		if (transport_type == TRANSPORT_RAIL) {
 
			base_offset = GetRailTypeInfo(GetRailType(rampsouth))->bridge_offset;
 
		} else {
 
			base_offset = 8;
 
		}
 

	
 
		psid = base_offset + GetBridgeSpriteTable(type, piece);
 
	} else {
 
		drawfarpillar = true;
 
		psid = _aqueduct_sprites;
 
	}
 

	
 
	if (axis != AXIS_X) psid += 4;
 

	
 
	x = ti->x;
 
	y = ti->y;
 
	int x = ti->x;
 
	int y = ti->y;
 
	uint bridge_z = GetBridgeHeight(rampsouth);
 
	z = bridge_z - BRIDGE_Z_START;
 
	uint z = bridge_z - BRIDGE_Z_START;
 

	
 
	/* Add a bounding box, that separates the bridge from things below it. */
 
	AddSortableSpriteToDraw(SPR_EMPTY_BOUNDING_BOX, PAL_NONE, x, y, 16, 16, 1, bridge_z - TILE_HEIGHT + BB_Z_SEPARATOR);
 

	
 
	/* Draw Trambits as SpriteCombine */
 
	if (transport_type == TRANSPORT_ROAD) StartSpriteCombine();
 
@@ -1144,13 +1137,13 @@ void DrawBridgeMiddle(const TileInfo* ti
 
			}
 

	
 
			DrawGroundSpriteAt(image, pal, x, y, z);
 
		}
 
	} else if (_settings_client.gui.bridge_pillars) {
 
		/* draw pillars below for high bridges */
 
		DrawBridgePillars(psid, ti, axis, type, x, y, z);
 
		DrawBridgePillars(psid, ti, axis, drawfarpillar, x, y, z);
 
	}
 
}
 

	
 

	
 
static uint GetSlopeZ_TunnelBridge(TileIndex tile, uint x, uint y)
 
{
0 comments (0 inline, 0 general)