summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-11-22 22:34:30 +0000
committerrubidium <rubidium@openttd.org>2007-11-22 22:34:30 +0000
commit64a4ac34445b8dabb7649c06a9285737185593a5 (patch)
tree426c517040795607dc872d3a63dc13338f3bf761 /src
parent3ad488e98f12529ebbca3f43ba5eedae4f46d049 (diff)
downloadopenttd-64a4ac34445b8dabb7649c06a9285737185593a5.tar.xz
(svn r11493) -Fix [FS#1472]: game crashing on savegame load because it tried to render some part of the window before the savegame conversion was done.
Diffstat (limited to 'src')
-rw-r--r--src/openttd.cpp58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 27f83900b..54580cf12 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -1331,22 +1331,6 @@ bool AfterLoadGame()
return false;
}
- /* Initialize windows */
- ResetWindowSystem();
- SetupColorsAndInitialWindow();
-
- w = FindWindowById(WC_MAIN_WINDOW, 0);
-
- WP(w,vp_d).scrollpos_x = _saved_scrollpos_x;
- WP(w,vp_d).scrollpos_y = _saved_scrollpos_y;
- WP(w,vp_d).dest_scrollpos_x = _saved_scrollpos_x;
- WP(w,vp_d).dest_scrollpos_y = _saved_scrollpos_y;
-
- vp = w->viewport;
- vp->zoom = (ZoomLevel)min(_saved_scrollpos_zoom, ZOOM_LVL_MAX);
- vp->virtual_width = ScaleByZoom(vp->width, vp->zoom);
- vp->virtual_height = ScaleByZoom(vp->height, vp->zoom);
-
/* in version 4.1 of the savegame, is_active was introduced to determine
* if a player does exist, rather then checking name_1 */
if (CheckSavegameVersionOldStyle(4, 1)) CheckIsPlayerActive();
@@ -2170,19 +2154,6 @@ bool AfterLoadGame()
}
}
- /* Recalculate */
- Group *g;
- FOR_ALL_GROUPS(g) {
- const Vehicle *v;
- FOR_ALL_VEHICLES(v) {
- if (!IsEngineCountable(v)) continue;
-
- if (v->group_id != g->index || v->type != g->vehicle_type || v->owner != g->owner) continue;
-
- g->num_engines[v->engine_type]++;
- }
- }
-
if (CheckSavegameVersion(74)) {
Station *st;
FOR_ALL_STATIONS(st) {
@@ -2220,6 +2191,35 @@ bool AfterLoadGame()
}
}
+ /* Initialize windows */
+ ResetWindowSystem();
+ SetupColorsAndInitialWindow();
+
+ w = FindWindowById(WC_MAIN_WINDOW, 0);
+
+ WP(w,vp_d).scrollpos_x = _saved_scrollpos_x;
+ WP(w,vp_d).scrollpos_y = _saved_scrollpos_y;
+ WP(w,vp_d).dest_scrollpos_x = _saved_scrollpos_x;
+ WP(w,vp_d).dest_scrollpos_y = _saved_scrollpos_y;
+
+ vp = w->viewport;
+ vp->zoom = (ZoomLevel)min(_saved_scrollpos_zoom, ZOOM_LVL_MAX);
+ vp->virtual_width = ScaleByZoom(vp->width, vp->zoom);
+ vp->virtual_height = ScaleByZoom(vp->height, vp->zoom);
+
+ /* Recalculate */
+ Group *g;
+ FOR_ALL_GROUPS(g) {
+ const Vehicle *v;
+ FOR_ALL_VEHICLES(v) {
+ if (!IsEngineCountable(v)) continue;
+
+ if (v->group_id != g->index || v->type != g->vehicle_type || v->owner != g->owner) continue;
+
+ g->num_engines[v->engine_type]++;
+ }
+ }
+
return true;
}