Permalink
Browse files

Make sure variables are either static or declared externally

  • Loading branch information...
janisozaur committed Oct 9, 2017
1 parent b05bdf2 commit c4538496c536d7c21fa99d683f070439771eda03
Showing with 1,338 additions and 1,352 deletions.
  1. +1 βˆ’0 CMakeLists.txt
  2. +1 βˆ’1 src/openrct2-ui/windows/Changelog.cpp
  3. +1 βˆ’1 src/openrct2-ui/windows/CustomCurrency.cpp
  4. +1 βˆ’1 src/openrct2-ui/windows/Main.cpp
  5. +1 βˆ’1 src/openrct2-ui/windows/MusicCredits.cpp
  6. +2 βˆ’2 src/openrct2-ui/windows/NewCampaign.cpp
  7. +1 βˆ’1 src/openrct2-ui/windows/Options.cpp
  8. +4 βˆ’4 src/openrct2-ui/windows/Player.cpp
  9. +2 βˆ’2 src/openrct2-ui/windows/RideList.cpp
  10. +1 βˆ’1 src/openrct2-ui/windows/Sign.cpp
  11. +1 βˆ’1 src/openrct2-ui/windows/ViewClipping.cpp
  12. +11 βˆ’11 src/openrct2/Editor.cpp
  13. +1 βˆ’0 src/openrct2/OpenRCT2.h
  14. +1 βˆ’1 src/openrct2/cmdline/SpriteCommands.cpp
  15. +4 βˆ’6 src/openrct2/cmdline_sprite.c
  16. +1 βˆ’0 src/openrct2/cmdline_sprite.h
  17. +1 βˆ’1 src/openrct2/diagnostic.c
  18. +1 βˆ’1 src/openrct2/game.c
  19. +9 βˆ’9 src/openrct2/interface/Theme.cpp
  20. +3 βˆ’3 src/openrct2/interface/console.c
  21. +5 βˆ’5 src/openrct2/interface/viewport.c
  22. +1 βˆ’1 src/openrct2/interface/window.c
  23. +1 βˆ’1 src/openrct2/localisation/format_codes.c
  24. +1 βˆ’1 src/openrct2/management/Finance.cpp
  25. +2 βˆ’2 src/openrct2/management/award.c
  26. +3 βˆ’3 src/openrct2/network/Network.cpp
  27. +11 βˆ’11 src/openrct2/object_list.c
  28. +5 βˆ’4 src/openrct2/paint/map_element/fence.c
  29. +2 βˆ’0 src/openrct2/paint/map_element/map_element.h
  30. +3 βˆ’8 src/openrct2/paint/map_element/path.c
  31. +19 βˆ’19 src/openrct2/paint/map_element/surface.c
  32. +2 βˆ’2 src/openrct2/paint/sprite/misc.c
  33. +8 βˆ’8 src/openrct2/paint/supports.c
  34. +5 βˆ’11 src/openrct2/peep/peep.c
  35. +11 βˆ’11 src/openrct2/platform/posix.c
  36. +0 βˆ’2 src/openrct2/rct1/Tables.cpp
  37. +1 βˆ’1 src/openrct2/ride/gentle/CrookedHouse.cpp
  38. +3 βˆ’3 src/openrct2/ride/ride.c
  39. +1,166 βˆ’1,166 src/openrct2/ride/track_data.c
  40. +1 βˆ’1 src/openrct2/ride/track_paint.c
  41. +7 βˆ’7 src/openrct2/ride/vehicle.c
  42. +1 βˆ’1 src/openrct2/ride/vehicle_paint.c
  43. +18 βˆ’18 src/openrct2/ride/water/SplashBoats.cpp
  44. +1 βˆ’1 src/openrct2/title/TitleSequenceManager.cpp
  45. +2 βˆ’2 src/openrct2/windows/RideConstruction.cpp
  46. +2 βˆ’2 src/openrct2/world/map.c
  47. +4 βˆ’9 src/openrct2/world/mapgen.c
  48. +5 βˆ’5 src/openrct2/world/park.c
