summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-08-31 11:18:30 +0000
committertron <tron@openttd.org>2006-08-31 11:18:30 +0000
commit925b633afab7bc3d7ba974d5342709657f5168e3 (patch)
treea56ad356994e9ba00f5ed6e8d6eeaa92eaeb30d7
parentd16308810efd2ba5b7e09b24cb3d0c68c258ac49 (diff)
downloadopenttd-925b633afab7bc3d7ba974d5342709657f5168e3.tar.xz
(svn r6265) Check whether to draw catenary at all once before the drawing loop instead of on every iteration
-rw-r--r--elrail.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/elrail.c b/elrail.c
index e06fbd260..e3b99b6d2 100644
--- a/elrail.c
+++ b/elrail.c
@@ -280,6 +280,14 @@ static void DrawCatenaryRailway(const TileInfo *ti)
}
}
+ /* Don't draw a wire under a low bridge */
+ if (IsBridgeTile(ti->tile) &&
+ IsBridgeMiddle(ti->tile) &&
+ !(_display_opt & DO_TRANS_BUILDINGS) &&
+ GetBridgeHeight(ti->tile) <= TilePixelHeight(ti->tile) + TILE_HEIGHT) {
+ return;
+ }
+
/* Drawing of pylons is finished, now draw the wires */
for (t = 0; t < TRACK_END; t++) {
if (HASBIT(trackconfig[TS_HOME], t)) {
@@ -290,13 +298,6 @@ static void DrawCatenaryRailway(const TileInfo *ti)
const SortableSpriteStruct *sss;
int tileh_selector = !(tileh[TS_HOME] % 3) * tileh[TS_HOME] / 3; /* tileh for the slopes, 0 otherwise */
- if ( /* We are not drawing a wire under a low bridge */
- IsBridgeTile(ti->tile) &&
- IsBridgeMiddle(ti->tile) &&
- !(_display_opt & DO_TRANS_BUILDINGS) &&
- GetBridgeHeight(ti->tile) <= TilePixelHeight(ti->tile) + TILE_HEIGHT
- ) return;
-
assert(PCPconfig != 0); /* We have a pylon on neither end of the wire, that doesn't work (since we have no sprites for that) */
assert(!IsSteepSlope(tileh[TS_HOME]));
sss = &CatenarySpriteData[Wires[tileh_selector][t][PCPconfig]];