summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-01-05 14:26:15 +0000
committeryexo <yexo@openttd.org>2010-01-05 14:26:15 +0000
commit9143b65785eb7d7a498df530660d1b47c327b869 (patch)
treeb548c91aa6264d044118bffa957ffae174960532
parentfa2361738041c28878650a41bb52d8a4482237e4 (diff)
downloadopenttd-9143b65785eb7d7a498df530660d1b47c327b869.tar.xz
(svn r18730) -Fix [FS#3414]: new viewports didn't center on the correct position
-rw-r--r--src/viewport_gui.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/viewport_gui.cpp b/src/viewport_gui.cpp
index e910f00bc..794c8341a 100644
--- a/src/viewport_gui.cpp
+++ b/src/viewport_gui.cpp
@@ -74,14 +74,14 @@ public:
const Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
/* center on same place as main window (zoom is maximum, no adjustment needed) */
- pt.x = w->viewport->scrollpos_x + w->viewport->virtual_height / 2;
+ pt.x = w->viewport->scrollpos_x + w->viewport->virtual_width / 2;
pt.y = w->viewport->scrollpos_y + w->viewport->virtual_height / 2;
} else {
pt = RemapCoords(TileX(tile) * TILE_SIZE + TILE_SIZE / 2, TileY(tile) * TILE_SIZE + TILE_SIZE / 2, TileHeight(tile));
}
- this->viewport->scrollpos_x = pt.x - (nvp->pos_x - ((nvp->current_x - 1) / 2));
- this->viewport->scrollpos_y = pt.y - (nvp->pos_y - ((nvp->current_y - 1) / 2));
+ this->viewport->scrollpos_x = pt.x - this->viewport->virtual_width / 2;
+ this->viewport->scrollpos_y = pt.y - this->viewport->virtual_height / 2;
this->viewport->dest_scrollpos_x = this->viewport->scrollpos_x;
this->viewport->dest_scrollpos_y = this->viewport->scrollpos_y;
}