summaryrefslogtreecommitdiff
path: root/src/water_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-02-19 14:51:46 +0000
committerfrosch <frosch@openttd.org>2011-02-19 14:51:46 +0000
commit9e59436c611d52ebe6dfb37daea31d8e770a0503 (patch)
treef55e047a1a463e1a291f2e63ef231f72d68c918d /src/water_cmd.cpp
parent1dd6d037bacf3bbdf26a53e50fb4f441b2e99a05 (diff)
downloadopenttd-9e59436c611d52ebe6dfb37daea31d8e770a0503.tar.xz
(svn r22108) -Codechange: Replace some magic with some other magic though less easy to break.
Diffstat (limited to 'src/water_cmd.cpp')
-rw-r--r--src/water_cmd.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index 335846e6f..4f8b25eac 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -641,7 +641,8 @@ static void DrawWaterTileStruct(const TileInfo *ti, const WaterDrawTileStruct *w
/** Draw a lock tile. */
static void DrawWaterLock(const TileInfo *ti)
{
- const WaterDrawTileStruct *wdts = _lock_display_seq[GetSection(ti->tile)];
+ int section = GetSection(ti->tile);
+ const WaterDrawTileStruct *wdts = _lock_display_seq[section];
/* Draw ground sprite. */
SpriteID image = wdts++->image;
@@ -669,7 +670,8 @@ static void DrawWaterLock(const TileInfo *ti)
if (base == 0) {
/* If no custom graphics, use defaults. */
base = SPR_LOCK_BASE;
- zoffs = ti->z > wdts[3].delta_y ? 24 : 0;
+ uint8 z_threshold = section >= 8 ? 8 : 0;
+ zoffs = ti->z > z_threshold ? 24 : 0;
}
DrawWaterTileStruct(ti, wdts, base, zoffs, PAL_NONE, CF_LOCKS);