summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2011-11-24 12:38:48 +0000
committerpeter1138 <peter1138@openttd.org>2011-11-24 12:38:48 +0000
commit81598273e9b6bb2ee20ebdd82f3d4646a02999ba (patch)
tree2d13cc93dc84f2d99cff6fc2bb02214d4453f033 /src/saveload
parent15d0a22aac6b90a2055e68d019cab4350376a8fd (diff)
downloadopenttd-81598273e9b6bb2ee20ebdd82f3d4646a02999ba.tar.xz
(svn r23316) -Feature: Add ability to zoom in to 2x and 4x level.
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp7
-rw-r--r--src/saveload/misc_sl.cpp9
2 files changed, 13 insertions, 3 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 5b86f4d0b..d231f6912 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -2688,6 +2688,13 @@ bool AfterLoadGame()
}
}
+ if (IsSavegameVersionBefore(165)) {
+ /* Adjust zoom level to account for new levels */
+ _saved_scrollpos_zoom = _saved_scrollpos_zoom + ZOOM_LVL_SHIFT;
+ _saved_scrollpos_x *= ZOOM_LVL_BASE;
+ _saved_scrollpos_y *= ZOOM_LVL_BASE;
+ }
+
/* When any NewGRF has been changed the availability of some vehicles might
* have been changed too. e->company_avail must be set to 0 in that case
* which is done by StartupEngines(). */
diff --git a/src/saveload/misc_sl.cpp b/src/saveload/misc_sl.cpp
index 9ca806701..877fa1269 100644
--- a/src/saveload/misc_sl.cpp
+++ b/src/saveload/misc_sl.cpp
@@ -56,9 +56,12 @@ void ResetViewportAfterLoadGame()
vp->virtual_width = ScaleByZoom(vp->width, vp->zoom);
vp->virtual_height = ScaleByZoom(vp->height, vp->zoom);
- /* Ensure zoom level is allowed */
- while (vp->zoom < _settings_client.gui.zoom_min) DoZoomInOutWindow(ZOOM_OUT, w);
- while (vp->zoom > _settings_client.gui.zoom_max) DoZoomInOutWindow(ZOOM_IN, w);
+ /* If zoom_max is ZOOM_LVL_MIN then the setting has not been loaded yet, therefore all levels are allowed. */
+ if (_settings_client.gui.zoom_max != ZOOM_LVL_MIN) {
+ /* Ensure zoom level is allowed */
+ while (vp->zoom < _settings_client.gui.zoom_min) DoZoomInOutWindow(ZOOM_OUT, w);
+ while (vp->zoom > _settings_client.gui.zoom_max) DoZoomInOutWindow(ZOOM_IN, w);
+ }
DoZoomInOutWindow(ZOOM_NONE, w); // update button status
MarkWholeScreenDirty();