Changeset - r22469:27e3000e0fc8
[Not reviewed]
master
0 9 0
frosch - 8 years ago 2016-11-05 11:53:03
frosch@openttd.org
(svn r27676) -Codechange: Rename catenary functions, so that they refer unambiguously to either RoadCatenary or RailCatenary.
9 files changed with 48 insertions and 48 deletions:
0 comments (0 inline, 0 general)
src/elrail.cpp
Show inline comments
 
@@ -89,7 +89,7 @@ static TrackBits GetRailTrackBitsUnivers
 
{
 
	switch (GetTileType(t)) {
 
		case MP_RAILWAY:
 
			if (!HasCatenary(GetRailType(t))) return TRACK_BIT_NONE;
 
			if (!HasRailCatenary(GetRailType(t))) return TRACK_BIT_NONE;
 
			switch (GetRailTileType(t)) {
 
				case RAIL_TILE_NORMAL: case RAIL_TILE_SIGNALS:
 
					return GetTrackBits(t);
 
@@ -99,7 +99,7 @@ static TrackBits GetRailTrackBitsUnivers
 
			break;
 

	
 
		case MP_TUNNELBRIDGE:
 
			if (!HasCatenary(GetRailType(t))) return TRACK_BIT_NONE;
 
			if (!HasRailCatenary(GetRailType(t))) return TRACK_BIT_NONE;
 
			if (override != NULL && (IsTunnel(t) || GetTunnelBridgeLength(t, GetOtherBridgeEnd(t)) > 0)) {
 
				*override = 1 << GetTunnelBridgeDirection(t);
 
			}
 
@@ -107,12 +107,12 @@ static TrackBits GetRailTrackBitsUnivers
 

	
 
		case MP_ROAD:
 
			if (!IsLevelCrossing(t)) return TRACK_BIT_NONE;
 
			if (!HasCatenary(GetRailType(t))) return TRACK_BIT_NONE;
 
			if (!HasRailCatenary(GetRailType(t))) return TRACK_BIT_NONE;
 
			return GetCrossingRailBits(t);
 

	
 
		case MP_STATION:
 
			if (!HasStationRail(t)) return TRACK_BIT_NONE;
 
			if (!HasCatenary(GetRailType(t))) return TRACK_BIT_NONE;
 
			if (!HasRailCatenary(GetRailType(t))) return TRACK_BIT_NONE;
 
			return TrackToTrackBits(GetRailStationTrack(t));
 

	
 
		default:
 
@@ -135,7 +135,7 @@ static TrackBits MaskWireBits(TileIndex 
 
		 * axis that still display wires to preserve visual continuity. */
 
		TileIndex next_tile = TileAddByDiagDir(t, d);
 
		RailType rt = GetTileRailType(next_tile);
 
		if (rt == INVALID_RAILTYPE || !HasCatenary(rt) ||
 
		if (rt == INVALID_RAILTYPE || !HasRailCatenary(rt) ||
 
				((TrackStatusToTrackBits(GetTileTrackStatus(next_tile, TRANSPORT_RAIL, 0)) & DiagdirReachesTracks(d)) == TRACK_BIT_NONE &&
 
				(!HasStationTileRail(next_tile) || GetRailStationAxis(next_tile) != DiagDirToAxis(d) || !CanStationTileHaveWires(next_tile)))) {
 
			neighbour_tdb |= DiagdirReachesTrackdirs(ReverseDiagDir(d));
 
@@ -241,7 +241,7 @@ static int GetPCPElevation(TileIndex til
 
 *
 
 * @param ti The Tileinfo to draw the tile for
 
 */
 
void DrawCatenaryOnTunnel(const TileInfo *ti)
 
void DrawRailCatenaryOnTunnel(const TileInfo *ti)
 
{
 
	/* xmin, ymin, xmax + 1, ymax + 1 of BB */
 
	static const int _tunnel_wire_BB[4][4] = {
 
@@ -255,7 +255,7 @@ void DrawCatenaryOnTunnel(const TileInfo
 

	
 
	SpriteID wire_base = GetWireBase(ti->tile);
 

	
 
	const SortableSpriteStruct *sss = &CatenarySpriteData_Tunnel[dir];
 
	const SortableSpriteStruct *sss = &RailCatenarySpriteData_Tunnel[dir];
 
	const int *BB_data = _tunnel_wire_BB[dir];
 
	AddSortableSpriteToDraw(
 
		wire_base + sss->image_offset, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
 
@@ -270,7 +270,7 @@ void DrawCatenaryOnTunnel(const TileInfo
 
 * Draws wires and, if required, pylons on a given tile
 
 * @param ti The Tileinfo to draw the tile for
 
 */
 
static void DrawCatenaryRailway(const TileInfo *ti)
 
static void DrawRailCatenaryRailway(const TileInfo *ti)
 
{
 
	/* Pylons are placed on a tile edge, so we need to take into account
 
	 * the track configuration of 2 adjacent tiles. trackconfig[0] stores the
 
@@ -379,7 +379,7 @@ static void DrawCatenaryRailway(const Ti
 
		if (IsTileType(neighbour, MP_STATION) || IsTileType(neighbour, MP_ROAD)) tileh[TS_NEIGHBOUR] = SLOPE_FLAT;
 

	
 
		/* Read the foundations if they are present, and adjust the tileh */
 
		if (trackconfig[TS_NEIGHBOUR] != TRACK_BIT_NONE && IsTileType(neighbour, MP_RAILWAY) && HasCatenary(GetRailType(neighbour))) foundation = GetRailFoundation(tileh[TS_NEIGHBOUR], trackconfig[TS_NEIGHBOUR]);
 
		if (trackconfig[TS_NEIGHBOUR] != TRACK_BIT_NONE && IsTileType(neighbour, MP_RAILWAY) && HasRailCatenary(GetRailType(neighbour))) foundation = GetRailFoundation(tileh[TS_NEIGHBOUR], trackconfig[TS_NEIGHBOUR]);
 
		if (IsBridgeTile(neighbour)) {
 
			foundation = GetBridgeFoundation(tileh[TS_NEIGHBOUR], DiagDirToAxis(GetTunnelBridgeDirection(neighbour)));
 
		}
 
@@ -442,7 +442,7 @@ static void DrawCatenaryRailway(const Ti
 
		}
 
	}
 

	
 
	/* The wire above the tunnel is drawn together with the tunnel-roof (see DrawCatenaryOnTunnel()) */
 
	/* The wire above the tunnel is drawn together with the tunnel-roof (see DrawRailCatenaryOnTunnel()) */
 
	if (IsTunnelTile(ti->tile)) return;
 

	
 
	/* Don't draw a wire under a low bridge */
 
@@ -478,7 +478,7 @@ static void DrawCatenaryRailway(const Ti
 

	
 
		assert(PCPconfig != 0); // We have a pylon on neither end of the wire, that doesn't work (since we have no sprites for that)
 
		assert(!IsSteepSlope(tileh[TS_HOME]));
 
		sss = &CatenarySpriteData[Wires[tileh_selector][t][PCPconfig]];
 
		sss = &RailCatenarySpriteData[Wires[tileh_selector][t][PCPconfig]];
 

	
 
		/*
 
		 * The "wire"-sprite position is inside the tile, i.e. 0 <= sss->?_offset < TILE_SIZE.
 
@@ -498,7 +498,7 @@ static void DrawCatenaryRailway(const Ti
 
 *
 
 * @param ti The Tileinfo to draw the tile for
 
 */
 
void DrawCatenaryOnBridge(const TileInfo *ti)
 
void DrawRailCatenaryOnBridge(const TileInfo *ti)
 
{
 
	TileIndex end = GetSouthernBridgeEnd(ti->tile);
 
	TileIndex start = GetOtherBridgeEnd(end);
 
@@ -511,15 +511,15 @@ void DrawCatenaryOnBridge(const TileInfo
 
	Axis axis = GetBridgeAxis(ti->tile);
 
	TLG tlg = GetTLG(ti->tile);
 

	
 
	CatenarySprite offset = (CatenarySprite)(axis == AXIS_X ? 0 : WIRE_Y_FLAT_BOTH - WIRE_X_FLAT_BOTH);
 
	RailCatenarySprite offset = (RailCatenarySprite)(axis == AXIS_X ? 0 : WIRE_Y_FLAT_BOTH - WIRE_X_FLAT_BOTH);
 

	
 
	if ((length % 2) && num == length) {
 
		/* Draw the "short" wire on the southern end of the bridge
 
		 * only needed if the length of the bridge is odd */
 
		sss = &CatenarySpriteData[WIRE_X_FLAT_BOTH + offset];
 
		sss = &RailCatenarySpriteData[WIRE_X_FLAT_BOTH + offset];
 
	} else {
 
		/* Draw "long" wires on all other tiles of the bridge (one pylon every two tiles) */
 
		sss = &CatenarySpriteData[WIRE_X_FLAT_SW + (num % 2) + offset];
 
		sss = &RailCatenarySpriteData[WIRE_X_FLAT_SW + (num % 2) + offset];
 
	}
 

	
 
	height = GetBridgePixelHeight(end);
 
@@ -558,14 +558,14 @@ void DrawCatenaryOnBridge(const TileInfo
 
/**
 
 * Draws overhead wires and pylons for electric railways.
 
 * @param ti The TileInfo struct of the tile being drawn
 
 * @see DrawCatenaryRailway
 
 * @see DrawRailCatenaryRailway
 
 */
 
void DrawCatenary(const TileInfo *ti)
 
void DrawRailCatenary(const TileInfo *ti)
 
{
 
	switch (GetTileType(ti->tile)) {
 
		case MP_RAILWAY:
 
			if (IsRailDepot(ti->tile)) {
 
				const SortableSpriteStruct *sss = &CatenarySpriteData_Depot[GetRailDepotDirection(ti->tile)];
 
				const SortableSpriteStruct *sss = &RailCatenarySpriteData_Depot[GetRailDepotDirection(ti->tile)];
 

	
 
				SpriteID wire_base = GetWireBase(ti->tile);
 

	
 
@@ -587,7 +587,7 @@ void DrawCatenary(const TileInfo *ti)
 

	
 
		default: return;
 
	}
 
	DrawCatenaryRailway(ti);
 
	DrawRailCatenaryRailway(ti);
 
}
 

	
 
bool SettingsDisableElrail(int32 p1)
src/elrail_func.h
Show inline comments
 
@@ -20,7 +20,7 @@
 
 * Test if a rail type has catenary
 
 * @param rt Rail type to test
 
 */
 
static inline bool HasCatenary(RailType rt)
 
static inline bool HasRailCatenary(RailType rt)
 
{
 
	return HasBit(GetRailTypeInfo(rt)->flags, RTF_CATENARY);
 
}
 
@@ -29,14 +29,14 @@ static inline bool HasCatenary(RailType 
 
 * Test if we should draw rail catenary
 
 * @param rt Rail type to test
 
 */
 
static inline bool HasCatenaryDrawn(RailType rt)
 
static inline bool HasRailCatenaryDrawn(RailType rt)
 
{
 
	return HasCatenary(rt) && !IsInvisibilitySet(TO_CATENARY) && !_settings_game.vehicle.disable_elrails;
 
	return HasRailCatenary(rt) && !IsInvisibilitySet(TO_CATENARY) && !_settings_game.vehicle.disable_elrails;
 
}
 

	
 
void DrawCatenary(const TileInfo *ti);
 
void DrawCatenaryOnTunnel(const TileInfo *ti);
 
void DrawCatenaryOnBridge(const TileInfo *ti);
 
void DrawRailCatenary(const TileInfo *ti);
 
void DrawRailCatenaryOnTunnel(const TileInfo *ti);
 
void DrawRailCatenaryOnBridge(const TileInfo *ti);
 

	
 
bool SettingsDisableElrail(int32 p1); ///< _settings_game.disable_elrail callback
 

	
src/newgrf.cpp
Show inline comments
 
@@ -5584,7 +5584,7 @@ static const Action5Type _action5_types[
 
	/* 0x02 */ { A5BLOCK_INVALID,      0,                            0, 0,                                           "Type 0x02"                },
 
	/* 0x03 */ { A5BLOCK_INVALID,      0,                            0, 0,                                           "Type 0x03"                },
 
	/* 0x04 */ { A5BLOCK_ALLOW_OFFSET, SPR_SIGNALS_BASE,             1, PRESIGNAL_SEMAPHORE_AND_PBS_SPRITE_COUNT,    "Signal graphics"          },
 
	/* 0x05 */ { A5BLOCK_ALLOW_OFFSET, SPR_ELRAIL_BASE,              1, ELRAIL_SPRITE_COUNT,                         "Catenary graphics"        },
 
	/* 0x05 */ { A5BLOCK_ALLOW_OFFSET, SPR_ELRAIL_BASE,              1, ELRAIL_SPRITE_COUNT,                         "Rail catenary graphics"   },
 
	/* 0x06 */ { A5BLOCK_ALLOW_OFFSET, SPR_SLOPES_BASE,              1, NORMAL_AND_HALFTILE_FOUNDATION_SPRITE_COUNT, "Foundation graphics"      },
 
	/* 0x07 */ { A5BLOCK_INVALID,      0,                           75, 0,                                           "TTDP GUI graphics"        }, // Not used by OTTD.
 
	/* 0x08 */ { A5BLOCK_ALLOW_OFFSET, SPR_CANALS_BASE,              1, CANALS_SPRITE_COUNT,                         "Canal graphics"           },
src/rail_cmd.cpp
Show inline comments
 
@@ -2394,7 +2394,7 @@ static void DrawTile_Track(TileInfo *ti)
 

	
 
		if (HasBit(_display_opt, DO_FULL_DETAIL)) DrawTrackDetails(ti, rti);
 

	
 
		if (HasCatenaryDrawn(GetRailType(ti->tile))) DrawCatenary(ti);
 
		if (HasRailCatenaryDrawn(GetRailType(ti->tile))) DrawRailCatenary(ti);
 

	
 
		if (HasSignals(ti->tile)) DrawSignals(ti->tile, rails, rti);
 
	} else {
 
@@ -2469,7 +2469,7 @@ static void DrawTile_Track(TileInfo *ti)
 
		int depot_sprite = GetCustomRailSprite(rti, ti->tile, RTSG_DEPOT);
 
		relocation = depot_sprite != 0 ? depot_sprite - SPR_RAIL_DEPOT_SE_1 : rti->GetRailtypeSpriteOffset();
 

	
 
		if (HasCatenaryDrawn(GetRailType(ti->tile))) DrawCatenary(ti);
 
		if (HasRailCatenaryDrawn(GetRailType(ti->tile))) DrawRailCatenary(ti);
 

	
 
		DrawRailTileSeq(ti, dts, TO_BUILDINGS, relocation, 0, _drawtile_track_palette);
 
	}
src/road_cmd.cpp
Show inline comments
 
@@ -1191,7 +1191,7 @@ static bool DrawRoadAsSnowDesert(TileInd
 
 * @param ti   information about the tile (slopes, height etc)
 
 * @param tram the roadbits for the tram
 
 */
 
void DrawTramCatenary(const TileInfo *ti, RoadBits tram)
 
void DrawRoadCatenary(const TileInfo *ti, RoadBits tram)
 
{
 
	/* Do not draw catenary if it is invisible */
 
	if (IsInvisibilitySet(TO_CATENARY)) return;
 
@@ -1298,7 +1298,7 @@ static void DrawRoadBits(TileInfo *ti)
 
		return;
 
	}
 

	
 
	if (tram != ROAD_NONE) DrawTramCatenary(ti, tram);
 
	if (tram != ROAD_NONE) DrawRoadCatenary(ti, tram);
 

	
 
	/* Return if full detail is disabled, or we are zoomed fully out. */
 
	if (!HasBit(_display_opt, DO_FULL_DETAIL) || _cur_dpi->zoom > ZOOM_LVL_DETAIL) return;
 
@@ -1388,9 +1388,9 @@ static void DrawTile_Road(TileInfo *ti)
 

	
 
			if (HasTileRoadType(ti->tile, ROADTYPE_TRAM)) {
 
				DrawGroundSprite(SPR_TRAMWAY_OVERLAY + (GetCrossingRoadAxis(ti->tile) ^ 1), pal);
 
				DrawTramCatenary(ti, GetCrossingRoadBits(ti->tile));
 
				DrawRoadCatenary(ti, GetCrossingRoadBits(ti->tile));
 
			}
 
			if (HasCatenaryDrawn(GetRailType(ti->tile))) DrawCatenary(ti);
 
			if (HasRailCatenaryDrawn(GetRailType(ti->tile))) DrawRailCatenary(ti);
 
			break;
 
		}
 

	
src/road_internal.h
Show inline comments
 
@@ -19,6 +19,6 @@ RoadBits CleanUpRoadBits(const TileIndex
 

	
 
CommandCost CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, Owner owner, RoadType rt, DoCommandFlag flags, bool town_check = true);
 

	
 
void DrawTramCatenary(const TileInfo *ti, RoadBits tram);
 
void DrawRoadCatenary(const TileInfo *ti, RoadBits tram);
 

	
 
#endif /* ROAD_INTERNAL_H */
src/station_cmd.cpp
Show inline comments
 
@@ -2897,12 +2897,12 @@ draw_default_foundation:
 
		}
 
	}
 

	
 
	if (HasStationRail(ti->tile) && HasCatenaryDrawn(GetRailType(ti->tile))) DrawCatenary(ti);
 
	if (HasStationRail(ti->tile) && HasRailCatenaryDrawn(GetRailType(ti->tile))) DrawRailCatenary(ti);
 

	
 
	if (HasBit(roadtypes, ROADTYPE_TRAM)) {
 
		Axis axis = GetRoadStopDir(ti->tile) == DIAGDIR_NE ? AXIS_X : AXIS_Y;
 
		DrawGroundSprite((HasBit(roadtypes, ROADTYPE_ROAD) ? SPR_TRAMWAY_OVERLAY : SPR_TRAMWAY_TRAM) + (axis ^ 1), PAL_NONE);
 
		DrawTramCatenary(ti, axis == AXIS_X ? ROAD_X : ROAD_Y);
 
		DrawRoadCatenary(ti, axis == AXIS_X ? ROAD_X : ROAD_Y);
 
	}
 

	
 
	if (IsRailWaypoint(ti->tile)) {
src/table/elrail_data.h
Show inline comments
 
@@ -331,7 +331,7 @@ static const uint ELRAIL_ELEVATION = 10;
 
/** Wires that a draw one level higher than the north corner. */
 
static const uint ELRAIL_ELEVRAISE = ELRAIL_ELEVATION + TILE_HEIGHT;
 

	
 
static const SortableSpriteStruct CatenarySpriteData[] = {
 
static const SortableSpriteStruct RailCatenarySpriteData[] = {
 
/* X direction
 
	 * Flat tiles:
 
		 * Wires */
 
@@ -392,14 +392,14 @@ static const SortableSpriteStruct Catena
 
	{ WSO_EW_E,         15,  8,  3,  3,  1, ELRAIL_ELEVATION }  //!33: LOWER trackbit wire, pylon on both ends
 
};
 

	
 
static const SortableSpriteStruct CatenarySpriteData_Depot[] = {
 
static const SortableSpriteStruct RailCatenarySpriteData_Depot[] = {
 
	{ WSO_ENTRANCE_NE,   0,  7, 15,  1,  1, ELRAIL_ELEVATION }, //! Wire for NE depot exit
 
	{ WSO_ENTRANCE_SE,   7,  0,  1, 15,  1, ELRAIL_ELEVATION }, //! Wire for SE depot exit
 
	{ WSO_ENTRANCE_SW,   0,  7, 15,  1,  1, ELRAIL_ELEVATION }, //! Wire for SW depot exit
 
	{ WSO_ENTRANCE_NW,   7,  0,  1, 15,  1, ELRAIL_ELEVATION }  //! Wire for NW depot exit
 
};
 

	
 
static const SortableSpriteStruct CatenarySpriteData_Tunnel[] = {
 
static const SortableSpriteStruct RailCatenarySpriteData_Tunnel[] = {
 
	{ WSO_ENTRANCE_NE,   0,  7, 15,  1,  1, ELRAIL_ELEVATION }, //! Wire for NE tunnel exit
 
	{ WSO_ENTRANCE_SE,   7,  0,  1, 15,  1, ELRAIL_ELEVATION }, //! Wire for SE tunnel exit
 
	{ WSO_ENTRANCE_SW,   0,  7, 15,  1,  1, ELRAIL_ELEVATION }, //! Wire for SW tunnel exit
 
@@ -419,7 +419,7 @@ static const SortableSpriteStruct Catena
 
 * <li>Position of the Pylon relative to the track</li>
 
 * <li>Position of the Pylon inside the tile</li></ol>
 
 */
 
enum CatenarySprite {
 
enum RailCatenarySprite {
 
	WIRE_X_FLAT_SW,
 
	WIRE_X_FLAT_NE,
 
	WIRE_X_FLAT_BOTH,
 
@@ -471,7 +471,7 @@ enum CatenarySprite {
 
 * c) the second
 
 * d) both
 
 * PCP exists.*/
 
static const CatenarySprite Wires[5][TRACK_END][4] = {
 
static const RailCatenarySprite Wires[5][TRACK_END][4] = {
 
	{ // Tileh == 0
 
		{INVALID_CATENARY, WIRE_X_FLAT_NE,   WIRE_X_FLAT_SW,   WIRE_X_FLAT_BOTH},
 
		{INVALID_CATENARY, WIRE_Y_FLAT_SE,   WIRE_Y_FLAT_NW,   WIRE_Y_FLAT_BOTH},
src/tunnelbridge_cmd.cpp
Show inline comments
 
@@ -1216,14 +1216,14 @@ static void DrawTile_TunnelBridge(TileIn
 
				}
 
			}
 

	
 
			if (HasCatenaryDrawn(GetRailType(ti->tile))) {
 
			if (HasRailCatenaryDrawn(GetRailType(ti->tile))) {
 
				/* Maybe draw pylons on the entry side */
 
				DrawCatenary(ti);
 
				DrawRailCatenary(ti);
 

	
 
				catenary = true;
 
				StartSpriteCombine();
 
				/* Draw wire above the ramp */
 
				DrawCatenaryOnTunnel(ti);
 
				DrawRailCatenaryOnTunnel(ti);
 
			}
 
		}
 

	
 
@@ -1341,8 +1341,8 @@ static void DrawTile_TunnelBridge(TileIn
 
			}
 

	
 
			EndSpriteCombine();
 
			if (HasCatenaryDrawn(GetRailType(ti->tile))) {
 
				DrawCatenary(ti);
 
			if (HasRailCatenaryDrawn(GetRailType(ti->tile))) {
 
				DrawRailCatenary(ti);
 
			}
 
		}
 

	
 
@@ -1392,7 +1392,7 @@ void DrawBridgeMiddle(const TileInfo *ti
 
{
 
	/* Sectional view of bridge bounding boxes:
 
	 *
 
	 *  1           2                                1,2 = SpriteCombine of Bridge front/(back&floor) and TramCatenary
 
	 *  1           2                                1,2 = SpriteCombine of Bridge front/(back&floor) and RoadCatenary
 
	 *  1           2                                  3 = empty helper BB
 
	 *  1     7     2                                4,5 = pillars under higher bridges
 
	 *  1 6 88888 6 2                                  6 = elrail-pylons
 
@@ -1491,8 +1491,8 @@ void DrawBridgeMiddle(const TileInfo *ti
 

	
 
		EndSpriteCombine();
 

	
 
		if (HasCatenaryDrawn(GetRailType(rampsouth))) {
 
			DrawCatenaryOnBridge(ti);
 
		if (HasRailCatenaryDrawn(GetRailType(rampsouth))) {
 
			DrawRailCatenaryOnBridge(ti);
 
		}
 
	}
 

	
0 comments (0 inline, 0 general)