From 700a82e2001921a30f6964540a740e13be89d503 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Wed, 6 Sep 2017 20:53:30 +0200 Subject: [PATCH] Make more data and functions static --- src/openrct2/game.c | 3 +-- src/openrct2/interface/window.h | 3 +-- src/openrct2/windows/EditorObjectSelection.cpp | 4 ++-- src/openrct2/windows/Guest.cpp | 2 +- src/openrct2/windows/GuestList.cpp | 15 +++------------ src/openrct2/windows/ObjectLoadError.cpp | 8 ++++---- src/openrct2/windows/Ride.cpp | 2 +- src/openrct2/windows/Staff.cpp | 2 +- src/openrct2/windows/TextInput.cpp | 10 +++++----- src/openrct2/windows/TitleCommandEditor.cpp | 2 +- 10 files changed, 20 insertions(+), 31 deletions(-) diff --git a/src/openrct2/game.c b/src/openrct2/game.c index 2d92e754a5..8b4ebffc33 100644 --- a/src/openrct2/game.c +++ b/src/openrct2/game.c @@ -1439,8 +1439,7 @@ void game_init_all(sint32 mapSize) gInMapInitCode = false; window_new_ride_init_vars(); - window_guest_list_init_vars_a(); - window_guest_list_init_vars_b(); + window_guest_list_init_vars(); scenery_set_default_placement_configuration(); window_tile_inspector_clear_clipboard(); load_palette(); diff --git a/src/openrct2/interface/window.h b/src/openrct2/interface/window.h index 45d4022259..4168310323 100644 --- a/src/openrct2/interface/window.h +++ b/src/openrct2/interface/window.h @@ -761,8 +761,7 @@ rct_window * window_editor_main_open(); void window_editor_bottom_toolbar_open(); void window_editor_object_selection_open(); -void window_guest_list_init_vars_a(); -void window_guest_list_init_vars_b(); +void window_guest_list_init_vars(); void window_bubble_list_item(rct_window* w, sint32 item_position); void window_align_tabs( rct_window *w, rct_widgetindex start_tab_id, rct_widgetindex end_tab_id ); diff --git a/src/openrct2/windows/EditorObjectSelection.cpp b/src/openrct2/windows/EditorObjectSelection.cpp index 4cc53e3ca0..4c7cab413c 100644 --- a/src/openrct2/windows/EditorObjectSelection.cpp +++ b/src/openrct2/windows/EditorObjectSelection.cpp @@ -242,7 +242,7 @@ static bool filter_source(const ObjectRepositoryItem * item); static bool filter_chunks(const ObjectRepositoryItem * item); static void filter_update_counts(); -void reset_selected_object_count_and_size(); +static void reset_selected_object_count_and_size(); static sint32 sub_6AB211(); @@ -1495,7 +1495,7 @@ static void window_editor_object_selection_select_required_objects() * * rct2: 0x006AA770 */ -void reset_selected_object_count_and_size() +static void reset_selected_object_count_and_size() { for (uint8 objectType = 0; objectType < 11; objectType++) { _numSelectedObjectsForType[objectType] = 0; diff --git a/src/openrct2/windows/Guest.cpp b/src/openrct2/windows/Guest.cpp index da8feb06b4..54bdfb3e07 100644 --- a/src/openrct2/windows/Guest.cpp +++ b/src/openrct2/windows/Guest.cpp @@ -413,7 +413,7 @@ static rct_window_event_list *window_guest_page_events[] = { void window_guest_set_colours(); // 0x981D3C -uint32 window_guest_page_enabled_widgets[] = { +static const uint32 window_guest_page_enabled_widgets[] = { (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | diff --git a/src/openrct2/windows/GuestList.cpp b/src/openrct2/windows/GuestList.cpp index dd6acaaba6..164620e3d0 100644 --- a/src/openrct2/windows/GuestList.cpp +++ b/src/openrct2/windows/GuestList.cpp @@ -154,23 +154,14 @@ static void window_guest_list_find_groups(); static void get_arguments_from_peep(rct_peep *peep, uint32 *argument_1, uint32* argument_2); -/** -* -* rct2: 0x0068F083 -*/ -void window_guest_list_init_vars_a() +void window_guest_list_init_vars() { + // rct2: 0x0068F083 gNextGuestNumber = 1; _window_guest_list_last_find_groups_tick = 0xFFFFFFFF; _window_guest_list_selected_filter = 0xFF; -} -/** -* -* rct2: 0x0068F050 -*/ -void window_guest_list_init_vars_b() -{ + // rct2: 0x0068F050 _window_guest_list_selected_tab = 0; _window_guest_list_selected_view = 0; _window_guest_list_last_find_groups_tick = 0xFFFFFFFF; diff --git a/src/openrct2/windows/ObjectLoadError.cpp b/src/openrct2/windows/ObjectLoadError.cpp index 49dc6eb8fb..001d815f0d 100644 --- a/src/openrct2/windows/ObjectLoadError.cpp +++ b/src/openrct2/windows/ObjectLoadError.cpp @@ -41,7 +41,7 @@ enum WINDOW_OBJECT_LOAD_ERROR_WIDGET_IDX { #define TYPE_COL_LEFT (5 * WW_LESS_PADDING / 8 + 1) #define LIST_ITEM_HEIGHT 10 -rct_widget window_object_load_error_widgets[] = { +static rct_widget window_object_load_error_widgets[] = { { WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, STR_NONE, STR_NONE }, // Background { WWT_CAPTION, 0, 1, WW - 2, 1, 14, STR_OBJECT_LOAD_ERROR_TITLE, STR_WINDOW_TITLE_TIP }, // Title bar { WWT_CLOSEBOX, 0, WW - 13, WW - 3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // Close button @@ -95,9 +95,9 @@ static rct_window_event_list window_object_load_error_events = { window_object_load_error_scrollpaint }; -rct_object_entry * invalid_entries = nullptr; -sint32 highlighted_index = -1; -utf8* file_path = nullptr; +static rct_object_entry * invalid_entries = nullptr; +static sint32 highlighted_index = -1; +static utf8* file_path = nullptr; /** * Returns an rct_string_id that represents an rct_object_entry's type. diff --git a/src/openrct2/windows/Ride.cpp b/src/openrct2/windows/Ride.cpp index 2b37e389f6..a1b8f9d889 100644 --- a/src/openrct2/windows/Ride.cpp +++ b/src/openrct2/windows/Ride.cpp @@ -964,7 +964,7 @@ typedef struct ride_overall_view_t { uint8 zoom; } ride_overall_view; -ride_overall_view ride_overall_views[MAX_RIDES] = {0}; +static ride_overall_view ride_overall_views[MAX_RIDES] = {0}; const sint32 window_ride_tab_animation_divisor[] = { 0, 0, 2, 2, 4, 2, 8, 8, 2, 0 }; const sint32 window_ride_tab_animation_frames[] = { 0, 0, 4, 16, 8, 16, 8, 8, 8, 0 }; diff --git a/src/openrct2/windows/Staff.cpp b/src/openrct2/windows/Staff.cpp index 0f35b5dd6e..a82395b74c 100644 --- a/src/openrct2/windows/Staff.cpp +++ b/src/openrct2/windows/Staff.cpp @@ -259,7 +259,7 @@ static rct_window_event_list *window_staff_page_events[] = { &window_staff_stats_events }; -uint32 window_staff_page_enabled_widgets[] = { +static const uint32 window_staff_page_enabled_widgets[] = { (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | diff --git a/src/openrct2/windows/TextInput.cpp b/src/openrct2/windows/TextInput.cpp index 09c3f46d35..1eb126d956 100644 --- a/src/openrct2/windows/TextInput.cpp +++ b/src/openrct2/windows/TextInput.cpp @@ -89,11 +89,11 @@ static rct_window_event_list window_text_input_events = { nullptr }; -rct_string_id input_text_description; -char text_input[TEXT_INPUT_SIZE] = { 0 }; -rct_windowclass calling_class = 0; -rct_windownumber calling_number = 0; -sint32 calling_widget = 0; +static rct_string_id input_text_description; +static char text_input[TEXT_INPUT_SIZE] = { 0 }; +static rct_windowclass calling_class = 0; +static rct_windownumber calling_number = 0; +static sint32 calling_widget = 0; static sint32 _maxInputLength; void window_text_input_open(rct_window* call_w, rct_widgetindex call_widget, rct_string_id title, rct_string_id description, rct_string_id existing_text, uintptr_t existing_args, sint32 maxLength) diff --git a/src/openrct2/windows/TitleCommandEditor.cpp b/src/openrct2/windows/TitleCommandEditor.cpp index 35f59d3e3c..245c36e1e4 100644 --- a/src/openrct2/windows/TitleCommandEditor.cpp +++ b/src/openrct2/windows/TitleCommandEditor.cpp @@ -34,7 +34,7 @@ typedef struct TITLE_COMMAND_ORDER { rct_string_id descStringId; } TITLE_COMMAND_ORDER; -TITLE_COMMAND_ORDER window_title_command_editor_orders[] = { +static TITLE_COMMAND_ORDER window_title_command_editor_orders[] = { { TITLE_SCRIPT_LOAD, STR_TITLE_EDITOR_ACTION_LOAD, STR_TITLE_EDITOR_ARGUMENT_SAVEFILE }, { TITLE_SCRIPT_LOCATION, STR_TITLE_EDITOR_COMMAND_TYPE_LOCATION, STR_TITLE_EDITOR_ARGUMENT_COORDINATES }, { TITLE_SCRIPT_ROTATE, STR_TITLE_EDITOR_COMMAND_TYPE_ROTATE, STR_TITLE_EDITOR_ARGUMENT_ROTATIONS },