summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-02-19 17:45:30 +0000
committersmatz <smatz@openttd.org>2008-02-19 17:45:30 +0000
commit6e9b9526234627afb33d0bfd937b448426d8ec16 (patch)
tree6d517c99e431876d678a099b38937d74b5c110c2 /src
parentadf1227290bb10997a8a274b22f8a1cc310d7757 (diff)
downloadopenttd-6e9b9526234627afb33d0bfd937b448426d8ec16.tar.xz
(svn r12186) -Fix [FS#1784](r12169): assert when trying to play tile sound at NW border of map (placing buyos, leveling land)
Diffstat (limited to 'src')
-rw-r--r--src/sound.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/sound.cpp b/src/sound.cpp
index 960794bbd..9fed4a689 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -241,7 +241,8 @@ void SndPlayTileFx(SoundFx sound, TileIndex tile)
/* emits sound from center of the tile */
int x = TileX(tile) * TILE_SIZE + TILE_SIZE / 2;
int y = TileY(tile) * TILE_SIZE - TILE_SIZE / 2;
- Point pt = RemapCoords(x, y, GetSlopeZ(x, y));
+ uint z = (y < 0 ? 0 : GetSlopeZ(x, y));
+ Point pt = RemapCoords(x, y, z);
y += 2 * TILE_SIZE;
Point pt2 = RemapCoords(x, y, GetSlopeZ(x, y));
SndPlayScreenCoordFx(sound, pt.x, pt2.x, pt.y, pt2.y);