summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-08-31 07:29:19 +0000
committertron <tron@openttd.org>2006-08-31 07:29:19 +0000
commit22d2ca7cc617fa97800acbde2687961f67310567 (patch)
tree3b30402a3836b103079ffdb154692b0e8ca62a41
parentb427ce4e20f5d9a1c2b51de6eae6e1cf64cee21d (diff)
downloadopenttd-22d2ca7cc617fa97800acbde2687961f67310567.tar.xz
(svn r6255) Simplify drawing of catenary in depots
-rw-r--r--elrail.c10
-rw-r--r--table/elrail_data.h18
2 files changed, 14 insertions, 14 deletions
diff --git a/elrail.c b/elrail.c
index f2f1c5d0a..e06fbd260 100644
--- a/elrail.c
+++ b/elrail.c
@@ -362,9 +362,13 @@ void DrawCatenary(const TileInfo *ti)
switch (GetTileType(ti->tile)) {
case MP_RAILWAY:
if (IsRailDepot(ti->tile)) {
- const SortableSpriteStruct *sss = &CatenarySpriteData[WIRE_DEPOT_SW + ReverseDiagDir(GetRailDepotDirection(ti->tile))];
- AddSortableSpriteToDraw( sss->image, ti->x + sss->x_offset, ti->y + sss->y_offset,
- sss->x_size, sss->y_size, sss->z_size, GetSlopeZ(ti->x, ti->y) + sss->z_offset);
+ const SortableSpriteStruct* sss = &CatenarySpriteData_Depot[GetRailDepotDirection(ti->tile)];
+
+ AddSortableSpriteToDraw(
+ sss->image, ti->x + sss->x_offset, ti->y + sss->y_offset,
+ sss->x_size, sss->y_size, sss->z_size,
+ GetTileMaxZ(ti->tile) + sss->z_offset
+ );
return;
}
break;
diff --git a/table/elrail_data.h b/table/elrail_data.h
index cd0fb383b..a14f08c74 100644
--- a/table/elrail_data.h
+++ b/table/elrail_data.h
@@ -330,13 +330,14 @@ static const SortableSpriteStruct CatenarySpriteData[] = {
{ SPR_WIRE_EW_W, 16, 8, 8, 8, 1, ELRAIL_ELEVATION }, //!29: LOWER trackbit wire, pylon on both ends
{ SPR_WIRE_EW_E, 8, 0, 8, 8, 1, ELRAIL_ELEVATION }, //!32: UPPER trackbit wire, pylon on both ends
- { SPR_WIRE_EW_E, 16, 8, 8, 8, 1, ELRAIL_ELEVATION }, //!33: LOWER trackbit wire, pylon on both ends
+ { SPR_WIRE_EW_E, 16, 8, 8, 8, 1, ELRAIL_ELEVATION } //!33: LOWER trackbit wire, pylon on both ends
+};
-/* Depots */
- { SPR_WIRE_DEPOT_SW, 0, 8, 8, 1, 1, ELRAIL_ELEVATION }, //!36: Wire for SW depot exit
- { SPR_WIRE_DEPOT_NW, 8, 0, 1, 8, 1, ELRAIL_ELEVATION }, //!37: Wire for NW depot exit
- { SPR_WIRE_DEPOT_NE, 0, 8, 8, 1, 1, ELRAIL_ELEVATION }, //!38: Wire for NE depot exit
- { SPR_WIRE_DEPOT_SE, 8, 0, 1, 8, 1, ELRAIL_ELEVATION }, //!39: Wire for SE depot exit
+static const SortableSpriteStruct CatenarySpriteData_Depot[] = {
+ { SPR_WIRE_DEPOT_NE, 0, 8, 8, 1, 1, ELRAIL_ELEVATION }, //! Wire for NE depot exit
+ { SPR_WIRE_DEPOT_SE, 8, 0, 1, 8, 1, ELRAIL_ELEVATION }, //! Wire for SE depot exit
+ { SPR_WIRE_DEPOT_SW, 0, 8, 8, 1, 1, ELRAIL_ELEVATION }, //! Wire for SW depot exit
+ { SPR_WIRE_DEPOT_NW, 8, 0, 1, 8, 1, ELRAIL_ELEVATION } //! Wire for NW depot exit
};
/** Refers to a certain element of the catenary.
@@ -393,11 +394,6 @@ typedef enum {
WIRE_EW_N_E,
WIRE_EW_S_E,
- WIRE_DEPOT_SW,
- WIRE_DEPOT_NW,
- WIRE_DEPOT_NE,
- WIRE_DEPOT_SE,
-
INVALID_CATENARY = 0xFF
} CatenarySprite;