Codechange: Codestyle fixes for elrail code.

This commit is contained in:
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

@@ -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},