File diff r7848:705b74bab657 → r7849:cfd99cb69695
src/road_cmd.cpp
Show inline comments
 
@@ -30,12 +30,13 @@
 
#include "depot.h"
 
#include "newgrf.h"
 
#include "station_map.h"
 
#include "tunnel_map.h"
 
#include "misc/autoptr.hpp"
 
#include "autoslope.h"
 
#include "transparency.h"
 

	
 
#define M(x) (1 << (x))
 
/* Level crossings may only be built on these slopes */
 
static const uint32 VALID_LEVEL_CROSSING_SLOPES = (M(SLOPE_SEN) | M(SLOPE_ENW) | M(SLOPE_NWS) | M(SLOPE_NS) | M(SLOPE_WSE) | M(SLOPE_EW) | M(SLOPE_FLAT));
 
#undef M
 

	
 
@@ -943,13 +944,13 @@ static bool AlwaysDrawUnpavedRoads(TileI
 
 * @param ti   information about the tile (slopes, height etc)
 
 * @param tram the roadbits for the tram
 
 */
 
void DrawTramCatenary(TileInfo *ti, RoadBits tram)
 
{
 
	/* Don't draw the catenary under a low bridge */
 
	if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !HASBIT(_transparent_opt, TO_BUILDINGS)) {
 
	if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !IsTransparencySet(TO_BUILDINGS)) {
 
		uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile));
 

	
 
		if (height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) return;
 
	}
 

	
 
	SpriteID front;
 
@@ -960,14 +961,14 @@ void DrawTramCatenary(TileInfo *ti, Road
 
		front = SPR_TRAMWAY_FRONT_WIRES_SLOPED + _road_sloped_sprites[ti->tileh - 1];
 
	} else {
 
		back  = SPR_TRAMWAY_BASE + _road_backpole_sprites_1[tram];
 
		front = SPR_TRAMWAY_BASE + _road_frontwire_sprites_1[tram];
 
	}
 

	
 
	AddSortableSpriteToDraw(back,  PAL_NONE, ti->x, ti->y, 16, 16, TILE_HEIGHT + BB_HEIGHT_UNDER_BRIDGE, ti->z, HASBIT(_transparent_opt, TO_BUILDINGS));
 
	AddSortableSpriteToDraw(front, PAL_NONE, ti->x, ti->y, 16, 16, TILE_HEIGHT + BB_HEIGHT_UNDER_BRIDGE, ti->z, HASBIT(_transparent_opt, TO_BUILDINGS));
 
	AddSortableSpriteToDraw(back,  PAL_NONE, ti->x, ti->y, 16, 16, TILE_HEIGHT + BB_HEIGHT_UNDER_BRIDGE, ti->z, IsTransparencySet(TO_BUILDINGS));
 
	AddSortableSpriteToDraw(front, PAL_NONE, ti->x, ti->y, 16, 16, TILE_HEIGHT + BB_HEIGHT_UNDER_BRIDGE, ti->z, IsTransparencySet(TO_BUILDINGS));
 
}
 

	
 
/**
 
 * Draws details on/around the road
 
 * @param img the sprite to draw
 
 * @param ti  the tile to draw on
 
@@ -1117,24 +1118,24 @@ static void DrawTile_Road(TileInfo *ti)
 
			DrawGroundSprite(dts->ground_sprite, PAL_NONE);
 

	
 
			for (dtss = dts->seq; dtss->image != 0; dtss++) {
 
				SpriteID image = dtss->image;
 
				SpriteID pal;
 

	
 
				if (!HASBIT(_transparent_opt, TO_BUILDINGS) && HASBIT(image, PALETTE_MODIFIER_COLOR)) {
 
				if (!IsTransparencySet(TO_BUILDINGS) && HASBIT(image, PALETTE_MODIFIER_COLOR)) {
 
					pal = palette;
 
				} else {
 
					pal = PAL_NONE;
 
				}
 

	
 
				AddSortableSpriteToDraw(
 
					image, pal,
 
					ti->x + dtss->delta_x, ti->y + dtss->delta_y,
 
					dtss->size_x, dtss->size_y,
 
					dtss->size_z, ti->z,
 
					HASBIT(_transparent_opt, TO_BUILDINGS)
 
					IsTransparencySet(TO_BUILDINGS)
 
				);
 
			}
 
			break;
 
		}
 
	}
 
	DrawBridgeMiddle(ti);