summaryrefslogtreecommitdiff
path: root/src/elrail.cpp
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-11-10 01:17:15 +0000
committerbelugas <belugas@openttd.org>2007-11-10 01:17:15 +0000
commitf55fdfb7c42b2e2e39b165fd17f7671e14516303 (patch)
tree07b6a8f97a15f768d33fc0b7a3405373f3745b3b /src/elrail.cpp
parent3a84801f5563ca73c47c56f9682582abe990abb7 (diff)
downloadopenttd-f55fdfb7c42b2e2e39b165fd17f7671e14516303.tar.xz
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
-Codechange: Wrap all transparency settings in accessors, hiding the implementation -Change: Clicking "transparent building" menu will toggle Houses And Trees only. The other options can be used in the transparency gui. Initial patch by Smatz (FS#1349), with some rework by BigBB and your humble servant.
Diffstat (limited to 'src/elrail.cpp')
-rw-r--r--src/elrail.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/elrail.cpp b/src/elrail.cpp
index 8a0e7854c..47f854ddf 100644
--- a/src/elrail.cpp
+++ b/src/elrail.cpp
@@ -65,6 +65,7 @@
#include "vehicle.h"
#include "train.h"
#include "gui.h"
+#include "transparency.h"
static inline TLG GetTLG(TileIndex t)
{
@@ -195,7 +196,7 @@ void DrawCatenaryOnTunnel(const TileInfo *ti)
sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
BB_data[2] - sss->x_offset, BB_data[3] - sss->y_offset, BB_Z_SEPARATOR - sss->z_offset + 1,
GetTileZ(ti->tile) + sss->z_offset,
- HASBIT(_transparent_opt, TO_BUILDINGS),
+ IsTransparencySet(TO_BUILDINGS),
BB_data[0] - sss->x_offset, BB_data[1] - sss->y_offset, BB_Z_SEPARATOR - sss->z_offset
);
}
@@ -342,7 +343,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
AddSortableSpriteToDraw(pylon_sprites[temp], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE,
GetPCPElevation(ti->tile, i),
- HASBIT(_transparent_opt, TO_BUILDINGS), -1, -1);
+ IsTransparencySet(TO_BUILDINGS), -1, -1);
break; /* We already have drawn a pylon, bail out */
}
}
@@ -350,7 +351,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
}
/* Don't draw a wire under a low bridge */
- if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !HASBIT(_transparent_opt, TO_BUILDINGS)) {
+ if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !IsTransparencySet(TO_BUILDINGS)) {
uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile));
if (height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) return;
@@ -377,7 +378,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
*/
AddSortableSpriteToDraw(sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
sss->x_size, sss->y_size, sss->z_size, GetSlopeZ(ti->x + sss->x_offset, ti->y + sss->y_offset) + sss->z_offset,
- HASBIT(_transparent_opt, TO_BUILDINGS));
+ IsTransparencySet(TO_BUILDINGS));
}
}
}
@@ -410,7 +411,7 @@ static void DrawCatenaryOnBridge(const TileInfo *ti)
AddSortableSpriteToDraw(sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
sss->x_size, sss->y_size, sss->z_size, height + sss->z_offset,
- HASBIT(_transparent_opt, TO_BUILDINGS)
+ IsTransparencySet(TO_BUILDINGS)
);
/* Finished with wires, draw pylons */
@@ -421,7 +422,7 @@ static void DrawCatenaryOnBridge(const TileInfo *ti)
if (HASBIT(tlg, (axis == AXIS_X ? 0 : 1))) PPPpos = ReverseDir(PPPpos);
uint x = ti->x + x_pcp_offsets[PCPpos] + x_ppp_offsets[PPPpos];
uint y = ti->y + y_pcp_offsets[PCPpos] + y_ppp_offsets[PPPpos];
- AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, HASBIT(_transparent_opt, TO_BUILDINGS), -1, -1);
+ AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_BUILDINGS), -1, -1);
}
/* need a pylon on the southern end of the bridge */
@@ -431,7 +432,7 @@ static void DrawCatenaryOnBridge(const TileInfo *ti)
if (HASBIT(tlg, (axis == AXIS_X ? 0 : 1))) PPPpos = ReverseDir(PPPpos);
uint x = ti->x + x_pcp_offsets[PCPpos] + x_ppp_offsets[PPPpos];
uint y = ti->y + y_pcp_offsets[PCPpos] + y_ppp_offsets[PPPpos];
- AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, HASBIT(_transparent_opt, TO_BUILDINGS), -1, -1);
+ AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_BUILDINGS), -1, -1);
}
}
@@ -457,7 +458,7 @@ void DrawCatenary(const TileInfo *ti)
sss->image, PAL_NONE, 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,
- HASBIT(_transparent_opt, TO_BUILDINGS)
+ IsTransparencySet(TO_BUILDINGS)
);
return;
}