summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2010-01-18 12:09:25 +0000
committersmatz <smatz@openttd.org>2010-01-18 12:09:25 +0000
commit84bc831e324071b252202e6bac472fe95686d462 (patch)
treebd628766ad4b85ec64f7ddf0b663ed5d82563167 /src
parent9fc910fbc2ec3c6739f0d22007d26f6d1bc27a13 (diff)
downloadopenttd-84bc831e324071b252202e6bac472fe95686d462.tar.xz
(svn r18856) -Codechange: do not call GetSlopeZInCorner() when there's no fence to draw
Diffstat (limited to 'src')
-rw-r--r--src/clear_cmd.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp
index 863aa4319..02c611923 100644
--- a/src/clear_cmd.cpp
+++ b/src/clear_cmd.cpp
@@ -64,13 +64,18 @@ void DrawHillyLandTile(const TileInfo *ti)
void DrawClearLandFence(const TileInfo *ti)
{
+ bool fence_sw = GetFenceSW(ti->tile) != 0;
+ bool fence_se = GetFenceSE(ti->tile) != 0;
+
+ if (!fence_sw && !fence_se) return;
+
int z = GetSlopeZInCorner(ti->tileh, CORNER_S);
- if (GetFenceSW(ti->tile) != 0) {
+ if (fence_sw) {
DrawGroundSpriteAt(_clear_land_fence_sprites[GetFenceSW(ti->tile) - 1] + _fence_mod_by_tileh_sw[ti->tileh], PAL_NONE, 0, 0, z);
}
- if (GetFenceSE(ti->tile) != 0) {
+ if (fence_se) {
DrawGroundSpriteAt(_clear_land_fence_sprites[GetFenceSE(ti->tile) - 1] + _fence_mod_by_tileh_se[ti->tileh], PAL_NONE, 0, 0, z);
}
}