diff options
author | peter1138 <peter1138@openttd.org> | 2006-05-06 22:08:14 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-05-06 22:08:14 +0000 |
commit | 6e2b98b060f2aaeb2b0852f04296dc89823ef0bb (patch) | |
tree | 632c341e983c1ff365c6cc9ac2b80ef650c7a24a /newgrf_station.c | |
parent | 10992deeb3be7b555246222d0f9242145c5ea3b2 (diff) | |
download | openttd-6e2b98b060f2aaeb2b0852f04296dc89823ef0bb.tar.xz |
(svn r4758) - Newstations: add support for 'blocked' station tiles, which no train can pass.
Diffstat (limited to 'newgrf_station.c')
-rw-r--r-- | newgrf_station.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/newgrf_station.c b/newgrf_station.c index 18a138602..ef4d59ae4 100644 --- a/newgrf_station.c +++ b/newgrf_station.c @@ -640,3 +640,22 @@ bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID return true; } +/* Check if a rail station tile is traversable. + * XXX This could be cached (during build) in the map array to save on all the dereferencing */ +bool IsStationTileBlocked(TileIndex tile) +{ + const Station *st; + const StationSpec *statspec; + uint specindex; + + if (!IsCustomStationSpecIndex(tile)) return false; + + 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->blocked, GetStationGfx(tile)); +} |