summaryrefslogtreecommitdiff
path: root/newgrf_station.c
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2006-05-08 21:59:36 +0000
committerglx <glx@openttd.org>2006-05-08 21:59:36 +0000
commitcd3c14133640fde8d6d12ab59f869baa6d6f5724 (patch)
tree87873445dadc459a7e9897c13eba0899ad07422a /newgrf_station.c
parent8fa9ff068fcfc030ffaf6ecc62d97ffbe66abe5a (diff)
downloadopenttd-cd3c14133640fde8d6d12ab59f869baa6d6f5724.tar.xz
(svn r4785) - Newstations: don't draw catenary on non-track tiles
Diffstat (limited to 'newgrf_station.c')
-rw-r--r--newgrf_station.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/newgrf_station.c b/newgrf_station.c
index aa5b32a53..d35ffc51f 100644
--- a/newgrf_station.c
+++ b/newgrf_station.c
@@ -702,3 +702,23 @@ bool IsStationTileBlocked(TileIndex tile)
return HASBIT(statspec->blocked, GetStationGfx(tile));
}
+
+/* Check if a rail station tile is electrifiable.
+ * XXX This could be cached (during build) in the map array to save on all the dereferencing */
+bool IsStationTileElectrifiable(TileIndex tile)
+{
+ const Station *st;
+ const StationSpec *statspec;
+ uint specindex;
+
+ if (!IsCustomStationSpecIndex(tile)) return true;
+
+ st = GetStationByTile(tile);
+ specindex = GetCustomStationSpecIndex(tile);
+ if (specindex >= st->num_specs) return false;
+
+ statspec = st->speclist[specindex].spec;
+ if (statspec == NULL) return false;
+
+ return HASBIT(statspec->pylons, GetStationGfx(tile));
+}