From b7164c5eac96afde7dd46a406d64f1d3d4b9f2c0 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Tue, 12 Sep 2017 21:21:39 +0200 Subject: [PATCH] Rename intent extra keys --- src/openrct2-ui/WindowManager.cpp | 6 +++--- src/openrct2-ui/input/keyboard_shortcut.c | 4 ++-- src/openrct2-ui/windows/LoadSave.cpp | 2 +- src/openrct2-ui/windows/MapGen.cpp | 4 ++-- src/openrct2-ui/windows/SavePrompt.cpp | 6 +++--- src/openrct2-ui/windows/ServerStart.cpp | 4 ++-- src/openrct2-ui/windows/TitleEditor.cpp | 4 ++-- src/openrct2/Editor.cpp | 4 ++-- src/openrct2/game.c | 10 ++++----- src/openrct2/management/news_item.c | 4 ++-- src/openrct2/ride/track_design_save.c | 6 +++--- src/openrct2/windows/EditorBottomToolbar.cpp | 4 ++-- .../windows/EditorObjectSelection.cpp | 2 +- src/openrct2/windows/Intent.h | 21 +++++++------------ src/openrct2/windows/Ride.cpp | 12 +++++------ src/openrct2/windows/Staff.cpp | 2 +- src/openrct2/windows/TopToolbar.cpp | 6 +++--- src/openrct2/windows/TrackList.cpp | 4 ++-- 18 files changed, 49 insertions(+), 56 deletions(-) diff --git a/src/openrct2-ui/WindowManager.cpp b/src/openrct2-ui/WindowManager.cpp index f5b24d03ae..1b75ae7134 100644 --- a/src/openrct2-ui/WindowManager.cpp +++ b/src/openrct2-ui/WindowManager.cpp @@ -156,11 +156,11 @@ public: { switch(intent->GetWindowClass()) { case WC_FIRE_PROMPT: - return window_staff_fire_prompt_open((rct_peep*)intent->GetPointerExtra(INTENT_EXTRA_3)); + return window_staff_fire_prompt_open((rct_peep*)intent->GetPointerExtra(INTENT_EXTRA_PEEP)); case WC_INSTALL_TRACK: - return window_install_track_open(intent->GetStringExtra(INTENT_EXTRA_2)); + return window_install_track_open(intent->GetStringExtra(INTENT_EXTRA_PATH)); case WC_GUEST_LIST: - return window_guest_list_open_with_filter(intent->GetSIntExtra(INTENT_EXTRA_0), intent->GetSIntExtra(INTENT_EXTRA_1)); + return window_guest_list_open_with_filter(intent->GetSIntExtra(INTENT_EXTRA_GUEST_LIST_FILTER), intent->GetSIntExtra(INTENT_EXTRA_RIDE_ID)); default: return nullptr; diff --git a/src/openrct2-ui/input/keyboard_shortcut.c b/src/openrct2-ui/input/keyboard_shortcut.c index 192bd815f1..31d807410e 100644 --- a/src/openrct2-ui/input/keyboard_shortcut.c +++ b/src/openrct2-ui/input/keyboard_shortcut.c @@ -531,8 +531,8 @@ static void shortcut_quick_save_game() } else if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) { Intent * intent = intent_create(WC_LOADSAVE); - intent_set_uint(intent, INTENT_EXTRA_4, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); - intent_set_string(intent, INTENT_EXTRA_5, gS6Info.name); + intent_set_uint(intent, INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); + intent_set_string(intent, INTENT_EXTRA_PATH, gS6Info.name); context_open_intent(intent); intent_release(intent); } diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index 4a0aa127d7..61020c794f 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -835,7 +835,7 @@ static void window_loadsave_select(rct_window *w, const char *path) { save_path(&gConfigGeneral.last_save_track_directory, pathBuffer); auto intent = Intent(WC_INSTALL_TRACK); - intent.putExtra(INTENT_EXTRA_2, pathBuffer); + intent.putExtra(INTENT_EXTRA_PATH, pathBuffer); context_open_intent(&intent); window_close_by_class(WC_LOADSAVE); window_loadsave_invoke_callback(MODAL_RESULT_OK, pathBuffer); diff --git a/src/openrct2-ui/windows/MapGen.cpp b/src/openrct2-ui/windows/MapGen.cpp index 694161036a..4678212436 100644 --- a/src/openrct2-ui/windows/MapGen.cpp +++ b/src/openrct2-ui/windows/MapGen.cpp @@ -1191,8 +1191,8 @@ static void window_mapgen_heightmap_mouseup(rct_window *w, rct_widgetindex widge case WIDX_HEIGHTMAP_SELECT: { auto intent = Intent(WC_LOADSAVE); - intent.putExtra(INTENT_EXTRA_4, LOADSAVETYPE_LOAD | LOADSAVETYPE_IMAGE); - intent.putExtra(INTENT_EXTRA_6, (void *) window_mapgen_heightmap_loadsave_callback); + intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_IMAGE); + intent.putExtra(INTENT_EXTRA_CALLBACK, (void *) window_mapgen_heightmap_loadsave_callback); context_open_intent(&intent); return; } diff --git a/src/openrct2-ui/windows/SavePrompt.cpp b/src/openrct2-ui/windows/SavePrompt.cpp index 5c0b6d49d9..ad131aa680 100644 --- a/src/openrct2-ui/windows/SavePrompt.cpp +++ b/src/openrct2-ui/windows/SavePrompt.cpp @@ -239,15 +239,15 @@ static void window_save_prompt_mouseup(rct_window *w, rct_widgetindex widgetInde if (gScreenFlags & (SCREEN_FLAGS_EDITOR)) { intent = intent_create(WC_LOADSAVE); - intent_set_uint(intent, INTENT_EXTRA_4, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); - intent_set_string(intent, INTENT_EXTRA_5, gS6Info.name); + intent_set_uint(intent, INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); + intent_set_string(intent, INTENT_EXTRA_PATH, gS6Info.name); } else { intent = (Intent *) create_save_game_as_intent(); } window_close(w); - intent_set_pointer(intent, INTENT_EXTRA_6, (void *) window_save_prompt_callback); + intent_set_pointer(intent, INTENT_EXTRA_CALLBACK, (void *) window_save_prompt_callback); context_open_intent(intent); intent_release(intent); break; diff --git a/src/openrct2-ui/windows/ServerStart.cpp b/src/openrct2-ui/windows/ServerStart.cpp index e0f3f9d10c..5ef120a823 100644 --- a/src/openrct2-ui/windows/ServerStart.cpp +++ b/src/openrct2-ui/windows/ServerStart.cpp @@ -225,8 +225,8 @@ static void window_server_start_mouseup(rct_window *w, rct_widgetindex widgetInd case WIDX_LOAD_SERVER: network_set_password(_password); auto intent = Intent(WC_LOADSAVE); - intent.putExtra(INTENT_EXTRA_4, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); - intent.putExtra(INTENT_EXTRA_6, (void *) window_server_start_loadsave_callback); + intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); + intent.putExtra(INTENT_EXTRA_CALLBACK, (void *) window_server_start_loadsave_callback); context_open_intent(&intent); break; } diff --git a/src/openrct2-ui/windows/TitleEditor.cpp b/src/openrct2-ui/windows/TitleEditor.cpp index 41420a774c..4aaab38547 100644 --- a/src/openrct2-ui/windows/TitleEditor.cpp +++ b/src/openrct2-ui/windows/TitleEditor.cpp @@ -331,8 +331,8 @@ static void window_title_editor_mouseup(rct_window *w, rct_widgetindex widgetInd case WIDX_TITLE_EDITOR_ADD_SAVE: if (!_isSequenceReadOnly && !_isSequencePlaying && !commandEditorOpen) { auto intent = Intent(WC_LOADSAVE); - intent.putExtra(INTENT_EXTRA_4, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); - intent.putExtra(INTENT_EXTRA_6, (void *) window_title_editor_add_park_callback); + intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); + intent.putExtra(INTENT_EXTRA_CALLBACK, (void *) window_title_editor_add_park_callback); context_open_intent(&intent); } break; diff --git a/src/openrct2/Editor.cpp b/src/openrct2/Editor.cpp index e92828cb20..b3c059d2ec 100644 --- a/src/openrct2/Editor.cpp +++ b/src/openrct2/Editor.cpp @@ -101,8 +101,8 @@ namespace Editor { tool_cancel(); auto intent = Intent(WC_LOADSAVE); - intent.putExtra(INTENT_EXTRA_4, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); - intent.putExtra(INTENT_EXTRA_5, (void *) ConvertSaveToScenarioCallback); + intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); + intent.putExtra(INTENT_EXTRA_CALLBACK, (void *) ConvertSaveToScenarioCallback); context_open_intent(&intent); } diff --git a/src/openrct2/game.c b/src/openrct2/game.c index adb4b36503..736b1f1624 100644 --- a/src/openrct2/game.c +++ b/src/openrct2/game.c @@ -919,7 +919,7 @@ static void game_load_or_quit(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *edx static void load_landscape() { Intent * intent = intent_create(WC_LOADSAVE); - intent_set_uint(intent, INTENT_EXTRA_4, LOADSAVETYPE_LOAD | LOADSAVETYPE_LANDSCAPE); + intent_set_uint(intent, INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_LANDSCAPE); context_open_intent(intent); intent_release(intent); } @@ -1227,8 +1227,8 @@ void * create_save_game_as_intent() path_remove_extension(name); Intent * intent = intent_create(WC_LOADSAVE); - intent_set_uint(intent, INTENT_EXTRA_4, LOADSAVETYPE_SAVE | LOADSAVETYPE_GAME); - intent_set_string(intent, INTENT_EXTRA_5, name); + intent_set_uint(intent, INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_GAME); + intent_set_string(intent, INTENT_EXTRA_PATH, name); return intent; } @@ -1413,8 +1413,8 @@ void game_load_or_quit_no_save_prompt() load_landscape(); } else { Intent * intent = intent_create(WC_LOADSAVE); - intent_set_uint(intent, INTENT_EXTRA_4, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); - intent_set_pointer(intent, INTENT_EXTRA_6, game_load_or_quit_no_save_prompt_callback); + intent_set_uint(intent, INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); + intent_set_pointer(intent, INTENT_EXTRA_CALLBACK, game_load_or_quit_no_save_prompt_callback); context_open_intent(intent); intent_release(intent); } diff --git a/src/openrct2/management/news_item.c b/src/openrct2/management/news_item.c index cf705507d9..7ba571c237 100644 --- a/src/openrct2/management/news_item.c +++ b/src/openrct2/management/news_item.c @@ -371,8 +371,8 @@ void news_item_open_subject(sint32 type, sint32 subject) case NEWS_ITEM_PEEPS: { Intent *intent = intent_create(WC_GUEST_LIST); - intent_set_sint(intent, INTENT_EXTRA_0, GLFT_GUESTS_THINKING_X); - intent_set_sint(intent, INTENT_EXTRA_1, subject); + intent_set_sint(intent, INTENT_EXTRA_GUEST_LIST_FILTER, GLFT_GUESTS_THINKING_X); + intent_set_sint(intent, INTENT_EXTRA_RIDE_ID, subject); context_open_intent(intent); intent_release(intent); break; diff --git a/src/openrct2/ride/track_design_save.c b/src/openrct2/ride/track_design_save.c index 4a7988dcac..40ed3768d0 100644 --- a/src/openrct2/ride/track_design_save.c +++ b/src/openrct2/ride/track_design_save.c @@ -181,9 +181,9 @@ bool track_design_save(uint8 rideIndex) format_string(track_name, sizeof(track_name), ride->name, &ride->name_arguments); Intent * intent = intent_create(WC_LOADSAVE); - intent_set_uint(intent, INTENT_EXTRA_4, LOADSAVETYPE_SAVE | LOADSAVETYPE_TRACK); - intent_set_string(intent, INTENT_EXTRA_6, track_name); - intent_set_pointer(intent, INTENT_EXTRA_6, track_design_save_callback); + intent_set_uint(intent, INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_TRACK); + intent_set_string(intent, INTENT_EXTRA_CALLBACK, track_name); + intent_set_pointer(intent, INTENT_EXTRA_CALLBACK, track_design_save_callback); context_open_intent(intent); intent_release(intent); diff --git a/src/openrct2/windows/EditorBottomToolbar.cpp b/src/openrct2/windows/EditorBottomToolbar.cpp index 8f67e1d67a..afbfc7a062 100644 --- a/src/openrct2/windows/EditorBottomToolbar.cpp +++ b/src/openrct2/windows/EditorBottomToolbar.cpp @@ -291,8 +291,8 @@ void window_editor_bottom_toolbar_jump_forward_to_save_scenario() window_close_all(); auto intent = Intent(WC_LOADSAVE); - intent.putExtra(INTENT_EXTRA_4, LOADSAVETYPE_SAVE | LOADSAVETYPE_SCENARIO); - intent.putExtra(INTENT_EXTRA_5, gS6Info.name); + intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_SCENARIO); + intent.putExtra(INTENT_EXTRA_PATH, gS6Info.name); context_open_intent(&intent); } diff --git a/src/openrct2/windows/EditorObjectSelection.cpp b/src/openrct2/windows/EditorObjectSelection.cpp index 447d5ae9b1..5cee9ce57b 100644 --- a/src/openrct2/windows/EditorObjectSelection.cpp +++ b/src/openrct2/windows/EditorObjectSelection.cpp @@ -812,7 +812,7 @@ static void window_editor_object_selection_mouseup(rct_window *w, rct_widgetinde window_invalidate(w); auto intent = Intent(WC_LOADSAVE); - intent.putExtra(INTENT_EXTRA_4, LOADSAVETYPE_LOAD | LOADSAVETYPE_TRACK); + intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_TRACK); context_open_intent(&intent); break; } diff --git a/src/openrct2/windows/Intent.h b/src/openrct2/windows/Intent.h index f4700e3086..ba94a34bd0 100644 --- a/src/openrct2/windows/Intent.h +++ b/src/openrct2/windows/Intent.h @@ -46,20 +46,13 @@ extern "C" { enum { - INTENT_EXTRA_0, // WC_GUEST_LIST - INTENT_EXTRA_1, - - INTENT_EXTRA_2, // WC_INSTALL_TRACK - - INTENT_EXTRA_3, // WC_FIRE_PROMPT - - INTENT_EXTRA_4, // WC_LOADSAVE - INTENT_EXTRA_5, - INTENT_EXTRA_6, - - INTENT_EXTRA_7, // WC_SCENARIO_SELECT - - INTENT_EXTRA_8, // WC_TRACK_DESIGN_PLACE, WC_MANAGE_TRACK_DESIGN + INTENT_EXTRA_GUEST_LIST_FILTER, + INTENT_EXTRA_RIDE_ID, + INTENT_EXTRA_PATH, + INTENT_EXTRA_PEEP, + INTENT_EXTRA_LOADSAVE_TYPE, + INTENT_EXTRA_CALLBACK, + INTENT_EXTRA_TRACK_DESIGN, }; Intent *intent_create(rct_windowclass clss); diff --git a/src/openrct2/windows/Ride.cpp b/src/openrct2/windows/Ride.cpp index 2e40920cb8..38f2002b20 100644 --- a/src/openrct2/windows/Ride.cpp +++ b/src/openrct2/windows/Ride.cpp @@ -6242,24 +6242,24 @@ static void window_ride_customer_mouseup(rct_window *w, rct_widgetindex widgetIn case WIDX_SHOW_GUESTS_THOUGHTS: { auto intent = Intent(WC_GUEST_LIST); - intent.putExtra(INTENT_EXTRA_0, GLFT_GUESTS_THINKING_ABOUT_RIDE); - intent.putExtra(INTENT_EXTRA_1, w->number); + intent.putExtra(INTENT_EXTRA_GUEST_LIST_FILTER, GLFT_GUESTS_THINKING_ABOUT_RIDE); + intent.putExtra(INTENT_EXTRA_RIDE_ID, w->number); context_open_intent(&intent); break; } case WIDX_SHOW_GUESTS_ON_RIDE: { auto intent = Intent(WC_GUEST_LIST); - intent.putExtra(INTENT_EXTRA_0, GLFT_GUESTS_ON_RIDE); - intent.putExtra(INTENT_EXTRA_1, w->number); + intent.putExtra(INTENT_EXTRA_GUEST_LIST_FILTER, GLFT_GUESTS_ON_RIDE); + intent.putExtra(INTENT_EXTRA_RIDE_ID, w->number); context_open_intent(&intent); break; } case WIDX_SHOW_GUESTS_QUEUING: { auto intent = Intent(WC_GUEST_LIST); - intent.putExtra(INTENT_EXTRA_0, GLFT_GUESTS_IN_QUEUE); - intent.putExtra(INTENT_EXTRA_1, w->number); + intent.putExtra(INTENT_EXTRA_GUEST_LIST_FILTER, GLFT_GUESTS_IN_QUEUE); + intent.putExtra(INTENT_EXTRA_RIDE_ID, w->number); context_open_intent(&intent); break; } diff --git a/src/openrct2/windows/Staff.cpp b/src/openrct2/windows/Staff.cpp index ca4a6fdd33..05c9d2b6f3 100644 --- a/src/openrct2/windows/Staff.cpp +++ b/src/openrct2/windows/Staff.cpp @@ -472,7 +472,7 @@ void window_staff_overview_mouseup(rct_window *w, rct_widgetindex widgetIndex) case WIDX_FIRE: { auto intent = Intent(WC_FIRE_PROMPT); - intent.putExtra(INTENT_EXTRA_3, peep); + intent.putExtra(INTENT_EXTRA_PEEP, peep); context_open_intent(&intent); break; } diff --git a/src/openrct2/windows/TopToolbar.cpp b/src/openrct2/windows/TopToolbar.cpp index d52738e7d8..a17269fbf9 100644 --- a/src/openrct2/windows/TopToolbar.cpp +++ b/src/openrct2/windows/TopToolbar.cpp @@ -545,7 +545,7 @@ static void window_top_toolbar_dropdown(rct_window *w, rct_widgetindex widgetInd case DDIDX_NEW_GAME: { auto intent = Intent(WC_SCENARIO_SELECT); - intent.putExtra(INTENT_EXTRA_7, (void *) window_top_toolbar_scenarioselect_callback); + intent.putExtra(INTENT_EXTRA_CALLBACK, (void *) window_top_toolbar_scenarioselect_callback); context_open_intent(&intent); break; } @@ -559,8 +559,8 @@ static void window_top_toolbar_dropdown(rct_window *w, rct_widgetindex widgetInd case DDIDX_SAVE_GAME_AS: if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) { auto intent = Intent(WC_LOADSAVE); - intent.putExtra(INTENT_EXTRA_4, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); - intent.putExtra(INTENT_EXTRA_5, gS6Info.name); + intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); + intent.putExtra(INTENT_EXTRA_PATH, gS6Info.name); context_open_intent(&intent); } else { diff --git a/src/openrct2/windows/TrackList.cpp b/src/openrct2/windows/TrackList.cpp index 12c297b845..236d2e6f2b 100644 --- a/src/openrct2/windows/TrackList.cpp +++ b/src/openrct2/windows/TrackList.cpp @@ -217,7 +217,7 @@ static void window_track_list_select(rct_window *w, sint32 index) track_design_file_ref *tdRef = &_trackDesigns[index]; if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) { auto intent = Intent(WC_MANAGE_TRACK_DESIGN); - intent.putExtra(INTENT_EXTRA_8, tdRef); + intent.putExtra(INTENT_EXTRA_TRACK_DESIGN, tdRef); context_open_intent(&intent); } else { if (_loadedTrackDesignIndex != TRACK_DESIGN_INDEX_UNLOADED && (_loadedTrackDesign->track_flags & TRACK_DESIGN_FLAG_VEHICLE_UNAVAILABLE)) { @@ -225,7 +225,7 @@ static void window_track_list_select(rct_window *w, sint32 index) } auto intent = Intent(WC_TRACK_DESIGN_PLACE); - intent.putExtra(INTENT_EXTRA_8, tdRef); + intent.putExtra(INTENT_EXTRA_TRACK_DESIGN, tdRef); context_open_intent(&intent); } }