|
@@ -4,29 +4,32 @@
|
|
|
* This file is part of OpenTTD.
|
|
|
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
|
|
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
|
|
*/
|
|
|
|
|
|
/** @file elrail_data.h Stores all the data for overhead wire and pylon drawing.
|
|
|
/**
|
|
|
* @file elrail_data.h Stores all the data for overhead wire and pylon drawing.
|
|
|
* @see elrail.c */
|
|
|
|
|
|
#ifndef ELRAIL_DATA_H
|
|
|
#define ELRAIL_DATA_H
|
|
|
|
|
|
/** Tile Location group.
|
|
|
/**
|
|
|
* Tile Location group.
|
|
|
* This defines whether the X and or Y coordinate of a tile is even */
|
|
|
enum TLG {
|
|
|
XEVEN_YEVEN = 0,
|
|
|
XEVEN_YODD = 1,
|
|
|
XODD_YEVEN = 2,
|
|
|
XODD_YODD = 3,
|
|
|
TLG_END
|
|
|
};
|
|
|
|
|
|
/** When determining the pylon configuration on the edge, two tiles are taken
|
|
|
/**
|
|
|
* When determining the pylon configuration on the edge, two tiles are taken
|
|
|
* into account: the tile being drawn itself (the home tile, the one in
|
|
|
* ti->tile), and the neighbouring tile */
|
|
|
enum TileSource {
|
|
|
TS_HOME = 0,
|
|
|
TS_NEIGHBOUR = 1,
|
|
|
|
|
@@ -40,13 +43,14 @@ static const byte AllowedPPPonPCP[DIAGDI
|
|
|
1 << DIR_N | 1 << DIR_E | 1 << DIR_SE | 1 << DIR_S | 1 << DIR_W | 1 << DIR_NW,
|
|
|
1 << DIR_N | 1 << DIR_NE | 1 << DIR_E | 1 << DIR_S | 1 << DIR_SW | 1 << DIR_W,
|
|
|
1 << DIR_N | 1 << DIR_E | 1 << DIR_SE | 1 << DIR_S | 1 << DIR_W | 1 << DIR_NW,
|
|
|
1 << DIR_N | 1 << DIR_NE | 1 << DIR_E | 1 << DIR_S | 1 << DIR_SW | 1 << DIR_W,
|
|
|
};
|
|
|
|
|
|
/** Which of the PPPs are inside the tile. For the two PPPs on the tile border
|
|
|
/**
|
|
|
* Which of the PPPs are inside the tile. For the two PPPs on the tile border
|
|
|
* 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 byte OwnedPPPonPCP[DIAGDIR_END] = {
|
|
|
1 << DIR_SE | 1 << DIR_S | 1 << DIR_SW | 1 << DIR_W,
|
|
|
1 << DIR_N | 1 << DIR_SW | 1 << DIR_W | 1 << DIR_NW,
|
|
|
1 << DIR_N | 1 << DIR_NE | 1 << DIR_E | 1 << DIR_NW,
|
|
@@ -61,13 +65,14 @@ static const DiagDirection PCPpositions[
|
|
|
{DIAGDIR_SE, DIAGDIR_SW}, // LOWER
|
|
|
{DIAGDIR_SW, DIAGDIR_NW}, // LEFT
|
|
|
{DIAGDIR_NE, DIAGDIR_SE}, // RIGHT
|
|
|
};
|
|
|
|
|
|
#define PCP_NOT_ON_TRACK 0xFF
|
|
|
/** Preferred points of each trackbit. Those are the ones perpendicular to the
|
|
|
/**
|
|
|
* Preferred points of each trackbit. Those are the ones perpendicular to the
|
|
|
* track, plus the point in extension of the track (to mark end-of-track). PCPs
|
|
|
* which are not on either end of the track are fully preferred.
|
|
|
* @see PCPpositions */
|
|
|
static const byte PreferredPPPofTrackAtPCP[TRACK_END][DIAGDIR_END] = {
|
|
|
{ // X
|
|
|
1 << DIR_NE | 1 << DIR_SE | 1 << DIR_NW, // NE
|
|
@@ -103,13 +108,14 @@ static const byte PreferredPPPofTrackAtP
|
|
|
};
|
|
|
#undef PCP_NOT_ON_TRACK
|
|
|
|
|
|
|
|
|
#define NUM_IGNORE_GROUPS 3
|
|
|
#define IGNORE_NONE 0xFF
|
|
|
/** In case we have a staight line, we place pylon only every two tiles,
|
|
|
/**
|
|
|
* In case we have a staight line, we place pylon only every two tiles,
|
|
|
* so there are certain tiles which we ignore. A straight line is found if
|
|
|
* we have exactly two PPPs. */
|
|
|
static const byte IgnoredPCP[NUM_IGNORE_GROUPS][TLG_END][DIAGDIR_END] = {
|
|
|
{ // Ignore group 1, X and Y tracks
|
|
|
{ // X even, Y even
|
|
|
IGNORE_NONE,
|
|
@@ -392,13 +398,14 @@ static const SortableSpriteStruct Catena
|
|
|
{ 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
|
|
|
{ WSO_ENTRANCE_NW, 7, 0, 1, 15, 1, ELRAIL_ELEVATION } //! Wire for NW tunnel exit
|
|
|
};
|
|
|
|
|
|
|
|
|
/** Refers to a certain element of the catenary.
|
|
|
/**
|
|
|
* Refers to a certain element of the catenary.
|
|
|
* Identifiers for Wires:
|
|
|
* <ol><li>Direction of the wire</li>
|
|
|
* <li>Slope of the tile for diagonals, placement inside the track for horiz/vertical pieces</li>
|
|
|
* <li>Place where a pylon shoule be</li></ol>
|
|
|
* Identifiers for Pylons:
|
|
|
* <ol><li>Direction of the wire</li>
|