Changeset - r21031:52ba3c85974a
[Not reviewed]
master
0 1 0
rubidium - 11 years ago 2013-11-25 16:26:50
rubidium@openttd.org
(svn r26111) -Fix: theoretical case where sprite table could be overread for aqueducts that start at flat land
1 file changed with 1 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/tunnelbridge_cmd.cpp
Show inline comments
 
@@ -1214,28 +1214,27 @@ static void DrawTile_TunnelBridge(TileIn
 
		} else {
 
			base_offset = 8;
 
		}
 

	
 
		/* as the lower 3 bits are used for other stuff, make sure they are clear */
 
		assert( (base_offset & 0x07) == 0x00);
 

	
 
		DrawFoundation(ti, GetBridgeFoundation(ti->tileh, DiagDirToAxis(tunnelbridge_direction)));
 

	
 
		/* HACK Wizardry to convert the bridge ramp direction into a sprite offset */
 
		base_offset += (6 - tunnelbridge_direction) % 4;
 

	
 
		if (ti->tileh == SLOPE_FLAT) base_offset += 4; // sloped bridge head
 

	
 
		/* Table number BRIDGE_PIECE_HEAD always refers to the bridge heads for any bridge type */
 
		if (transport_type != TRANSPORT_WATER) {
 
			if (ti->tileh == SLOPE_FLAT) base_offset += 4; // sloped bridge head
 
			psid = &GetBridgeSpriteTable(GetBridgeType(ti->tile), BRIDGE_PIECE_HEAD)[base_offset];
 
		} else {
 
			psid = _aqueduct_sprites + base_offset;
 
		}
 

	
 
		if (!ice) {
 
			TileIndex next = ti->tile + TileOffsByDiagDir(tunnelbridge_direction);
 
			if (ti->tileh != SLOPE_FLAT && ti->z == 0 && HasTileWaterClass(next) && GetWaterClass(next) == WATER_CLASS_SEA) {
 
				DrawShoreTile(ti->tileh);
 
			} else {
 
				DrawClearLandTile(ti, 3);
 
			}
0 comments (0 inline, 0 general)