Fix asserts due to main window not existing yet
Partial revert of https://github.com/OpenTTD/OpenTTD/pull/10327
This commit is contained in:
@@ -36,11 +36,13 @@ ZoomLevel _saved_scrollpos_zoom;
|
||||
|
||||
void SaveViewportBeforeSaveGame()
|
||||
{
|
||||
const Window *w = GetMainWindow();
|
||||
const Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
|
||||
|
||||
_saved_scrollpos_x = w->viewport->scrollpos_x;
|
||||
_saved_scrollpos_y = w->viewport->scrollpos_y;
|
||||
_saved_scrollpos_zoom = w->viewport->zoom;
|
||||
if (w != nullptr) {
|
||||
_saved_scrollpos_x = w->viewport->scrollpos_x;
|
||||
_saved_scrollpos_y = w->viewport->scrollpos_y;
|
||||
_saved_scrollpos_zoom = w->viewport->zoom;
|
||||
}
|
||||
}
|
||||
|
||||
void ResetViewportAfterLoadGame()
|
||||
|
Reference in New Issue
Block a user