Mercurial > hg > openttd
changeset 8604:9713029d68ba draft
(svn r12186) -Fix [FS#1784](r12169): assert when trying to play tile sound at NW border of map (placing buyos, leveling land)
author | smatz <smatz@openttd.org> |
---|---|
date | Tue, 19 Feb 2008 17:45:30 +0000 |
parents | 850d58930662 |
children | effdced88525 |
files | src/sound.cpp |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/sound.cpp +++ b/src/sound.cpp @@ -241,7 +241,8 @@ /* 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);