(svn r14439) -Fix (r12044)(r14139): centering on a plane at the SE border could cause crash
authorsmatz
Sat, 04 Oct 2008 10:25:12 +0000
changeset 10216 b9a9b8881675
parent 10215 8d60eb40d7c5
child 10217 067947c58b30
(svn r14439) -Fix (r12044)(r14139): centering on a plane at the SE border could cause crash
src/viewport.cpp
--- a/src/viewport.cpp	Fri Oct 03 17:46:13 2008 +0000
+++ b/src/viewport.cpp	Sat Oct 04 10:25:12 2008 +0000
@@ -2065,7 +2065,7 @@
 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)