summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-05-28 09:46:37 +0000
committerfrosch <frosch@openttd.org>2011-05-28 09:46:37 +0000
commit460d24fd83e6245684c2e4c7466382c2b93a02e0 (patch)
tree412901d48c72dc5316b4c51982ff8b723ff8fad2 /src/vehicle.cpp
parent71822b6f1bdddca8f3f9bc4d4a4e633ceca1e555 (diff)
downloadopenttd-460d24fd83e6245684c2e4c7466382c2b93a02e0.tar.xz
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r--src/vehicle.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 397f60f60..0ac745b4a 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -899,8 +899,18 @@ static void DoDrawVehicle(const Vehicle *v)
if (v->vehstatus & VS_DEFPAL) pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
+ /* Check whether the vehicle shall be transparent due to the game state */
+ bool shadowed = (v->vehstatus & VS_SHADOW);
+
+ if (v->type == VEH_EFFECT) {
+ /* Check whether the vehicle shall be transparent/invisible due to GUI settings.
+ * However, transparent smoke and bubbles look weird, so always hide them. */
+ TransparencyOption to = EffectVehicle::From(v)->GetTransparencyOption();
+ if (to != TO_INVALID && (IsTransparencySet(to) || IsInvisibilitySet(to))) return;
+ }
+
AddSortableSpriteToDraw(image, pal, v->x_pos + v->x_offs, v->y_pos + v->y_offs,
- v->x_extent, v->y_extent, v->z_extent, v->z_pos, (v->vehstatus & VS_SHADOW) != 0);
+ v->x_extent, v->y_extent, v->z_extent, v->z_pos, shadowed);
}
/**