From a0fc01d54e02060ab006bf5475725f66c1acb0ab Mon Sep 17 00:00:00 2001 From: Ted John Date: Mon, 23 Jan 2017 12:55:59 +0000 Subject: [PATCH] Clean up game init a bit more --- src/openrct2/editor.c | 14 +++----------- src/openrct2/game.c | 1 + src/openrct2/interface/window.h | 2 +- src/openrct2/windows/editor_main.c | 8 ++++---- 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/openrct2/editor.c b/src/openrct2/editor.c index c1b05f15a4..963726eaef 100644 --- a/src/openrct2/editor.c +++ b/src/openrct2/editor.c @@ -82,8 +82,6 @@ static void editor_clear_map_for_editing(bool fromSave); */ void editor_load() { - rct_window *mainWindow; - audio_stop_all_music_and_sounds(); object_manager_unload_all_objects(); object_list_load(); @@ -93,12 +91,10 @@ void editor_load() gParkFlags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES; gS6Info.category = SCENARIO_CATEGORY_OTHER; viewport_init_all(); - window_editor_main_open(); - mainWindow = window_get_main(); + rct_window *mainWindow = window_editor_main_open(); window_set_location(mainWindow, 2400, 2400, 112); load_palette(); gfx_invalidate_screen(); - window_tile_inspector_clear_clipboard(); gScreenAge = 0; safe_strcpy(gScenarioName, language_get_string(STR_MY_NEW_SCENARIO), 64); @@ -165,12 +161,10 @@ void trackdesigner_load() set_all_land_owned(); gS6Info.editor_step = EDITOR_STEP_OBJECT_SELECTION; viewport_init_all(); - window_editor_main_open(); - rct_window * mainWindow = window_get_main(); + rct_window * mainWindow = window_editor_main_open(); window_set_location(mainWindow, 2400, 2400, 112); load_palette(); gfx_invalidate_screen(); - window_tile_inspector_clear_clipboard(); } /** @@ -189,12 +183,10 @@ void trackmanager_load() set_all_land_owned(); gS6Info.editor_step = EDITOR_STEP_OBJECT_SELECTION; viewport_init_all(); - window_editor_main_open(); - rct_window * mainWindow = window_get_main(); + rct_window *mainWindow = window_editor_main_open(); window_set_location(mainWindow, 2400, 2400, 112); load_palette(); gfx_invalidate_screen(); - window_tile_inspector_clear_clipboard(); } /** diff --git a/src/openrct2/game.c b/src/openrct2/game.c index b14777b182..1a0566266a 100644 --- a/src/openrct2/game.c +++ b/src/openrct2/game.c @@ -1184,6 +1184,7 @@ void game_init_all(sint32 mapSize) window_guest_list_init_vars_b(); window_staff_list_init_vars(); scenery_set_default_placement_configuration(); + window_tile_inspector_clear_clipboard(); } GAME_COMMAND_POINTER* new_game_command_table[GAME_COMMAND_COUNT] = { diff --git a/src/openrct2/interface/window.h b/src/openrct2/interface/window.h index 3b9dd845ff..178cd72a12 100644 --- a/src/openrct2/interface/window.h +++ b/src/openrct2/interface/window.h @@ -721,7 +721,7 @@ rct_window *window_loadsave_open(sint32 type, char *defaultName); rct_window *window_changelog_open(); void window_debug_paint_open(); -void window_editor_main_open(); +rct_window * window_editor_main_open(); void window_editor_bottom_toolbar_open(); void window_editor_object_selection_open(); void window_editor_inventions_list_open(); diff --git a/src/openrct2/windows/editor_main.c b/src/openrct2/windows/editor_main.c index 3912b55237..aea46deec3 100644 --- a/src/openrct2/windows/editor_main.c +++ b/src/openrct2/windows/editor_main.c @@ -63,13 +63,11 @@ static rct_widget window_editor_main_widgets[] = { * Creates the main editor window that holds the main viewport. * rct2: 0x0066EF38 */ -void window_editor_main_open() +rct_window * window_editor_main_open() { - rct_window* window; - window_editor_main_widgets[0].right = gScreenWidth; window_editor_main_widgets[0].bottom = gScreenHeight; - window = window_create(0, 0, window_editor_main_widgets[0].right, window_editor_main_widgets[0].bottom, + rct_window *window = window_create(0, 0, window_editor_main_widgets[0].right, window_editor_main_widgets[0].bottom, &window_editor_main_events, WC_MAIN_WINDOW, WF_STICK_TO_BACK); window->widgets = window_editor_main_widgets; @@ -84,6 +82,8 @@ void window_editor_main_open() window_top_toolbar_open(); window_editor_bottom_toolbar_open(); + + return window_get_main(); } /**