summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYexo <Yexo@openttd.org>2009-01-19 13:50:56 +0000
committerYexo <Yexo@openttd.org>2009-01-19 13:50:56 +0000
commit27507f91be82794e8f58a855f4cfa15fc6547034 (patch)
tree3b64a12f3c3cd4bd19b652356abe40e54ce46e20 /src
parentb85389dca5bc9059e34ce035edd5e00b0f3e1a40 (diff)
downloadopenttd-27507f91be82794e8f58a855f4cfa15fc6547034.tar.xz
(svn r15150) -Fix: Don't highlight tiles outside the visible map.
Diffstat (limited to 'src')
-rw-r--r--src/viewport.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp
index 57520bf54..9eeb08f2b 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -783,6 +783,8 @@ static void DrawSelectionSprite(SpriteID image, SpriteID pal, const TileInfo *ti
*/
static void DrawTileSelectionRect(const TileInfo *ti, SpriteID pal)
{
+ if (!IsValidTile(ti->tile)) return;
+
SpriteID sel;
if (IsHalftileSlope(ti->tileh)) {
Corner halftile_corner = GetHalftileSlopeCorner(ti->tileh);
@@ -971,8 +973,8 @@ static void ViewportAddLandscape()
ti.x = x_cur;
ti.y = y_cur;
- if (0 <= x_cur && x_cur < (int)MapMaxX() * TILE_SIZE &&
- 0 <= y_cur && y_cur < (int)MapMaxY() * TILE_SIZE) {
+ if (0 <= x_cur && x_cur < (int)MapSizeX() * TILE_SIZE &&
+ 0 <= y_cur && y_cur < (int)MapSizeY() * TILE_SIZE) {
TileIndex tile = TileVirtXY(x_cur, y_cur);
ti.tile = tile;
@@ -980,7 +982,7 @@ static void ViewportAddLandscape()
tt = GetTileType(tile);
} else {
ti.tileh = SLOPE_FLAT;
- ti.tile = 0;
+ ti.tile = INVALID_TILE;
ti.z = 0;
tt = MP_VOID;
}
@@ -995,7 +997,7 @@ static void ViewportAddLandscape()
_vd.last_foundation_child[1] = NULL;
_tile_type_procs[tt]->draw_tile_proc(&ti);
- DrawTileSelection(&ti);
+ if (ti.tile != INVALID_TILE) DrawTileSelection(&ti);
} while (--width_cur);
if ((direction ^= 1) != 0) {