View
@@ -76,6 +76,7 @@ endfunction ()
# Launchpad turns on -Wdate-time for compilers that support it, this shouldn't break our build
ADD_CHECK_C_COMPILER_FLAG(CMAKE_C_FLAGS C_WARN_WRITE_STRINGS -Wno-error=date-time)
ADD_CHECK_C_COMPILER_FLAG(CMAKE_C_FLAGS C_WARN_MISSING_VARIABLE_DECLARATIONS -Wmissing-variable-declarations)
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS CXX_WARN_WRITE_STRINGS -Wno-error=date-time)
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS CXX_WARN_NULL_DEREFERENCE -Wnull-dereference)
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS CXX_WARN_SUGGEST_FINAL_TYPES -Wsuggest-final-types)
@@ -38,7 +38,7 @@ enum {
#define MIN_WW 300
#define MIN_WH 200
rct_widget window_changelog_widgets[] = {
static rct_widget window_changelog_widgets[] = {
{ WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, 0xFFFFFFFF, STR_NONE }, // panel / background
{ WWT_CAPTION, 0, 1, WW - 2, 1, 14, STR_CHANGELOG_TITLE, STR_WINDOW_TITLE_TIP }, // title bar
{ WWT_CLOSEBOX, 0, WW - 13, WW - 3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // close x button
@@ -34,7 +34,7 @@ enum WINDOW_CUSTOM_CURRENCY_WIDGET_IDX {
WIDX_AFFIX_DROPDOWN_BUTTON,
};
rct_widget window_custom_currency_widgets[] = {
static rct_widget window_custom_currency_widgets[] = {
{ WWT_FRAME, 0, 0, 399, 0, 99, 0xFFFFFFFF, STR_NONE },
{ WWT_CAPTION, 0, 1, 398, 1, 14, STR_CUSTOM_CURRENCY_WINDOW_TITLE, STR_WINDOW_TITLE_TIP },
{ WWT_CLOSEBOX, 0, 387, 397, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP },
@@ -21,7 +21,7 @@
#include <openrct2/interface/widget.h>
#include <openrct2/world/footpath.h>
rct_widget window_main_widgets[] = {
static rct_widget window_main_widgets[] = {
{ WWT_VIEWPORT, 0, 0x0000, -1, 0x0000, -1, 0xFFFFFFFE, 0xFFFF },
{ WIDGETS_END },
};
@@ -27,7 +27,7 @@ enum WINDOW_MUSIC_CREDITS_WIDGET_IDX {
WIDX_CLOSE
};
rct_widget window_music_credits_widgets[] = {
static rct_widget window_music_credits_widgets[] = {
{ WWT_FRAME, 0, 0, 509, 0, 313, 0xFFFFFFFF, STR_NONE }, // panel / background
{ WWT_CAPTION, 0, 1, 508, 1, 14, STR_MUSIC_ACKNOWLEDGEMENTS, STR_WINDOW_TITLE_TIP }, // title bar
{ WWT_CLOSEBOX, 0, 497, 507, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // close x button
@@ -93,8 +93,8 @@ static rct_window_event_list window_new_campaign_events = {
nullptr
};
uint8 window_new_campaign_rides[MAX_RIDES];
uint8 window_new_campaign_shop_items[64];
static uint8 window_new_campaign_rides[MAX_RIDES];
static uint8 window_new_campaign_shop_items[64];
static sint32 ride_value_compare(const void *a, const void *b)
{
@@ -353,7 +353,7 @@ static rct_widget window_options_twitch_widgets[] = {
{ WIDGETS_END },
};
rct_widget *window_options_page_widgets[] = {
static rct_widget *window_options_page_widgets[] = {
window_options_display_widgets,
window_options_rendering_widgets,
window_options_culture_widgets,
@@ -57,7 +57,7 @@ enum WINDOW_PLAYER_WIDGET_IDX {
{ WWT_TAB, 1, 3, 33, 17, 43, IMAGE_TYPE_REMAP | SPR_TAB, STR_NONE }, /* Tab 1 */ \
{ WWT_TAB, 1, 34, 64, 17, 43, IMAGE_TYPE_REMAP | SPR_TAB, STR_NONE } /* Tab 2 */
rct_widget window_player_overview_widgets[] = {
static rct_widget window_player_overview_widgets[] = {
WINDOW_PLAYER_COMMON_WIDGETS,
{ WWT_DROPDOWN, 1, 3, 177, 46, 57, 0xFFFFFFFF, STR_NONE }, // Permission group
{ WWT_DROPDOWN_BUTTON, 1, 167, 177, 47, 56, STR_DROPDOWN_GLYPH, STR_NONE }, //
@@ -67,12 +67,12 @@ rct_widget window_player_overview_widgets[] = {
{ WIDGETS_END },
};
rct_widget window_player_statistics_widgets[] = {
static rct_widget window_player_statistics_widgets[] = {
WINDOW_PLAYER_COMMON_WIDGETS,
{ WIDGETS_END },
};
rct_widget *window_player_page_widgets[] = {
static rct_widget *window_player_page_widgets[] = {
window_player_overview_widgets,
window_player_statistics_widgets
};
@@ -171,7 +171,7 @@ static void window_player_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w)
static void window_player_update_viewport(rct_window *w, bool scroll);
static void window_player_update_title(rct_window* w);
uint32 window_player_page_enabled_widgets[] = {
static uint32 window_player_page_enabled_widgets[] = {
(1 << WIDX_CLOSE) |
(1 << WIDX_TAB_1) |
(1 << WIDX_TAB_2) |
@@ -135,7 +135,7 @@ enum {
DROPDOWN_LIST_COUNT
};
rct_string_id ride_info_type_string_mapping[DROPDOWN_LIST_COUNT] = {
static const rct_string_id ride_info_type_string_mapping[DROPDOWN_LIST_COUNT] = {
STR_STATUS,
STR_POPULARITY,
STR_SATISFACTION,
@@ -159,7 +159,7 @@ static const rct_string_id ride_list_statusbar_count_strings[PAGE_COUNT] = {
STR_NUMBER_RESTROOMS_AND_INFORMATION_KIOSKS,
};
bool ride_info_type_money_mapping[DROPDOWN_LIST_COUNT] = {
static const bool ride_info_type_money_mapping[DROPDOWN_LIST_COUNT] = {
false,
false,
false,
@@ -40,7 +40,7 @@ enum WINDOW_SIGN_WIDGET_IDX {
};
// 0x9AEE00
rct_widget window_sign_widgets[] = {
static rct_widget window_sign_widgets[] = {
{ WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, 0xFFFFFFFF, STR_NONE }, // panel / background
{ WWT_CAPTION, 0, 1, WW - 2, 1, 14, STR_SIGN, STR_WINDOW_TITLE_TIP }, // title bar
{ WWT_CLOSEBOX, 0, WW - 13, WW - 3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // close x button
@@ -37,7 +37,7 @@ enum class DISPLAY_TYPE {
DISPLAY_UNITS
};
DISPLAY_TYPE gClipHeightDisplayType = DISPLAY_TYPE::DISPLAY_UNITS;
static DISPLAY_TYPE gClipHeightDisplayType = DISPLAY_TYPE::DISPLAY_UNITS;
#pragma region Widgets
View
@@ -35,17 +35,17 @@
namespace Editor
{
uint8 _editorSelectedRides[MAX_RIDE_OBJECTS];
uint8 _editorSelectedSmallScenery[MAX_SMALL_SCENERY_OBJECTS];
uint8 _editorSelectedLargeScenery[MAX_LARGE_SCENERY_OBJECTS];
uint8 _editorSelectedWalls[MAX_WALL_SCENERY_OBJECTS];
uint8 _editorSelectedBanners[MAX_BANNER_OBJECTS];
uint8 _editorSelectedFootpaths[MAX_PATH_OBJECTS];
uint8 _editorSelectedFootpathAdditions[MAX_PATH_ADDITION_OBJECTS];
uint8 _editorSelectedSceneryGroups[MAX_SCENERY_GROUP_OBJECTS];
uint8 _editorSelectedParkEntrances[MAX_PARK_ENTRANCE_OBJECTS];
uint8 _editorSelectedWaters[MAX_WATER_OBJECTS];
uint8 _editorSelectedStexs[MAX_SCENARIO_TEXT_OBJECTS];
static uint8 _editorSelectedRides[MAX_RIDE_OBJECTS];
static uint8 _editorSelectedSmallScenery[MAX_SMALL_SCENERY_OBJECTS];
static uint8 _editorSelectedLargeScenery[MAX_LARGE_SCENERY_OBJECTS];
static uint8 _editorSelectedWalls[MAX_WALL_SCENERY_OBJECTS];
static uint8 _editorSelectedBanners[MAX_BANNER_OBJECTS];
static uint8 _editorSelectedFootpaths[MAX_PATH_OBJECTS];
static uint8 _editorSelectedFootpathAdditions[MAX_PATH_ADDITION_OBJECTS];
static uint8 _editorSelectedSceneryGroups[MAX_SCENERY_GROUP_OBJECTS];
static uint8 _editorSelectedParkEntrances[MAX_PARK_ENTRANCE_OBJECTS];
static uint8 _editorSelectedWaters[MAX_WATER_OBJECTS];
static uint8 _editorSelectedStexs[MAX_SCENARIO_TEXT_OBJECTS];
uint8 * SelectedObjects[OBJECT_ENTRY_GROUP_COUNT] =
{
View
@@ -67,6 +67,7 @@ extern "C"
extern bool gOpenRCT2Headless;
extern bool gOpenRCT2NoGraphics;
extern bool gOpenRCT2ShowChangelog;
extern bool gOpenRCT2SilentBreakpad;
#ifndef DISABLE_NETWORK
extern EVP_MD_CTX * gHashCTX;
@@ -24,7 +24,7 @@
extern "C"
{
sint32 gSpriteMode = 0;
sint32 gSpriteMode = 0;
}
static const char * _mode;
@@ -29,8 +29,6 @@
#define MODE_CLOSEST 1
#define MODE_DITHERING 2
extern sint32 gSpriteMode;
#pragma pack(push, 1)
typedef struct rct_sprite_file_header {
@@ -55,12 +53,12 @@ assert_struct_size(rle_code, 2);
assert_struct_size(rct_sprite_file_palette_entry, 4);
rct_sprite_file_palette_entry spriteFilePalette[256];
static rct_sprite_file_palette_entry spriteFilePalette[256];
static rct_sprite_file_palette_entry _standardPalette[256];
rct_sprite_file_header spriteFileHeader;
rct_g1_element *spriteFileEntries;
uint8 *spriteFileData;
static rct_sprite_file_header spriteFileHeader;
static rct_g1_element *spriteFileEntries;
static uint8 *spriteFileData;
#ifdef _WIN32
@@ -25,6 +25,7 @@ extern "C"
#endif
sint32 cmdline_for_sprite(const char **argv, sint32 argc);
extern sint32 gSpriteMode;
#ifdef __cplusplus
}
@@ -26,7 +26,7 @@
static bool _log_location_enabled = true;
bool _log_levels[DIAGNOSTIC_LEVEL_COUNT] = { true, true, true, false, true };
const char * _level_strings[] = {
static const char * _level_strings[] = {
"FATAL",
"ERROR",
"WARNING",
View
@@ -80,7 +80,7 @@ uint32 gCurrentTicks;
#endif
GAME_COMMAND_CALLBACK_POINTER* game_command_callback = 0;
GAME_COMMAND_CALLBACK_POINTER* game_command_callback_table[] = {
static GAME_COMMAND_CALLBACK_POINTER* const game_command_callback_table[] = {
0,
0,
game_command_callback_ride_construct_placed_front,
@@ -110,7 +110,7 @@ struct WindowThemeDesc
#define THEME_WC(wc) wc, #wc
WindowThemeDesc WindowThemeDescriptors[] =
static const WindowThemeDesc WindowThemeDescriptors[] =
{
// WindowClass, WindowClassSZ WindowName NumColours, DefaultTheme
{ THEME_WC(WC_TOP_TOOLBAR), STR_THEMES_WINDOW_TOP_TOOLBAR, COLOURS_4(COLOUR_LIGHT_BLUE, COLOUR_DARK_GREEN, COLOUR_DARK_BROWN, COLOUR_GREY ) },
@@ -180,7 +180,7 @@ WindowThemeDesc WindowThemeDescriptors[] =
#define COLOURS_RCT1(c0, c1, c2, c3, c4, c5) { { (c0), (c1), (c2), (c3), (c4), (c5) } }
UIThemeWindowEntry PredefinedThemeRCT1_Entries[] =
static const UIThemeWindowEntry PredefinedThemeRCT1_Entries[] =
{
{ WC_TOP_TOOLBAR, COLOURS_RCT1(COLOUR_GREY, COLOUR_GREY, COLOUR_GREY, COLOUR_GREY, COLOUR_BLACK, COLOUR_BLACK) },
{ WC_BOTTOM_TOOLBAR, COLOURS_RCT1(TRANSLUCENT(COLOUR_GREY), TRANSLUCENT(COLOUR_GREY), COLOUR_BLACK, COLOUR_YELLOW, COLOUR_BLACK, COLOUR_BLACK) },
@@ -203,7 +203,7 @@ UIThemeWindowEntry PredefinedThemeRCT1_Entries[] =
THEME_DEF_END
};
UIThemeWindowEntry PredefinedThemeRCT2_Entries[] =
static const UIThemeWindowEntry PredefinedThemeRCT2_Entries[] =
{
THEME_DEF_END
};
@@ -217,7 +217,7 @@ const UITheme PredefinedThemeRCT1 = UITheme::CreatePredefined(
const UITheme PredefinedThemeRCT2 = UITheme::CreatePredefined(
"RCT2", PredefinedThemeRCT2_Entries, 0);
const UITheme * PredefinedThemes[] = {
static const UITheme * PredefinedThemes[] = {
&PredefinedThemeRCT1,
&PredefinedThemeRCT2,
nullptr
@@ -515,11 +515,11 @@ namespace ThemeManager
utf8 Name[96];
};
utf8 * CurrentThemePath;
UITheme * CurrentTheme;
std::vector<AvailableTheme> AvailableThemes;
size_t ActiveAvailableThemeIndex = SIZE_MAX;
size_t NumPredefinedThemes = 0;
static utf8 * CurrentThemePath;
static UITheme * CurrentTheme;
static std::vector<AvailableTheme> AvailableThemes;
static size_t ActiveAvailableThemeIndex = SIZE_MAX;
static size_t NumPredefinedThemes = 0;
void GetThemeFileName(utf8 * buffer, size_t bufferSize, const utf8 * name);
bool EnsureThemeDirectoryExists();
@@ -1291,7 +1291,7 @@ typedef struct console_command {
utf8 *usage;
} console_command;
utf8* console_variable_table[] = {
static const utf8* console_variable_table[] = {
"park_rating",
"money",
"scenario_initial_cash",
@@ -1328,7 +1328,7 @@ utf8* console_variable_table[] = {
"cheat_disable_clearance_checks",
"cheat_disable_support_limits",
};
utf8* console_window_table[] = {
static const utf8* console_window_table[] = {
"object_selection",
"inventions_list",
"scenario_options",
@@ -1337,7 +1337,7 @@ utf8* console_window_table[] = {
"title_sequences"
};
console_command console_command_table[] = {
static const console_command console_command_table[] = {
{ "clear", cc_clear, "Clears the console.", "clear"},
{ "hide", cc_hide, "Hides the console.", "hide"},
{ "echo", cc_echo, "Echoes the text to the console.", "echo <text>" },
@@ -44,7 +44,7 @@ uint8 gShowConstuctionRightsRefCount;
rct_viewport g_viewport_list[MAX_VIEWPORT_COUNT];
rct_viewport *g_music_tracking_viewport;
rct_map_element *_interaction_element = NULL;
static rct_map_element *_interaction_element = NULL;
sint16 gSavedViewX;
sint16 gSavedViewY;
@@ -57,7 +57,7 @@ uint8 gCurrentRotation;
uint32 gCurrentViewportFlags = 0;
#endif
uint32 gCurrentImageType;
static uint32 _currentImageType;
static rct_drawpixelinfo _viewportDpi1;
static rct_drawpixelinfo _viewportDpi2;
@@ -1230,7 +1230,7 @@ static bool sub_679074(rct_drawpixelinfo *dpi, sint32 imageId, sint16 x, sint16
}
uint8 *offset = image->offset + (yStartPoint * image->width) + xStartPoint;
uint32 imageType = gCurrentImageType;
uint32 imageType = _currentImageType;
if (!(image->flags & G1_FLAG_1)) {
return pixel_is_present_bmp(imageType, image, offset, palette);
@@ -1289,15 +1289,15 @@ static bool sub_679023(rct_drawpixelinfo *dpi, sint32 imageId, sint32 x, sint32
uint8 *palette = NULL;
imageId &= 0xBFFFFFFF;
if (imageId & IMAGE_TYPE_REMAP) {
gCurrentImageType = IMAGE_TYPE_REMAP;
_currentImageType = IMAGE_TYPE_REMAP;
sint32 index = (imageId >> 19) & 0x7F;
if (imageId & IMAGE_TYPE_REMAP_2_PLUS) {
index &= 0x1F;
}
sint32 g1Index = palette_to_g1_offset[index];
palette = g1Elements[g1Index].offset;
} else {
gCurrentImageType = 0;
_currentImageType = 0;
}
return sub_679074(dpi, imageId, x, y, palette);
}
@@ -62,7 +62,7 @@ colour_t gCurrentWindowColours[4];
// converted from uint16 values at 0x009A41EC - 0x009A4230
// these are percentage coordinates of the viewport to centre to, if a window is obscuring a location, the next is tried
float window_scroll_locations[][2] = {
static const float window_scroll_locations[][2] = {
{0.5f, 0.5f},
{0.75f, 0.5f},
{0.25f, 0.5f},
@@ -25,7 +25,7 @@ typedef struct format_code_token {
const char *token;
} format_code_token;
format_code_token format_code_tokens[] = {
static const format_code_token format_code_tokens[] = {
{ FORMAT_MOVE_X, "MOVE_X" },
{ FORMAT_ADJUST_PALETTE, "ADJUST_PALETTE" },
{ FORMAT_NEWLINE, "NEWLINE" },
@@ -48,7 +48,7 @@ const money32 research_cost_table[RESEARCH_FUNDING_COUNT] =
MONEY(400, 00) // Maximum funding
};
sint32 dword_988E60[RCT_EXPENDITURE_TYPE_COUNT] = {1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0};
static const sint32 dword_988E60[RCT_EXPENDITURE_TYPE_COUNT] = {1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0};
money32 gInitialCash;
money32 gCashEncrypted;
Oops, something went wrong.

0 comments on commit c453849

Please sign in to comment.