src/elrail.cpp
changeset 8398 1e181e2e4e15
parent 8270 e7c342f6b14c
child 8399 2a583ffdcd0a
equal deleted inserted replaced
8397:db3e5c72c257 8398:1e181e2e4e15
    62 #include "rail_gui.h"
    62 #include "rail_gui.h"
    63 #include "transparency.h"
    63 #include "transparency.h"
    64 #include "tunnelbridge_map.h"
    64 #include "tunnelbridge_map.h"
    65 #include "vehicle_func.h"
    65 #include "vehicle_func.h"
    66 #include "player_base.h"
    66 #include "player_base.h"
       
    67 #include "tunnelbridge.h"
    67 
    68 
    68 #include "table/sprites.h"
    69 #include "table/sprites.h"
    69 #include "table/elrail_data.h"
    70 #include "table/elrail_data.h"
    70 
    71 
    71 static inline TLG GetTLG(TileIndex t)
    72 static inline TLG GetTLG(TileIndex t)
   381 static void DrawCatenaryOnBridge(const TileInfo *ti)
   382 static void DrawCatenaryOnBridge(const TileInfo *ti)
   382 {
   383 {
   383 	TileIndex end = GetSouthernBridgeEnd(ti->tile);
   384 	TileIndex end = GetSouthernBridgeEnd(ti->tile);
   384 	TileIndex start = GetOtherBridgeEnd(end);
   385 	TileIndex start = GetOtherBridgeEnd(end);
   385 
   386 
   386 	uint length = GetBridgeLength(start, end);
   387 	uint length = GetTunnelBridgeLength(start, end);
   387 	uint num = DistanceMax(ti->tile, start);
   388 	uint num = GetTunnelBridgeLength(ti->tile, start) + 1;
   388 	uint height;
   389 	uint height;
   389 
   390 
   390 	const SortableSpriteStruct *sss;
   391 	const SortableSpriteStruct *sss;
   391 	Axis axis = GetBridgeAxis(ti->tile);
   392 	Axis axis = GetBridgeAxis(ti->tile);
   392 	TLG tlg = GetTLG(ti->tile);
   393 	TLG tlg = GetTLG(ti->tile);
   419 		uint y = ti->y + y_pcp_offsets[PCPpos] + y_ppp_offsets[PPPpos];
   420 		uint y = ti->y + y_pcp_offsets[PCPpos] + y_ppp_offsets[PPPpos];
   420 		AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_BUILDINGS), -1, -1);
   421 		AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_BUILDINGS), -1, -1);
   421 	}
   422 	}
   422 
   423 
   423 	/* need a pylon on the southern end of the bridge */
   424 	/* need a pylon on the southern end of the bridge */
   424 	if (DistanceMax(ti->tile, start) == length) {
   425 	if (GetTunnelBridgeLength(ti->tile, start) + 1 == length) {
   425 		DiagDirection PCPpos = (axis == AXIS_X ? DIAGDIR_SW : DIAGDIR_SE);
   426 		DiagDirection PCPpos = (axis == AXIS_X ? DIAGDIR_SW : DIAGDIR_SE);
   426 		Direction PPPpos = (axis == AXIS_X ? DIR_NW : DIR_NE);
   427 		Direction PPPpos = (axis == AXIS_X ? DIR_NW : DIR_NE);
   427 		if (HasBit(tlg, (axis == AXIS_X ? 0 : 1))) PPPpos = ReverseDir(PPPpos);
   428 		if (HasBit(tlg, (axis == AXIS_X ? 0 : 1))) PPPpos = ReverseDir(PPPpos);
   428 		uint x = ti->x + x_pcp_offsets[PCPpos] + x_ppp_offsets[PPPpos];
   429 		uint x = ti->x + x_pcp_offsets[PCPpos] + x_ppp_offsets[PPPpos];
   429 		uint y = ti->y + y_pcp_offsets[PCPpos] + y_ppp_offsets[PPPpos];
   430 		uint y = ti->y + y_pcp_offsets[PCPpos] + y_ppp_offsets[PPPpos];