summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-10-04 10:25:12 +0000
committersmatz <smatz@openttd.org>2008-10-04 10:25:12 +0000
commitd26e500ef443e7f47ca6defb4bb3c1e0bae487df (patch)
tree63be5f6313a4702132ff9aeb77192b49f18c1cd3
parentefa9f8f7e715dd7699271712dc46cdb30f5c5632 (diff)
downloadopenttd-d26e500ef443e7f47ca6defb4bb3c1e0bae487df.tar.xz
(svn r14439) -Fix (r12044)(r14139): centering on a plane at the SE border could cause crash
-rw-r--r--src/viewport.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp
index 9448a51dd..c1e9e4d7b 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -2065,7 +2065,7 @@ void PlaceObject()
bool ScrollWindowTo(int x , int y, Window *w, bool instant)
{
/* The slope cannot be acquired outside of the map, so make sure we are always within the map. */
- Point pt = MapXYZToViewport(w->viewport, x, y, GetSlopeZ(Clamp(x, 0, MapSizeX() * TILE_SIZE), Clamp(y, 0, MapSizeY() * TILE_SIZE)));
+ Point pt = MapXYZToViewport(w->viewport, x, y, GetSlopeZ(Clamp(x, 0, MapSizeX() * TILE_SIZE - 1), Clamp(y, 0, MapSizeY() * TILE_SIZE - 1)));
w->viewport->follow_vehicle = INVALID_VEHICLE;
if (w->viewport->dest_scrollpos_x == pt.x && w->viewport->dest_scrollpos_y == pt.y)