1
0
Fork 0

Codechange: Codestyle fixes for elrail code.

pull/14236/head
Peter Nelson 2025-05-07 07:49:05 +01:00 committed by Peter Nelson
parent 4a8dd494ee
commit 2feba80fd7
2 changed files with 71 additions and 74 deletions

View File

@ -213,10 +213,10 @@ static void AdjustTileh(TileIndex tile, Slope *tileh)
* Returns the Z position of a Pylon Control Point.
*
* @param tile The tile the pylon should stand on.
* @param PCPpos The PCP of the tile.
* @param pcp_pos The PCP of the tile.
* @return The Z position of the PCP.
*/
static int GetPCPElevation(TileIndex tile, DiagDirection PCPpos)
static int GetPCPElevation(TileIndex tile, DiagDirection pcp_pos)
{
/* The elevation of the "pylon"-sprite should be the elevation at the PCP.
* PCPs are always on a tile edge.
@ -232,8 +232,8 @@ static int GetPCPElevation(TileIndex tile, DiagDirection PCPpos)
* Also note that the result of GetSlopePixelZ() is very special on bridge-ramps.
*/
int z = GetSlopePixelZ(TileX(tile) * TILE_SIZE + std::min<int8_t>(x_pcp_offsets[PCPpos], TILE_SIZE - 1),
TileY(tile) * TILE_SIZE + std::min<int8_t>(y_pcp_offsets[PCPpos], TILE_SIZE - 1), true);
int z = GetSlopePixelZ(TileX(tile) * TILE_SIZE + std::min<int8_t>(_x_pcp_offsets[pcp_pos], TILE_SIZE - 1),
TileY(tile) * TILE_SIZE + std::min<int8_t>(_y_pcp_offsets[pcp_pos], TILE_SIZE - 1), true);
/* Round the Z to the nearest half tile height. */
static const uint HALF_TILE_HEIGHT = TILE_HEIGHT / 2;
return (z + HALF_TILE_HEIGHT / 2) / HALF_TILE_HEIGHT * HALF_TILE_HEIGHT;
@ -249,7 +249,7 @@ static int GetPCPElevation(TileIndex tile, DiagDirection PCPpos)
void DrawRailCatenaryOnTunnel(const TileInfo *ti)
{
/* xmin, ymin, xmax + 1, ymax + 1 of BB */
static const int _tunnel_wire_BB[4][4] = {
static const int tunnel_wire_bb[4][4] = {
{ 0, 1, 16, 15 }, // NE
{ 1, 0, 15, 16 }, // SE
{ 0, 1, 16, 15 }, // SW
@ -260,14 +260,14 @@ void DrawRailCatenaryOnTunnel(const TileInfo *ti)
SpriteID wire_base = GetWireBase(ti->tile);
const SortableSpriteStruct *sss = &RailCatenarySpriteData_Tunnel[dir];
const int *BB_data = _tunnel_wire_BB[dir];
const SortableSpriteStruct *sss = &_rail_catenary_sprite_data_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,
BB_data[2] - sss->x_offset, BB_data[3] - sss->y_offset, BB_Z_SEPARATOR - sss->z_offset + 1,
bb_data[2] - sss->x_offset, bb_data[3] - sss->y_offset, BB_Z_SEPARATOR - sss->z_offset + 1,
GetTilePixelZ(ti->tile) + sss->z_offset,
IsTransparencySet(TO_CATENARY),
BB_data[0] - sss->x_offset, BB_data[1] - sss->y_offset, BB_Z_SEPARATOR - sss->z_offset
bb_data[0] - sss->x_offset, bb_data[1] - sss->y_offset, BB_Z_SEPARATOR - sss->z_offset
);
}
@ -280,9 +280,9 @@ 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
* current tile (home tile) while [1] holds the neighbour */
TrackBits trackconfig[TS_END];
TrackBits wireconfig[TS_END];
bool isflat[TS_END];
TrackBits track_config[TS_END];
TrackBits wire_config[TS_END];
bool is_flat[TS_END];
/* Note that ti->tileh has already been adjusted for Foundations */
Slope tileh[TS_END] = { ti->tileh, SLOPE_FLAT };
@ -306,10 +306,10 @@ static void DrawRailCatenaryRailway(const TileInfo *ti)
* 2) on the "far" end of a bridge head (the one that connects to bridge middle),
* because that one is drawn on the bridge. Exception is for length 0 bridges
* which have no middle tiles */
trackconfig[TS_HOME] = GetRailTrackBitsUniversal(ti->tile, &override_pcp);
wireconfig[TS_HOME] = MaskWireBits(ti->tile, trackconfig[TS_HOME]);
track_config[TS_HOME] = GetRailTrackBitsUniversal(ti->tile, &override_pcp);
wire_config[TS_HOME] = MaskWireBits(ti->tile, track_config[TS_HOME]);
/* If a track bit is present that is not in the main direction, the track is level */
isflat[TS_HOME] = ((trackconfig[TS_HOME] & (TRACK_BIT_HORZ | TRACK_BIT_VERT)) != 0);
is_flat[TS_HOME] = ((track_config[TS_HOME] & (TRACK_BIT_HORZ | TRACK_BIT_VERT)) != 0);
AdjustTileh(ti->tile, &tileh[TS_HOME]);
@ -330,27 +330,27 @@ static void DrawRailCatenaryRailway(const TileInfo *ti)
/* Here's one of the main headaches. GetTileSlope does not correct for possibly
* existing foundataions, so we do have to do that manually later on.*/
tileh[TS_NEIGHBOUR] = GetTileSlope(neighbour);
trackconfig[TS_NEIGHBOUR] = GetRailTrackBitsUniversal(neighbour, nullptr);
wireconfig[TS_NEIGHBOUR] = MaskWireBits(neighbour, trackconfig[TS_NEIGHBOUR]);
if (IsTunnelTile(neighbour) && i != GetTunnelBridgeDirection(neighbour)) wireconfig[TS_NEIGHBOUR] = trackconfig[TS_NEIGHBOUR] = TRACK_BIT_NONE;
track_config[TS_NEIGHBOUR] = GetRailTrackBitsUniversal(neighbour, nullptr);
wire_config[TS_NEIGHBOUR] = MaskWireBits(neighbour, track_config[TS_NEIGHBOUR]);
if (IsTunnelTile(neighbour) && i != GetTunnelBridgeDirection(neighbour)) wire_config[TS_NEIGHBOUR] = track_config[TS_NEIGHBOUR] = TRACK_BIT_NONE;
/* Ignore station tiles that allow neither wires nor pylons. */
if (IsRailStationTile(neighbour) && !CanStationTileHavePylons(neighbour) && !CanStationTileHaveWires(neighbour)) wireconfig[TS_NEIGHBOUR] = trackconfig[TS_NEIGHBOUR] = TRACK_BIT_NONE;
if (IsRailStationTile(neighbour) && !CanStationTileHavePylons(neighbour) && !CanStationTileHaveWires(neighbour)) wire_config[TS_NEIGHBOUR] = track_config[TS_NEIGHBOUR] = TRACK_BIT_NONE;
/* If the neighboured tile does not smoothly connect to the current tile (because of a foundation),
* we have to draw all pillars on the current tile. */
if (elevation != GetPCPElevation(neighbour, ReverseDiagDir(i))) wireconfig[TS_NEIGHBOUR] = trackconfig[TS_NEIGHBOUR] = TRACK_BIT_NONE;
if (elevation != GetPCPElevation(neighbour, ReverseDiagDir(i))) wire_config[TS_NEIGHBOUR] = track_config[TS_NEIGHBOUR] = TRACK_BIT_NONE;
isflat[TS_NEIGHBOUR] = ((trackconfig[TS_NEIGHBOUR] & (TRACK_BIT_HORZ | TRACK_BIT_VERT)) != 0);
is_flat[TS_NEIGHBOUR] = ((track_config[TS_NEIGHBOUR] & (TRACK_BIT_HORZ | TRACK_BIT_VERT)) != 0);
ppp_preferred[i] = DIRECTIONS_ALL; // We start with preferring everything (end-of-line in any direction)
ppp_allowed[i] = AllowedPPPonPCP[i];
ppp_allowed[i] = _allowed_ppp_on_pcp[i];
/* We cycle through all the existing tracks at a PCP and see what
* PPPs we want to have, or may not have at all */
for (uint k = 0; k < NUM_TRACKS_AT_PCP; k++) {
/* Next to us, we have a bridge head, don't worry about that one, if it shows away from us */
if (TrackSourceTile[i][k] == TS_NEIGHBOUR &&
if (_track_source_tile[i][k] == TS_NEIGHBOUR &&
IsBridgeTile(neighbour) &&
GetTunnelBridgeDirection(neighbour) == ReverseDiagDir(i)) {
continue;
@ -359,16 +359,16 @@ static void DrawRailCatenaryRailway(const TileInfo *ti)
/* We check whether the track in question (k) is present in the tile
* (TrackSourceTile) */
DiagDirection pcp_pos = i;
if (HasBit(wireconfig[TrackSourceTile[i][k]], TracksAtPCP[i][k])) {
if (HasBit(wire_config[_track_source_tile[i][k]], _tracks_at_pcp[i][k])) {
/* track found, if track is in the neighbour tile, adjust the number
* of the PCP for preferred/allowed determination*/
pcp_pos = (TrackSourceTile[i][k] == TS_HOME) ? i : ReverseDiagDir(i);
pcp_pos = (_track_source_tile[i][k] == TS_HOME) ? i : ReverseDiagDir(i);
pcp_status.Set(i); // This PCP is in use
ppp_preferred[i] &= PreferredPPPofTrackAtPCP[TracksAtPCP[i][k]][pcp_pos];
ppp_preferred[i] &= _preferred_ppp_of_track_at_pcp[_tracks_at_pcp[i][k]][pcp_pos];
}
if (HasBit(trackconfig[TrackSourceTile[i][k]], TracksAtPCP[i][k])) {
ppp_allowed[i].Reset(DisallowedPPPofTrackAtPCP[TracksAtPCP[i][k]][pcp_pos]);
if (HasBit(track_config[_track_source_tile[i][k]], _tracks_at_pcp[i][k])) {
ppp_allowed[i].Reset(_disallowed_ppp_of_track_at_pcp[_tracks_at_pcp[i][k]][pcp_pos]);
}
}
@ -384,7 +384,7 @@ static void DrawRailCatenaryRailway(const TileInfo *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) && HasRailCatenary(GetRailType(neighbour))) foundation = GetRailFoundation(tileh[TS_NEIGHBOUR], trackconfig[TS_NEIGHBOUR]);
if (track_config[TS_NEIGHBOUR] != TRACK_BIT_NONE && IsTileType(neighbour, MP_RAILWAY) && HasRailCatenary(GetRailType(neighbour))) foundation = GetRailFoundation(tileh[TS_NEIGHBOUR], track_config[TS_NEIGHBOUR]);
if (IsBridgeTile(neighbour)) {
foundation = GetBridgeFoundation(tileh[TS_NEIGHBOUR], DiagDirToAxis(GetTunnelBridgeDirection(neighbour)));
}
@ -400,9 +400,9 @@ static void DrawRailCatenaryRailway(const TileInfo *ti)
/* If we have a straight (and level) track, we want a pylon only every 2 tiles
* Delete the PCP if this is the case.
* Level means that the slope is the same, or the track is flat */
if (tileh[TS_HOME] == tileh[TS_NEIGHBOUR] || (isflat[TS_HOME] && isflat[TS_NEIGHBOUR])) {
if (tileh[TS_HOME] == tileh[TS_NEIGHBOUR] || (is_flat[TS_HOME] && is_flat[TS_NEIGHBOUR])) {
for (uint k = 0; k < NUM_IGNORE_GROUPS; k++) {
if (ppp_preferred[i] == IgnoredPCP[k][tlg][i]) pcp_status.Reset(i);
if (ppp_preferred[i] == _ignored_pcp[k][tlg][i]) pcp_status.Reset(i);
}
}
@ -417,7 +417,7 @@ static void DrawRailCatenaryRailway(const TileInfo *ti)
int height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile));
if ((height <= GetTileMaxZ(ti->tile) + 1) &&
(i == PCPpositions[bridgetrack][0] || i == PCPpositions[bridgetrack][1])) {
(i == _pcp_positions[bridgetrack][0] || i == _pcp_positions[bridgetrack][1])) {
override_pcp.Set(i);
}
}
@ -425,22 +425,22 @@ static void DrawRailCatenaryRailway(const TileInfo *ti)
if (ppp_allowed[i].Any() && pcp_status.Test(i) && !override_pcp.Test(i) &&
(!IsRailStationTile(ti->tile) || CanStationTileHavePylons(ti->tile))) {
const auto &ppp_orders = PPPorder[i][GetTileLocationGroup(ti->tile)];
const auto &ppp_orders = _ppp_order[i][GetTileLocationGroup(ti->tile)];
for (Direction k = DIR_BEGIN; k < DIR_END; k++) {
Direction temp = ppp_orders[k];
if (ppp_allowed[i].Test(temp)) {
uint x = ti->x + x_pcp_offsets[i] + x_ppp_offsets[temp];
uint y = ti->y + y_pcp_offsets[i] + y_ppp_offsets[temp];
uint x = ti->x + _x_pcp_offsets[i] + _x_ppp_offsets[temp];
uint y = ti->y + _y_pcp_offsets[i] + _y_ppp_offsets[temp];
/* Don't build the pylon if it would be outside the tile */
if (!OwnedPPPonPCP[i].Test(temp)) {
if (!_owned_ppp_on_pcp[i].Test(temp)) {
/* We have a neighbour that will draw it, bail out */
if (trackconfig[TS_NEIGHBOUR] != TRACK_BIT_NONE) break;
if (track_config[TS_NEIGHBOUR] != TRACK_BIT_NONE) break;
continue; // No neighbour, go looking for a better position
}
AddSortableSpriteToDraw(pylon_base + pylon_sprites[temp], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE,
AddSortableSpriteToDraw(pylon_base + _pylon_sprites[temp], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE,
elevation, IsTransparencySet(TO_CATENARY), -1, -1);
break; // We already have drawn a pylon, bail out
@ -474,17 +474,15 @@ static void DrawRailCatenaryRailway(const TileInfo *ti)
}
/* Drawing of pylons is finished, now draw the wires */
for (Track t : SetTrackBitIterator(wireconfig[TS_HOME])) {
for (Track t : SetTrackBitIterator(wire_config[TS_HOME])) {
SpriteID wire_base = (t == halftile_track) ? wire_halftile : wire_normal;
uint8_t pcp_config = pcp_status.Test(PCPpositions[t][0]) +
(pcp_status.Test(PCPpositions[t][1]) << 1);
const SortableSpriteStruct *sss;
uint8_t pcp_config = pcp_status.Test(_pcp_positions[t][0]) +
(pcp_status.Test(_pcp_positions[t][1]) << 1);
int tileh_selector = !(tileh[TS_HOME] % 3) * tileh[TS_HOME] / 3; // tileh for the slopes, 0 otherwise
assert(pcp_config != 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 = &RailCatenarySpriteData[Wires[tileh_selector][t][pcp_config]];
const SortableSpriteStruct *sss = &_rail_catenary_sprite_data[_rail_wires[tileh_selector][t][pcp_config]];
/*
* The "wire"-sprite position is inside the tile, i.e. 0 <= sss->?_offset < TILE_SIZE.
@ -512,24 +510,23 @@ void DrawRailCatenaryOnBridge(const TileInfo *ti)
uint length = GetTunnelBridgeLength(start, end);
uint num = GetTunnelBridgeLength(ti->tile, start) + 1;
uint height;
const SortableSpriteStruct *sss;
Axis axis = GetBridgeAxis(ti->tile);
TileLocationGroup tlg = GetTileLocationGroup(ti->tile);
RailCatenarySprite offset = (RailCatenarySprite)(axis == AXIS_X ? 0 : WIRE_Y_FLAT_BOTH - WIRE_X_FLAT_BOTH);
const SortableSpriteStruct *sss;
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 = &RailCatenarySpriteData[WIRE_X_FLAT_BOTH + offset];
sss = &_rail_catenary_sprite_data[WIRE_X_FLAT_BOTH + offset];
} else {
/* Draw "long" wires on all other tiles of the bridge (one pylon every two tiles) */
sss = &RailCatenarySpriteData[WIRE_X_FLAT_SW + (num % 2) + offset];
sss = &_rail_catenary_sprite_data[WIRE_X_FLAT_SW + (num % 2) + offset];
}
height = GetBridgePixelHeight(end);
uint height = GetBridgePixelHeight(end);
SpriteID wire_base = GetWireBase(end, TCX_ON_BRIDGE);
@ -546,9 +543,9 @@ void DrawRailCatenaryOnBridge(const TileInfo *ti)
DiagDirection pcp_pos = (axis == AXIS_X ? DIAGDIR_NE : DIAGDIR_NW);
Direction ppp_pos = (axis == AXIS_X ? DIR_NW : DIR_NE);
if (HasBit(tlg, (axis == AXIS_X ? 0 : 1))) ppp_pos = ReverseDir(ppp_pos);
uint x = ti->x + x_pcp_offsets[pcp_pos] + x_ppp_offsets[ppp_pos];
uint y = ti->y + y_pcp_offsets[pcp_pos] + y_ppp_offsets[ppp_pos];
AddSortableSpriteToDraw(pylon_base + pylon_sprites[ppp_pos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_CATENARY), -1, -1);
uint x = ti->x + _x_pcp_offsets[pcp_pos] + _x_ppp_offsets[ppp_pos];
uint y = ti->y + _y_pcp_offsets[pcp_pos] + _y_ppp_offsets[ppp_pos];
AddSortableSpriteToDraw(pylon_base + _pylon_sprites[ppp_pos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_CATENARY), -1, -1);
}
/* need a pylon on the southern end of the bridge */
@ -556,9 +553,9 @@ void DrawRailCatenaryOnBridge(const TileInfo *ti)
DiagDirection pcp_pos = (axis == AXIS_X ? DIAGDIR_SW : DIAGDIR_SE);
Direction ppp_pos = (axis == AXIS_X ? DIR_NW : DIR_NE);
if (HasBit(tlg, (axis == AXIS_X ? 0 : 1))) ppp_pos = ReverseDir(ppp_pos);
uint x = ti->x + x_pcp_offsets[pcp_pos] + x_ppp_offsets[ppp_pos];
uint y = ti->y + y_pcp_offsets[pcp_pos] + y_ppp_offsets[ppp_pos];
AddSortableSpriteToDraw(pylon_base + pylon_sprites[ppp_pos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_CATENARY), -1, -1);
uint x = ti->x + _x_pcp_offsets[pcp_pos] + _x_ppp_offsets[ppp_pos];
uint y = ti->y + _y_pcp_offsets[pcp_pos] + _y_ppp_offsets[ppp_pos];
AddSortableSpriteToDraw(pylon_base + _pylon_sprites[ppp_pos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_CATENARY), -1, -1);
}
}
@ -572,7 +569,7 @@ void DrawRailCatenary(const TileInfo *ti)
switch (GetTileType(ti->tile)) {
case MP_RAILWAY:
if (IsRailDepot(ti->tile)) {
const SortableSpriteStruct *sss = &RailCatenarySpriteData_Depot[GetRailDepotDirection(ti->tile)];
const SortableSpriteStruct *sss = &_rail_catenary_sprite_data_depot[GetRailDepotDirection(ti->tile)];
SpriteID wire_base = GetWireBase(ti->tile);

View File

@ -40,7 +40,7 @@ enum TileSource : uint8_t {
static const uint NUM_TRACKS_AT_PCP = 6;
/** Which PPPs are possible at all on a given PCP */
static const Directions AllowedPPPonPCP[DIAGDIR_END] = {
static const Directions _allowed_ppp_on_pcp[DIAGDIR_END] = {
{DIR_N, DIR_E, DIR_SE, DIR_S, DIR_W, DIR_NW},
{DIR_N, DIR_NE, DIR_E, DIR_S, DIR_SW, DIR_W},
{DIR_N, DIR_E, DIR_SE, DIR_S, DIR_W, DIR_NW},
@ -52,7 +52,7 @@ static const Directions AllowedPPPonPCP[DIAGDIR_END] = {
* the following system is used: if you rotate the PCP so that it is in the
* north, the eastern PPP belongs to the tile.
*/
static const Directions OwnedPPPonPCP[DIAGDIR_END] = {
static const Directions _owned_ppp_on_pcp[DIAGDIR_END] = {
{DIR_SE, DIR_S, DIR_SW, DIR_W},
{DIR_N, DIR_SW, DIR_W, DIR_NW},
{DIR_N, DIR_NE, DIR_E, DIR_NW},
@ -60,7 +60,7 @@ static const Directions OwnedPPPonPCP[DIAGDIR_END] = {
};
/** Maps a track bit onto two PCP positions */
static const DiagDirection PCPpositions[TRACK_END][2] = {
static const DiagDirection _pcp_positions[TRACK_END][2] = {
{DIAGDIR_NE, DIAGDIR_SW}, // X
{DIAGDIR_SE, DIAGDIR_NW}, // Y
{DIAGDIR_NW, DIAGDIR_NE}, // UPPER
@ -75,7 +75,7 @@ static const DiagDirection PCPpositions[TRACK_END][2] = {
* which are not on either end of the track are fully preferred.
* @see PCPpositions
*/
static const Directions PreferredPPPofTrackAtPCP[TRACK_END][DIAGDIR_END] = {
static const Directions _preferred_ppp_of_track_at_pcp[TRACK_END][DIAGDIR_END] = {
{ // X
{DIR_NE, DIR_SE, DIR_NW}, // NE
DIRECTIONS_ALL, // SE
@ -120,7 +120,7 @@ static const Directions PreferredPPPofTrackAtPCP[TRACK_END][DIAGDIR_END] = {
* so there are certain tiles which we ignore. A straight line is found if
* we have exactly two PPPs.
*/
static const Directions IgnoredPCP[NUM_IGNORE_GROUPS][TLG_END][DIAGDIR_END] = {
static const Directions _ignored_pcp[NUM_IGNORE_GROUPS][TLG_END][DIAGDIR_END] = {
{ // Ignore group 1, X and Y tracks
{ // X even, Y even
DIRECTIONS_ALL,
@ -193,7 +193,7 @@ static const Directions IgnoredPCP[NUM_IGNORE_GROUPS][TLG_END][DIAGDIR_END] = {
};
/** Which pylons can definitely NOT be built */
static const Directions DisallowedPPPofTrackAtPCP[TRACK_END][DIAGDIR_END] = {
static const Directions _disallowed_ppp_of_track_at_pcp[TRACK_END][DIAGDIR_END] = {
{{DIR_SW, DIR_NE}, {}, {DIR_SW, DIR_NE}, {} }, // X
{{}, {DIR_NW, DIR_SE}, {}, {DIR_NW, DIR_SE}}, // Y
{{DIR_W, DIR_E}, {}, {}, {DIR_W, DIR_E} }, // UPPER
@ -203,7 +203,7 @@ static const Directions DisallowedPPPofTrackAtPCP[TRACK_END][DIAGDIR_END] = {
};
/* This array stores which track bits can meet at a tile edge */
static const Track TracksAtPCP[DIAGDIR_END][NUM_TRACKS_AT_PCP] = {
static const Track _tracks_at_pcp[DIAGDIR_END][NUM_TRACKS_AT_PCP] = {
{TRACK_X, TRACK_X, TRACK_UPPER, TRACK_LOWER, TRACK_LEFT, TRACK_RIGHT},
{TRACK_Y, TRACK_Y, TRACK_UPPER, TRACK_LOWER, TRACK_LEFT, TRACK_RIGHT},
{TRACK_X, TRACK_X, TRACK_UPPER, TRACK_LOWER, TRACK_LEFT, TRACK_RIGHT},
@ -212,7 +212,7 @@ static const Track TracksAtPCP[DIAGDIR_END][NUM_TRACKS_AT_PCP] = {
/* takes each of the 6 track bits from the array above and
* assigns it to the home tile or neighbour tile */
static const TileSource TrackSourceTile[DIAGDIR_END][NUM_TRACKS_AT_PCP] = {
static const TileSource _track_source_tile[DIAGDIR_END][NUM_TRACKS_AT_PCP] = {
{TS_HOME, TS_NEIGHBOUR, TS_HOME , TS_NEIGHBOUR, TS_NEIGHBOUR, TS_HOME },
{TS_HOME, TS_NEIGHBOUR, TS_NEIGHBOUR, TS_HOME , TS_NEIGHBOUR, TS_HOME },
{TS_HOME, TS_NEIGHBOUR, TS_NEIGHBOUR, TS_HOME , TS_HOME , TS_NEIGHBOUR},
@ -220,7 +220,7 @@ static const TileSource TrackSourceTile[DIAGDIR_END][NUM_TRACKS_AT_PCP] = {
};
/* Several PPPs maybe exist, here they are sorted in order of preference. */
static const Direction PPPorder[DIAGDIR_END][TLG_END][DIR_END] = { // X - Y
static const Direction _ppp_order[DIAGDIR_END][TLG_END][DIR_END] = { // X - Y
{ // PCP 0
{DIR_NE, DIR_NW, DIR_SE, DIR_SW, DIR_N, DIR_E, DIR_S, DIR_W}, // evn - evn
{DIR_NE, DIR_SE, DIR_SW, DIR_NW, DIR_S, DIR_W, DIR_N, DIR_E}, // evn - odd
@ -244,11 +244,11 @@ static const Direction PPPorder[DIAGDIR_END][TLG_END][DIR_END] = { // X -
}
};
/* Geometric placement of the PCP relative to the tile origin */
static const int8_t x_pcp_offsets[DIAGDIR_END] = {0, 8, 16, 8};
static const int8_t y_pcp_offsets[DIAGDIR_END] = {8, 16, 8, 0};
static const int8_t _x_pcp_offsets[DIAGDIR_END] = {0, 8, 16, 8};
static const int8_t _y_pcp_offsets[DIAGDIR_END] = {8, 16, 8, 0};
/* Geometric placement of the PPP relative to the PCP*/
static const int8_t x_ppp_offsets[DIR_END] = {-2, -4, -2, 0, 2, 4, 2, 0};
static const int8_t y_ppp_offsets[DIR_END] = {-2, 0, 2, 4, 2, 0, -2, -4};
static const int8_t _x_ppp_offsets[DIR_END] = {-2, -4, -2, 0, 2, 4, 2, 0};
static const int8_t _y_ppp_offsets[DIR_END] = {-2, 0, 2, 4, 2, 0, -2, -4};
/**
* Offset for pylon sprites from the base pylon sprite.
@ -265,7 +265,7 @@ enum PylonSpriteOffset : uint8_t {
};
/* The type of pylon to draw at each PPP */
static const uint8_t pylon_sprites[] = {
static const uint8_t _pylon_sprites[] = {
PSO_EW_N,
PSO_Y_NE,
PSO_NS_E,
@ -330,7 +330,7 @@ static const uint ELRAIL_ELEVRAISE = ELRAIL_ELEVATION + TILE_HEIGHT + 1;
/** Wires that a draw one level lower than the north corner. */
static const uint ELRAIL_ELEVLOWER = ELRAIL_ELEVATION - 1;
static const SortableSpriteStruct RailCatenarySpriteData[] = {
static const SortableSpriteStruct _rail_catenary_sprite_data[] = {
/* X direction
* Flat tiles:
* Wires */
@ -391,14 +391,14 @@ static const SortableSpriteStruct RailCatenarySpriteData[] = {
{ WSO_EW_E, 15, 8, 3, 3, 1, ELRAIL_ELEVATION } //!33: LOWER trackbit wire, pylon on both ends
};
static const SortableSpriteStruct RailCatenarySpriteData_Depot[] = {
static const SortableSpriteStruct _rail_catenary_sprite_data_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 RailCatenarySpriteData_Tunnel[] = {
static const SortableSpriteStruct _rail_catenary_sprite_data_tunnel[] = {
{ WSO_ENTRANCE_SW, 0, 7, 15, 1, 1, ELRAIL_ELEVATION }, //! Wire for NE tunnel (SW facing exit)
{ WSO_ENTRANCE_NW, 7, 0, 1, 15, 1, ELRAIL_ELEVATION }, //! Wire for SE tunnel (NW facing exit)
{ WSO_ENTRANCE_NE, 0, 7, 15, 1, 1, ELRAIL_ELEVATION }, //! Wire for SW tunnel (NE facing exit)
@ -470,7 +470,7 @@ enum RailCatenarySprite : uint8_t {
* c) the second
* d) both
* PCP exists.*/
static const RailCatenarySprite Wires[5][TRACK_END][4] = {
static const RailCatenarySprite _rail_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},