diff --git a/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp b/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp index 8ff903d474..a7ecb40915 100644 --- a/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp +++ b/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp @@ -140,7 +140,7 @@ private: { void * pixels; sint32 pitch; - if (SDL_LockTexture(_screenTexture, NULL, &pixels, &pitch) == 0) + if (SDL_LockTexture(_screenTexture, nullptr, &pixels, &pitch) == 0) { lightfx_render_to_texture(pixels, pitch, _bits, _width, _height, _paletteHWMapped, _lightPaletteHWMapped); SDL_UnlockTexture(_screenTexture); diff --git a/src/openrct2-ui/drawing/engines/SoftwareDrawingEngine.cpp b/src/openrct2-ui/drawing/engines/SoftwareDrawingEngine.cpp index 4a5da047e0..6d5640d750 100644 --- a/src/openrct2-ui/drawing/engines/SoftwareDrawingEngine.cpp +++ b/src/openrct2-ui/drawing/engines/SoftwareDrawingEngine.cpp @@ -76,7 +76,7 @@ public: _palette == nullptr || _RGBASurface == nullptr) { - log_fatal("%p || %p || %p == NULL %s", _surface, _palette, _RGBASurface, SDL_GetError()); + log_fatal("%p || %p || %p == nullptr %s", _surface, _palette, _RGBASurface, SDL_GetError()); exit(-1); } diff --git a/src/openrct2-ui/input/KeyboardShortcuts.cpp b/src/openrct2-ui/input/KeyboardShortcuts.cpp index a1208bb7fc..467134fa38 100644 --- a/src/openrct2-ui/input/KeyboardShortcuts.cpp +++ b/src/openrct2-ui/input/KeyboardShortcuts.cpp @@ -135,26 +135,26 @@ std::string KeyboardShortcuts::GetShortcutString(sint32 shortcut) const if (shortcutKey == SHORTCUT_UNDEFINED) return std::string(); if (shortcutKey & SHIFT) { - format_string(formatBuffer, sizeof(formatBuffer), STR_SHIFT_PLUS, NULL); + format_string(formatBuffer, sizeof(formatBuffer), STR_SHIFT_PLUS, nullptr); String::Append(buffer, sizeof(buffer), formatBuffer); } if (shortcutKey & CTRL) { - format_string(formatBuffer, sizeof(formatBuffer), STR_CTRL_PLUS, NULL); + format_string(formatBuffer, sizeof(formatBuffer), STR_CTRL_PLUS, nullptr); String::Append(buffer, sizeof(buffer), formatBuffer); } if (shortcutKey & ALT) { #ifdef __MACOSX__ - format_string(formatBuffer, sizeof(formatBuffer), STR_OPTION_PLUS, NULL); + format_string(formatBuffer, sizeof(formatBuffer), STR_OPTION_PLUS, nullptr); #else - format_string(formatBuffer, sizeof(formatBuffer), STR_ALT_PLUS, NULL); + format_string(formatBuffer, sizeof(formatBuffer), STR_ALT_PLUS, nullptr); #endif String::Append(buffer, sizeof(buffer), formatBuffer); } if (shortcutKey & CMD) { - format_string(formatBuffer, sizeof(formatBuffer), STR_CMD_PLUS, NULL); + format_string(formatBuffer, sizeof(formatBuffer), STR_CMD_PLUS, nullptr); String::Append(buffer, sizeof(buffer), formatBuffer); } String::Append(buffer, sizeof(buffer), SDL_GetScancodeName((SDL_Scancode)(shortcutKey & 0xFF))); diff --git a/src/openrct2-ui/windows/About.cpp b/src/openrct2-ui/windows/About.cpp index 944407d600..caa036f32d 100644 --- a/src/openrct2-ui/windows/About.cpp +++ b/src/openrct2-ui/windows/About.cpp @@ -93,65 +93,65 @@ static void window_about_rct2_paint(rct_window *w, rct_drawpixelinfo *dpi); static void window_about_openrct2_common_paint(rct_window *w, rct_drawpixelinfo *dpi); static rct_window_event_list window_about_openrct2_events = { - NULL, + nullptr, window_about_openrct2_mouseup, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_about_openrct2_paint, - NULL + nullptr }; static rct_window_event_list window_about_rct2_events = { - NULL, + nullptr, window_about_rct2_mouseup, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_about_rct2_paint, - NULL + nullptr }; static rct_window_event_list *window_about_page_events[] = { @@ -171,7 +171,7 @@ rct_window * window_about_open() // Check if window is already open window = window_bring_to_front_by_class(WC_ABOUT); - if (window != NULL) + if (window != nullptr) return window; window = window_create_centred( @@ -241,14 +241,14 @@ static void window_about_openrct2_paint(rct_window *w, rct_drawpixelinfo *dpi) utf8 *ch = buffer; openrct2_write_full_version_info(ch, sizeof(buffer) - (ch - buffer)); - y += gfx_draw_string_centred_wrapped(dpi, NULL, x, y, width, STR_ABOUT_OPENRCT2_DESCRIPTION, w->colours[2]) + 10; + y += gfx_draw_string_centred_wrapped(dpi, nullptr, x, y, width, STR_ABOUT_OPENRCT2_DESCRIPTION, w->colours[2]) + 10; logoSize = gfx_get_sprite_size(SPR_G2_LOGO); gfx_draw_sprite(dpi, SPR_G2_LOGO, x - (logoSize.width / 2), y, 0); y += logoSize.height + 20; - y += gfx_draw_string_centred_wrapped(dpi, NULL, x, y, width, STR_ABOUT_OPENRCT2_DESCRIPTION_2, w->colours[2]) + 15; - gfx_draw_string_centred_wrapped(dpi, NULL, x, y, width, STR_ABOUT_OPENRCT2_DESCRIPTION_3, w->colours[2]); + y += gfx_draw_string_centred_wrapped(dpi, nullptr, x, y, width, STR_ABOUT_OPENRCT2_DESCRIPTION_2, w->colours[2]) + 15; + gfx_draw_string_centred_wrapped(dpi, nullptr, x, y, width, STR_ABOUT_OPENRCT2_DESCRIPTION_3, w->colours[2]); gfx_draw_string_centred_wrapped(dpi, &ch, x, w->y + WH - 25, width, STR_STRING, w->colours[2]); @@ -295,23 +295,23 @@ static void window_about_rct2_paint(rct_window *w, rct_drawpixelinfo *dpi) y = yPage + 5; // Credits - gfx_draw_string_centred(dpi, STR_COPYRIGHT_CS, x, y, COLOUR_BLACK, NULL); + gfx_draw_string_centred(dpi, STR_COPYRIGHT_CS, x, y, COLOUR_BLACK, nullptr); y += 84; - gfx_draw_string_centred(dpi, STR_DESIGNED_AND_PROGRAMMED_BY_CS, x, y, COLOUR_BLACK, NULL); + gfx_draw_string_centred(dpi, STR_DESIGNED_AND_PROGRAMMED_BY_CS, x, y, COLOUR_BLACK, nullptr); y += 10; - gfx_draw_string_centred(dpi, STR_GRAPHICS_BY_SF, x, y, COLOUR_BLACK, NULL); + gfx_draw_string_centred(dpi, STR_GRAPHICS_BY_SF, x, y, COLOUR_BLACK, nullptr); y += 10; - gfx_draw_string_centred(dpi, STR_SOUND_AND_MUSIC_BY_AB, x, y, COLOUR_BLACK, NULL); + gfx_draw_string_centred(dpi, STR_SOUND_AND_MUSIC_BY_AB, x, y, COLOUR_BLACK, nullptr); y += 10; - gfx_draw_string_centred(dpi, STR_ADDITIONAL_SOUNDS_RECORDED_BY_DE, x, y, COLOUR_BLACK, NULL); + gfx_draw_string_centred(dpi, STR_ADDITIONAL_SOUNDS_RECORDED_BY_DE, x, y, COLOUR_BLACK, nullptr); y += 13; - gfx_draw_string_centred(dpi, STR_REPRESENTATION_BY_JL, x, y, COLOUR_BLACK, NULL); + gfx_draw_string_centred(dpi, STR_REPRESENTATION_BY_JL, x, y, COLOUR_BLACK, nullptr); y += 25; - gfx_draw_string_centred(dpi, STR_THANKS_TO, x, y, COLOUR_BLACK, NULL); + gfx_draw_string_centred(dpi, STR_THANKS_TO, x, y, COLOUR_BLACK, nullptr); y += 10; - gfx_draw_string_centred(dpi, STR_THANKS_TO_PEOPLE, x, y, COLOUR_BLACK, NULL); + gfx_draw_string_centred(dpi, STR_THANKS_TO_PEOPLE, x, y, COLOUR_BLACK, nullptr); y += 25; - gfx_draw_string_centred(dpi, STR_LICENSED_TO_INFOGRAMES_INTERACTIVE_INC, x, y, COLOUR_BLACK, NULL); + gfx_draw_string_centred(dpi, STR_LICENSED_TO_INFOGRAMES_INTERACTIVE_INC, x, y, COLOUR_BLACK, nullptr); // Images gfx_draw_sprite(dpi, SPR_CREDITS_CHRIS_SAWYER_SMALL, w->x + 92, yPage + 24, 0); diff --git a/src/openrct2-ui/windows/Changelog.cpp b/src/openrct2-ui/windows/Changelog.cpp index 45ca9ed36c..752f5bd0ef 100644 --- a/src/openrct2-ui/windows/Changelog.cpp +++ b/src/openrct2-ui/windows/Changelog.cpp @@ -61,28 +61,28 @@ static rct_window_event_list window_changelog_events = { window_changelog_close, window_changelog_mouseup, window_changelog_resize, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_changelog_scrollgetsize, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_changelog_invalidate, window_changelog_paint, window_changelog_scrollpaint @@ -91,9 +91,9 @@ static rct_window_event_list window_changelog_events = { static bool window_changelog_read_file(); static void window_changelog_dispose_file(); -static char *_changelogText = NULL; +static char *_changelogText = nullptr; static size_t _changelogTextSize = 0; -static char **_changelogLines = NULL; +static char **_changelogLines = nullptr; static sint32 _changelogNumLines = 0; static sint32 _changelogLongestLineWidth = 0; @@ -102,11 +102,11 @@ rct_window * window_changelog_open() rct_window* window; window = window_bring_to_front_by_class(WC_CHANGELOG); - if (window != NULL) + if (window != nullptr) return window; if (!window_changelog_read_file()) - return NULL; + return nullptr; sint32 screenWidth = context_get_width(); sint32 screenHeight = context_get_height(); @@ -210,7 +210,7 @@ static bool window_changelog_read_file() return false; } void* new_memory = realloc(_changelogText, _changelogTextSize + 1); - if (new_memory == NULL) { + if (new_memory == nullptr) { log_error("Failed to reallocate memory for changelog text"); return false; } @@ -235,7 +235,7 @@ static bool window_changelog_read_file() if (_changelogNumLines > changelogLinesCapacity) { changelogLinesCapacity *= 2; new_memory = realloc(_changelogLines, changelogLinesCapacity * sizeof(char*)); - if (new_memory == NULL) { + if (new_memory == nullptr) { log_error("Failed to reallocate memory for change log lines"); return false; } @@ -251,7 +251,7 @@ static bool window_changelog_read_file() } new_memory = realloc(_changelogLines, _changelogNumLines * sizeof(char*)); - if (new_memory == NULL) { + if (new_memory == nullptr) { log_error("Failed to reallocate memory for change log lines"); return false; } diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp index a5450e06c2..1a4dd3e1a3 100644 --- a/src/openrct2-ui/windows/Cheats.cpp +++ b/src/openrct2-ui/windows/Cheats.cpp @@ -306,127 +306,127 @@ static void window_cheats_set_page(rct_window *w, sint32 page); static void window_cheats_text_input(rct_window *w, rct_widgetindex widgetIndex, char *text); static rct_window_event_list window_cheats_money_events = { - NULL, + nullptr, window_cheats_money_mouseup, - NULL, + nullptr, window_cheats_money_mousedown, - NULL, - NULL, + nullptr, + nullptr, window_cheats_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_cheats_text_input, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_cheats_invalidate, window_cheats_paint, - NULL + nullptr }; static rct_window_event_list window_cheats_guests_events = { - NULL, + nullptr, window_cheats_guests_mouseup, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_cheats_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_cheats_invalidate, window_cheats_paint, - NULL + nullptr }; static rct_window_event_list window_cheats_misc_events = { - NULL, + nullptr, window_cheats_misc_mouseup, - NULL, + nullptr, window_cheats_misc_mousedown, window_cheats_misc_dropdown, - NULL, + nullptr, window_cheats_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_cheats_invalidate, window_cheats_paint, - NULL + nullptr }; static rct_window_event_list window_cheats_rides_events = { - NULL, + nullptr, window_cheats_rides_mouseup, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_cheats_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_cheats_invalidate, window_cheats_paint, - NULL + nullptr }; @@ -484,7 +484,7 @@ rct_window * window_cheats_open() // Check if window is already open window = window_bring_to_front_by_class(WC_CHEATS); - if (window != NULL) + if (window != nullptr) return window; window = window_create(32, 32, WW, WH, &window_cheats_money_events, WC_CHEATS, 0); @@ -841,7 +841,7 @@ static void window_cheats_rides_mouseup(rct_window *w, rct_widgetindex widgetInd } static void window_cheats_text_input(rct_window *w, rct_widgetindex widgetIndex, char *text) { - if (text == NULL) + if (text == nullptr) return; if (w->page == WINDOW_CHEATS_PAGE_MONEY && widgetIndex == WIDX_MONEY_SPINNER) { @@ -942,19 +942,19 @@ static void window_cheats_paint(rct_window *w, rct_drawpixelinfo *dpi) gfx_draw_string_left(dpi, STR_BOTTOM_TOOLBAR_CASH, gCommonFormatArgs, colour, w->x + XPL(0) + TXTO, w->y + YPL(2) + TXTO); } else if(w->page == WINDOW_CHEATS_PAGE_MISC){ - gfx_draw_string_left(dpi, STR_CHEAT_STAFF_SPEED, NULL, COLOUR_BLACK, w->x + XPL(0) + TXTO, w->y + YPL(17) + TXTO); - gfx_draw_string_left(dpi, STR_FORCE_WEATHER, NULL, COLOUR_BLACK, w->x + XPL(0) + TXTO, w->y + YPL(10) + TXTO); + gfx_draw_string_left(dpi, STR_CHEAT_STAFF_SPEED, nullptr, COLOUR_BLACK, w->x + XPL(0) + TXTO, w->y + YPL(17) + TXTO); + gfx_draw_string_left(dpi, STR_FORCE_WEATHER, nullptr, COLOUR_BLACK, w->x + XPL(0) + TXTO, w->y + YPL(10) + TXTO); gfx_draw_string_right(dpi, STR_FORMAT_INTEGER, &park_rating_spinner_value, w->colours[1], w->x + WPL(1) - 10 - TXTO, w->y + YPL(5) + TXTO); } else if (w->page == WINDOW_CHEATS_PAGE_GUESTS){ - gfx_draw_string_left(dpi, STR_CHEAT_GUEST_HAPPINESS, NULL, COLOUR_BLACK, w->x + XPL(0) + TXTO, w->y + YPL(1) + TXTO); - gfx_draw_string_left(dpi, STR_CHEAT_GUEST_ENERGY, NULL, COLOUR_BLACK, w->x + XPL(0) + TXTO, w->y + YPL(2) + TXTO); - gfx_draw_string_left(dpi, STR_CHEAT_GUEST_HUNGER, NULL, COLOUR_BLACK, w->x + XPL(0) + TXTO, w->y + YPL(3) + TXTO); - gfx_draw_string_left(dpi, STR_CHEAT_GUEST_THIRST, NULL, COLOUR_BLACK, w->x + XPL(0) + TXTO, w->y + YPL(4) + TXTO); - gfx_draw_string_left(dpi, STR_CHEAT_GUEST_NAUSEA, NULL, COLOUR_BLACK, w->x + XPL(0) + TXTO, w->y + YPL(5) + TXTO); - gfx_draw_string_left(dpi, STR_CHEAT_GUEST_NAUSEA_TOLERANCE, NULL, COLOUR_BLACK, w->x + XPL(0) + TXTO, w->y + YPL(6) + TXTO); - gfx_draw_string_left(dpi, STR_CHEAT_GUEST_BATHROOM, NULL, COLOUR_BLACK, w->x + XPL(0) + TXTO, w->y + YPL(7) + TXTO); - gfx_draw_string_left(dpi, STR_CHEAT_GUEST_PREFERRED_INTENSITY,NULL, COLOUR_BLACK, w->x + XPL(0) + TXTO, w->y + YPL(8) + TXTO); + gfx_draw_string_left(dpi, STR_CHEAT_GUEST_HAPPINESS, nullptr, COLOUR_BLACK, w->x + XPL(0) + TXTO, w->y + YPL(1) + TXTO); + gfx_draw_string_left(dpi, STR_CHEAT_GUEST_ENERGY, nullptr, COLOUR_BLACK, w->x + XPL(0) + TXTO, w->y + YPL(2) + TXTO); + gfx_draw_string_left(dpi, STR_CHEAT_GUEST_HUNGER, nullptr, COLOUR_BLACK, w->x + XPL(0) + TXTO, w->y + YPL(3) + TXTO); + gfx_draw_string_left(dpi, STR_CHEAT_GUEST_THIRST, nullptr, COLOUR_BLACK, w->x + XPL(0) + TXTO, w->y + YPL(4) + TXTO); + gfx_draw_string_left(dpi, STR_CHEAT_GUEST_NAUSEA, nullptr, COLOUR_BLACK, w->x + XPL(0) + TXTO, w->y + YPL(5) + TXTO); + gfx_draw_string_left(dpi, STR_CHEAT_GUEST_NAUSEA_TOLERANCE, nullptr, COLOUR_BLACK, w->x + XPL(0) + TXTO, w->y + YPL(6) + TXTO); + gfx_draw_string_left(dpi, STR_CHEAT_GUEST_BATHROOM, nullptr, COLOUR_BLACK, w->x + XPL(0) + TXTO, w->y + YPL(7) + TXTO); + gfx_draw_string_left(dpi, STR_CHEAT_GUEST_PREFERRED_INTENSITY,nullptr, COLOUR_BLACK, w->x + XPL(0) + TXTO, w->y + YPL(8) + TXTO); } } diff --git a/src/openrct2-ui/windows/ClearScenery.cpp b/src/openrct2-ui/windows/ClearScenery.cpp index 44d02144e3..9f3290c9bc 100644 --- a/src/openrct2-ui/windows/ClearScenery.cpp +++ b/src/openrct2-ui/windows/ClearScenery.cpp @@ -64,32 +64,32 @@ static void window_clear_scenery_inputsize(rct_window *w); static rct_window_event_list window_clear_scenery_events = { window_clear_scenery_close, window_clear_scenery_mouseup, - NULL, + nullptr, window_clear_scenery_mousedown, - NULL, - NULL, + nullptr, + nullptr, window_clear_scenery_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_clear_scenery_textinput, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_clear_scenery_invalidate, window_clear_scenery_paint, - NULL + nullptr }; /** @@ -102,7 +102,7 @@ rct_window * window_clear_scenery_open() // Check if window is already open window = window_find_by_class(WC_CLEAR_SCENERY); - if (window != NULL) + if (window != nullptr) return window; window = window_create(context_get_width() - 98, 29, 98, 94, &window_clear_scenery_events, WC_CLEAR_SCENERY, 0); @@ -187,7 +187,7 @@ static void window_clear_scenery_textinput(rct_window *w, rct_widgetindex widget sint32 size; char* end; - if (widgetIndex != WIDX_PREVIEW || text == NULL) + if (widgetIndex != WIDX_PREVIEW || text == nullptr) return; size = strtol(text, &end, 10); diff --git a/src/openrct2-ui/windows/CustomCurrency.cpp b/src/openrct2-ui/windows/CustomCurrency.cpp index 19d765e543..5d69cf4db0 100644 --- a/src/openrct2-ui/windows/CustomCurrency.cpp +++ b/src/openrct2-ui/windows/CustomCurrency.cpp @@ -58,34 +58,34 @@ static void custom_currency_window_paint(rct_window *w, rct_drawpixelinfo *dpi); static rct_window_event_list _windowCustomCurrencyEvents = { - NULL, + nullptr, custom_currency_window_mouseup, - NULL, + nullptr, custom_currency_window_mousedown, custom_currency_window_dropdown, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, custom_currency_window_text_input, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, custom_currency_window_paint, - NULL + nullptr }; @@ -95,7 +95,7 @@ rct_window * custom_currency_window_open() // Check if window is already open window = window_bring_to_front_by_class(WC_CUSTOM_CURRENCY_CONFIG); - if(window != NULL) + if(window != nullptr) return window; window = window_create_centred( @@ -235,7 +235,7 @@ static void custom_currency_window_dropdown(rct_window *w, rct_widgetindex widge static void custom_currency_window_text_input(struct rct_window *w, rct_widgetindex widgetIndex, char *text) { - if (text == NULL) + if (text == nullptr) return; sint32 rate; char* end; @@ -281,7 +281,7 @@ static void custom_currency_window_paint(rct_window *w, rct_drawpixelinfo *dpi) x = w->x + 10; y = w->y + 30; - gfx_draw_string_left(dpi, STR_RATE, NULL, w->colours[1], x, y); + gfx_draw_string_left(dpi, STR_RATE, nullptr, w->colours[1], x, y); sint32 baseExchange = CurrencyDescriptors[CURRENCY_POUNDS].rate; set_format_arg(0, sint32, baseExchange); @@ -289,7 +289,7 @@ static void custom_currency_window_paint(rct_window *w, rct_drawpixelinfo *dpi) y += 20; - gfx_draw_string_left(dpi, STR_CURRENCY_SYMBOL_TEXT, NULL, w->colours[1], x, y); + gfx_draw_string_left(dpi, STR_CURRENCY_SYMBOL_TEXT, nullptr, w->colours[1], x, y); gfx_draw_string( dpi, diff --git a/src/openrct2-ui/windows/DebugPaint.cpp b/src/openrct2-ui/windows/DebugPaint.cpp index 929b70f8c1..bc8439befc 100644 --- a/src/openrct2-ui/windows/DebugPaint.cpp +++ b/src/openrct2-ui/windows/DebugPaint.cpp @@ -49,34 +49,34 @@ static void window_debug_paint_invalidate(rct_window * w); static void window_debug_paint_paint(rct_window * w, rct_drawpixelinfo * dpi); static rct_window_event_list window_debug_paint_events = { - NULL, + nullptr, window_debug_paint_mouseup, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_debug_paint_invalidate, window_debug_paint_paint, - NULL + nullptr }; rct_window * window_debug_paint_open() @@ -85,7 +85,7 @@ rct_window * window_debug_paint_open() // Check if window is already open window = window_find_by_class(WC_DEBUG_PAINT); - if (window != NULL) + if (window != nullptr) return window; window = window_create( diff --git a/src/openrct2-ui/windows/EditorInventionsList.cpp b/src/openrct2-ui/windows/EditorInventionsList.cpp index 51d062b77f..e44642d211 100644 --- a/src/openrct2-ui/windows/EditorInventionsList.cpp +++ b/src/openrct2-ui/windows/EditorInventionsList.cpp @@ -93,29 +93,29 @@ static void window_editor_inventions_list_drag_paint(rct_window *w, rct_drawpixe static rct_window_event_list window_editor_inventions_list_events = { window_editor_inventions_list_close, window_editor_inventions_list_mouseup, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_editor_inventions_list_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_editor_inventions_list_scrollgetheight, window_editor_inventions_list_scrollmousedown, - NULL, + nullptr, window_editor_inventions_list_scrollmouseover, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_editor_inventions_list_tooltip, window_editor_inventions_list_cursor, - NULL, + nullptr, window_editor_inventions_list_invalidate, window_editor_inventions_list_paint, window_editor_inventions_list_scrollpaint @@ -123,34 +123,34 @@ static rct_window_event_list window_editor_inventions_list_events = { // 0x009817EC static rct_window_event_list window_editor_inventions_list_drag_events = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_editor_inventions_list_drag_cursor, window_editor_inventions_list_drag_moved, - NULL, + nullptr, window_editor_inventions_list_drag_paint, - NULL + nullptr }; #pragma endregion @@ -214,7 +214,7 @@ static void research_rides_setup(){ for (uint8 rideType = 0; rideType < object_entry_group_counts[OBJECT_TYPE_RIDE]; rideType++){ rct_ride_entry* master_ride = get_ride_entry(rideType); - if (master_ride == NULL || (intptr_t)master_ride == -1) + if (master_ride == nullptr || (intptr_t)master_ride == -1) continue; if (master_ride->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) @@ -258,7 +258,7 @@ static void research_rides_setup(){ research->entryIndex |= RESEARCH_ENTRY_FLAG_RIDE_ALWAYS_RESEARCHED; _editorInventionsListDraggedItem = research; move_research_item(gResearchItems); - _editorInventionsListDraggedItem = NULL; + _editorInventionsListDraggedItem = nullptr; research--; } } @@ -289,7 +289,7 @@ static void research_scenery_sets_setup(){ research->entryIndex |= RESEARCH_ENTRY_FLAG_SCENERY_SET_ALWAYS_RESEARCHED; _editorInventionsListDraggedItem = research; move_research_item(gResearchItems); - _editorInventionsListDraggedItem = NULL; + _editorInventionsListDraggedItem = nullptr; } } } @@ -330,14 +330,14 @@ static rct_string_id research_item_get_name(uint32 researchItem) { if (researchItem < 0x10000) { rct_scenery_set_entry *sceneryEntry = get_scenery_group_entry(researchItem & 0xFF); - if (sceneryEntry == NULL || sceneryEntry == (rct_scenery_set_entry*)-1) + if (sceneryEntry == nullptr || sceneryEntry == (rct_scenery_set_entry*)-1) return 0; return sceneryEntry->name; } rct_ride_entry *rideEntry = get_ride_entry(researchItem & 0xFF); - if (rideEntry == NULL || rideEntry == (rct_ride_entry*)-1) + if (rideEntry == nullptr || rideEntry == (rct_ride_entry*)-1) return 0; if (rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) @@ -454,8 +454,8 @@ static void move_research_item(rct_research_item *beforeItem) *researchItem = draggedItem; w = window_find_by_class(WC_EDITOR_INVENTION_LIST); - if (w != NULL) { - w->research_item = NULL; + if (w != nullptr) { + w->research_item = nullptr; window_invalidate(w); } } @@ -482,7 +482,7 @@ static rct_research_item *window_editor_inventions_list_get_item_from_scroll_y(s return researchItem; } - return NULL; + return nullptr; } /** @@ -513,7 +513,7 @@ static rct_research_item *window_editor_inventions_list_get_item_from_scroll_y_i static rct_research_item *get_research_item_at(sint32 x, sint32 y) { rct_window *w = window_find_by_class(WC_EDITOR_INVENTION_LIST); - if (w != NULL && w->x <= x && w->y < y && w->x + w->width > x && w->y + w->height > y) { + if (w != nullptr && w->x <= x && w->y < y && w->x + w->width > x && w->y + w->height > y) { rct_widgetindex widgetIndex = window_find_widget_from_point(w, x, y); rct_widget *widget = &w->widgets[widgetIndex]; if (widgetIndex == WIDX_PRE_RESEARCHED_SCROLL || widgetIndex == WIDX_RESEARCH_ORDER_SCROLL) { @@ -529,7 +529,7 @@ static rct_research_item *get_research_item_at(sint32 x, sint32 y) } } - return NULL; + return nullptr; } /** @@ -541,7 +541,7 @@ rct_window * window_editor_inventions_list_open() rct_window *w; w = window_bring_to_front_by_class(WC_EDITOR_INVENTION_LIST); - if (w != NULL) + if (w != nullptr) return w; research_always_researched_setup(); @@ -563,8 +563,8 @@ rct_window * window_editor_inventions_list_open() window_init_scroll_widgets(w); w->var_4AE = 0; w->selected_tab = 0; - w->research_item = NULL; - _editorInventionsListDraggedItem = NULL; + w->research_item = nullptr; + _editorInventionsListDraggedItem = nullptr; return w; } @@ -622,13 +622,13 @@ static void window_editor_inventions_list_update(rct_window *w) window_event_invalidate_call(w); widget_invalidate(w, WIDX_TAB_1); - if (_editorInventionsListDraggedItem == NULL) + if (_editorInventionsListDraggedItem == nullptr) return; - if (window_find_by_class(WC_EDITOR_INVENTION_LIST_DRAG) != NULL) + if (window_find_by_class(WC_EDITOR_INVENTION_LIST_DRAG) != nullptr) return; - _editorInventionsListDraggedItem = NULL; + _editorInventionsListDraggedItem = nullptr; window_invalidate(w); } @@ -665,7 +665,7 @@ static void window_editor_inventions_list_scrollmousedown(rct_window *w, sint32 rct_research_item *researchItem; researchItem = window_editor_inventions_list_get_item_from_scroll_y(scrollIndex, y); - if (researchItem == NULL) + if (researchItem == nullptr) return; if (researchItem->entryIndex < RESEARCHED_ITEMS_END_2 && research_item_is_always_researched(researchItem)) @@ -720,7 +720,7 @@ static void window_editor_inventions_list_cursor(rct_window *w, rct_widgetindex } researchItem = window_editor_inventions_list_get_item_from_scroll_y(scrollIndex, y); - if (researchItem == NULL) + if (researchItem == nullptr) return; if (researchItem->entryIndex < RESEARCHED_ITEMS_END_2 && research_item_is_always_researched(researchItem)) { @@ -764,12 +764,12 @@ static void window_editor_inventions_list_paint(rct_window *w, rct_drawpixelinfo // Pre-researched items label x = w->x + w->widgets[WIDX_PRE_RESEARCHED_SCROLL].left; y = w->y + w->widgets[WIDX_PRE_RESEARCHED_SCROLL].top - 11; - gfx_draw_string_left(dpi, STR_INVENTION_PREINVENTED_ITEMS, NULL, COLOUR_BLACK, x, y - 1); + gfx_draw_string_left(dpi, STR_INVENTION_PREINVENTED_ITEMS, nullptr, COLOUR_BLACK, x, y - 1); // Research order label x = w->x + w->widgets[WIDX_RESEARCH_ORDER_SCROLL].left; y = w->y + w->widgets[WIDX_RESEARCH_ORDER_SCROLL].top - 11; - gfx_draw_string_left(dpi, STR_INVENTION_TO_BE_INVENTED_ITEMS, NULL, COLOUR_BLACK, x, y - 1); + gfx_draw_string_left(dpi, STR_INVENTION_TO_BE_INVENTED_ITEMS, nullptr, COLOUR_BLACK, x, y - 1); // Preview background widget = &w->widgets[WIDX_PREVIEW]; @@ -783,10 +783,10 @@ static void window_editor_inventions_list_paint(rct_window *w, rct_drawpixelinfo ); researchItem = _editorInventionsListDraggedItem; - if (researchItem == NULL) + if (researchItem == nullptr) researchItem = w->research_item; // If the research item is null or a list separator. - if (researchItem == NULL || researchItem->entryIndex < 0) + if (researchItem == nullptr || researchItem->entryIndex < 0) return; // Preview image @@ -797,7 +797,7 @@ static void window_editor_inventions_list_paint(rct_window *w, rct_drawpixelinfo void *chunk = object_entry_groups[objectEntryType].chunks[researchItem->entryIndex & 0xFF]; - if (chunk == NULL || chunk == (void*)-1) + if (chunk == nullptr || chunk == (void*)-1) return; rct_object_entry * entry = &object_entry_groups[objectEntryType].entries[researchItem->entryIndex & 0xFF].entry; @@ -806,7 +806,7 @@ static void window_editor_inventions_list_paint(rct_window *w, rct_drawpixelinfo widget = &w->widgets[WIDX_PREVIEW]; void * object = object_manager_get_loaded_object(entry); - if (object != NULL) { + if (object != nullptr) { rct_drawpixelinfo clipDPI; x = w->x + widget->left + 1; y = w->y + widget->top + 1; @@ -867,7 +867,7 @@ static void window_editor_inventions_list_scrollpaint(rct_window *w, rct_drawpix uint8 colour = COLOUR_BRIGHT_GREEN | COLOUR_FLAG_TRANSLUCENT; if (w->research_item == researchItem) { - if (_editorInventionsListDraggedItem == NULL) { + if (_editorInventionsListDraggedItem == nullptr) { // Highlight top = itemY; bottom = itemY + 9; @@ -878,7 +878,7 @@ static void window_editor_inventions_list_scrollpaint(rct_window *w, rct_drawpix } gfx_filter_rect(dpi, 0, top, w->width, bottom, PALETTE_DARKEN_1); - if (_editorInventionsListDraggedItem == NULL) + if (_editorInventionsListDraggedItem == nullptr) colour = COLOUR_BRIGHT_GREEN; } @@ -896,11 +896,11 @@ static void window_editor_inventions_list_scrollpaint(rct_window *w, rct_drawpix ptr = utf8_write_codepoint(ptr, colour); } - format_string(ptr, 256, stringId, NULL); + format_string(ptr, 256, stringId, nullptr); if (disableItemMovement) { gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM_DARK; - if (colour == COLOUR_BRIGHT_GREEN && _editorInventionsListDraggedItem == NULL) { + if (colour == COLOUR_BRIGHT_GREEN && _editorInventionsListDraggedItem == nullptr) { gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM_EXTRA_DARK; } colour = COLOUR_FLAG_INSET | w->colours[1]; @@ -932,7 +932,7 @@ static void window_editor_inventions_list_drag_open(rct_research_item *researchI _editorInventionsListDraggedItem = researchItem; stringId = research_item_get_name(researchItem->entryIndex & 0xFFFFFF); - format_string(buffer, 256, stringId, NULL); + format_string(buffer, 256, stringId, nullptr); stringWidth = gfx_get_string_width(buffer); window_editor_inventions_list_drag_widgets[0].right = stringWidth; @@ -957,7 +957,7 @@ static void window_editor_inventions_list_drag_open(rct_research_item *researchI static void window_editor_inventions_list_drag_cursor(rct_window *w, rct_widgetindex widgetIndex, sint32 x, sint32 y, sint32 *cursorId) { rct_window *inventionListWindow = window_find_by_class(WC_EDITOR_INVENTION_LIST); - if (inventionListWindow != NULL) { + if (inventionListWindow != nullptr) { rct_research_item *researchItem = get_research_item_at(x, y); if (researchItem != inventionListWindow->research_item) { inventionListWindow = (rct_window *)researchItem; @@ -977,11 +977,11 @@ static void window_editor_inventions_list_drag_moved(rct_window* w, sint32 x, si rct_research_item *researchItem; researchItem = get_research_item_at(x, y); - if (researchItem != NULL) + if (researchItem != nullptr) move_research_item(researchItem); window_close(w); - _editorInventionsListDraggedItem = NULL; + _editorInventionsListDraggedItem = nullptr; window_invalidate_by_class(WC_EDITOR_INVENTION_LIST); } diff --git a/src/openrct2-ui/windows/EditorObjectiveOptions.cpp b/src/openrct2-ui/windows/EditorObjectiveOptions.cpp index 6ec1005137..50a0b903a3 100644 --- a/src/openrct2-ui/windows/EditorObjectiveOptions.cpp +++ b/src/openrct2-ui/windows/EditorObjectiveOptions.cpp @@ -151,63 +151,63 @@ static void window_editor_objective_options_rides_scrollpaint(rct_window *w, rct // 0x009A9DF4 static rct_window_event_list window_objective_options_main_events = { - NULL, + nullptr, window_editor_objective_options_main_mouseup, window_editor_objective_options_main_resize, window_editor_objective_options_main_mousedown, window_editor_objective_options_main_dropdown, - NULL, + nullptr, window_editor_objective_options_main_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_editor_objective_options_main_textinput, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_editor_objective_options_main_invalidate, window_editor_objective_options_main_paint, - NULL + nullptr }; // 0x009A9F58 static rct_window_event_list window_objective_options_rides_events = { - NULL, + nullptr, window_editor_objective_options_rides_mouseup, window_editor_objective_options_rides_resize, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_editor_objective_options_rides_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_editor_objective_options_rides_scrollgetheight, window_editor_objective_options_rides_scrollmousedown, - NULL, + nullptr, window_editor_objective_options_rides_scrollmouseover, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_editor_objective_options_rides_invalidate, window_editor_objective_options_rides_paint, window_editor_objective_options_rides_scrollpaint @@ -267,7 +267,7 @@ rct_window * window_editor_objective_options_open() rct_window *w; w = window_bring_to_front_by_class(WC_EDTIOR_OBJECTIVE_OPTIONS); - if (w != NULL) + if (w != nullptr) return w; w = window_create_centred( @@ -789,7 +789,7 @@ static void window_editor_objective_options_main_update(rct_window *w) */ static void window_editor_objective_options_main_textinput(rct_window *w, rct_widgetindex widgetIndex, char *text) { - if (text == NULL) + if (text == nullptr) return; switch (widgetIndex) { @@ -831,7 +831,7 @@ static void window_editor_objective_options_main_invalidate(rct_window *w) stex = g_stexEntries[0]; if (stex == (rct_stex_entry*)-1) - stex = NULL; + stex = nullptr; widgets = window_editor_objective_options_widgets[w->page]; if (w->widgets != widgets) { @@ -841,7 +841,7 @@ static void window_editor_objective_options_main_invalidate(rct_window *w) window_editor_objective_options_set_pressed_tab(w); - if (stex == NULL) + if (stex == nullptr) w->disabled_widgets &= ~((1 << WIDX_PARK_NAME) | (1 << WIDX_SCENARIO_NAME)); else w->disabled_widgets |= ((1 << WIDX_PARK_NAME) | (1 << WIDX_SCENARIO_NAME)); @@ -901,12 +901,12 @@ static void window_editor_objective_options_main_paint(rct_window *w, rct_drawpi stex = g_stexEntries[0]; if (stex == (rct_stex_entry*)-1) - stex = NULL; + stex = nullptr; // Objective label x = w->x + 8; y = w->y + w->widgets[WIDX_OBJECTIVE].top; - gfx_draw_string_left(dpi, STR_OBJECTIVE_WINDOW, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_OBJECTIVE_WINDOW, nullptr, COLOUR_BLACK, x, y); // Objective value x = w->x + w->widgets[WIDX_OBJECTIVE].left + 1; @@ -940,7 +940,7 @@ static void window_editor_objective_options_main_paint(rct_window *w, rct_drawpi stringId = STR_WINDOW_OBJECTIVE_EXCITEMENT_RATING; break; } - gfx_draw_string_left(dpi, stringId, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, stringId, nullptr, COLOUR_BLACK, x, y); // Objective argument 1 value x = w->x + w->widgets[WIDX_OBJECTIVE_ARG_1].left + 1; @@ -974,7 +974,7 @@ static void window_editor_objective_options_main_paint(rct_window *w, rct_drawpi // Objective argument 2 label x = w->x + 28; y = w->y + w->widgets[WIDX_OBJECTIVE_ARG_2].top; - gfx_draw_string_left(dpi, STR_WINDOW_OBJECTIVE_DATE, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_WINDOW_OBJECTIVE_DATE, nullptr, COLOUR_BLACK, x, y); // Objective argument 2 value x = w->x + w->widgets[WIDX_OBJECTIVE_ARG_2].left + 1; @@ -986,7 +986,7 @@ static void window_editor_objective_options_main_paint(rct_window *w, rct_drawpi // Climate label x = w->x + 8; y = w->y + w->widgets[WIDX_CLIMATE].top; - gfx_draw_string_left(dpi, STR_CLIMATE_LABEL, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_CLIMATE_LABEL, nullptr, COLOUR_BLACK, x, y); // Climate value x = w->x + w->widgets[WIDX_CLIMATE].left + 1; @@ -999,7 +999,7 @@ static void window_editor_objective_options_main_paint(rct_window *w, rct_drawpi y = w->y + w->widgets[WIDX_PARK_NAME].top; width = w->widgets[WIDX_PARK_NAME].left - 16; - if (stex != NULL) { + if (stex != nullptr) { set_format_arg(0, rct_string_id, stex->park_name); } else { set_format_arg(0, rct_string_id, gParkName); @@ -1012,7 +1012,7 @@ static void window_editor_objective_options_main_paint(rct_window *w, rct_drawpi y = w->y + w->widgets[WIDX_SCENARIO_NAME].top; width = w->widgets[WIDX_SCENARIO_NAME].left - 16; - if (stex != NULL) { + if (stex != nullptr) { set_format_arg(0, rct_string_id, stex->scenario_name); set_format_arg(2, uint32, gParkNameArgs); } else { @@ -1025,14 +1025,14 @@ static void window_editor_objective_options_main_paint(rct_window *w, rct_drawpi // Scenario details label x = w->x + 8; y = w->y + w->widgets[WIDX_DETAILS].top; - gfx_draw_string_left(dpi, STR_WINDOW_PARK_DETAILS, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_WINDOW_PARK_DETAILS, nullptr, COLOUR_BLACK, x, y); // Scenario details value x = w->x + 16; y = w->y + w->widgets[WIDX_DETAILS].top + 10; width = w->widgets[WIDX_DETAILS].left - 4; - if (stex != NULL) { + if (stex != nullptr) { set_format_arg(0, rct_string_id, stex->details); set_format_arg(2, uint32, gParkNameArgs); } else { @@ -1044,7 +1044,7 @@ static void window_editor_objective_options_main_paint(rct_window *w, rct_drawpi // Scenario category label x = w->x + 8; y = w->y + w->widgets[WIDX_CATEGORY].top; - gfx_draw_string_left(dpi, STR_WINDOW_SCENARIO_GROUP, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_WINDOW_SCENARIO_GROUP, nullptr, COLOUR_BLACK, x, y); // Scenario category value x = w->x + w->widgets[WIDX_CATEGORY].left + 1; @@ -1182,7 +1182,7 @@ static void window_editor_objective_options_rides_paint(rct_window *w, rct_drawp window_draw_widgets(w, dpi); window_editor_objective_options_draw_tab_images(w, dpi); - gfx_draw_string_left(dpi, STR_WINDOW_PRESERVATION_ORDER, NULL, COLOUR_BLACK, w->x + 6, w->y + w->widgets[WIDX_PAGE_BACKGROUND].top + 3); + gfx_draw_string_left(dpi, STR_WINDOW_PRESERVATION_ORDER, nullptr, COLOUR_BLACK, w->x + 6, w->y + w->widgets[WIDX_PAGE_BACKGROUND].top + 3); } /** diff --git a/src/openrct2-ui/windows/EditorScenarioOptions.cpp b/src/openrct2-ui/windows/EditorScenarioOptions.cpp index eb62ba07ae..fae6d34ef0 100644 --- a/src/openrct2-ui/windows/EditorScenarioOptions.cpp +++ b/src/openrct2-ui/windows/EditorScenarioOptions.cpp @@ -209,98 +209,98 @@ static void window_editor_scenario_options_park_paint(rct_window *w, rct_drawpix // 0x0097EB60 static rct_window_event_list window_scenario_options_financial_events = { - NULL, + nullptr, window_editor_scenario_options_financial_mouseup, window_editor_scenario_options_financial_resize, window_editor_scenario_options_financial_mousedown, - NULL, - NULL, + nullptr, + nullptr, window_editor_scenario_options_financial_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_editor_scenario_options_financial_invalidate, window_editor_scenario_options_financial_paint, - NULL + nullptr }; // 0x0097EBD0 static rct_window_event_list window_scenario_options_guests_events = { - NULL, + nullptr, window_editor_scenario_options_guests_mouseup, window_editor_scenario_options_guests_resize, window_editor_scenario_options_guests_mousedown, - NULL, - NULL, + nullptr, + nullptr, window_editor_scenario_options_guests_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_editor_scenario_options_guests_invalidate, window_editor_scenario_options_guests_paint, - NULL + nullptr }; // 0x0097EC40 static rct_window_event_list window_scenario_options_park_events = { - NULL, + nullptr, window_editor_scenario_options_park_mouseup, window_editor_scenario_options_park_resize, window_editor_scenario_options_park_mousedown, window_editor_scenario_options_park_dropdown, - NULL, + nullptr, window_editor_scenario_options_park_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_editor_scenario_options_park_invalidate, window_editor_scenario_options_park_paint, - NULL + nullptr }; static rct_window_event_list *window_editor_scenario_options_page_events[] = { @@ -394,7 +394,7 @@ rct_window * window_editor_scenario_options_open() rct_window *w; w = window_bring_to_front_by_class(WC_EDITOR_SCENARIO_OPTIONS); - if (w != NULL) + if (w != nullptr) return w; w = window_create_centred( @@ -791,7 +791,7 @@ static void window_editor_scenario_options_financial_paint(rct_window *w, rct_dr if (w->widgets[WIDX_INITIAL_CASH].type != WWT_EMPTY) { x = w->x + 8; y = w->y + w->widgets[WIDX_INITIAL_CASH].top; - gfx_draw_string_left(dpi, STR_INIT_CASH_LABEL, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_INIT_CASH_LABEL, nullptr, COLOUR_BLACK, x, y); x = w->x + w->widgets[WIDX_INITIAL_CASH].left + 1; y = w->y + w->widgets[WIDX_INITIAL_CASH].top; @@ -801,7 +801,7 @@ static void window_editor_scenario_options_financial_paint(rct_window *w, rct_dr if (w->widgets[WIDX_INITIAL_LOAN].type != WWT_EMPTY) { x = w->x + 8; y = w->y + w->widgets[WIDX_INITIAL_LOAN].top; - gfx_draw_string_left(dpi, STR_INIT_LOAN_LABEL, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_INIT_LOAN_LABEL, nullptr, COLOUR_BLACK, x, y); x = w->x + w->widgets[WIDX_INITIAL_LOAN].left + 1; y = w->y + w->widgets[WIDX_INITIAL_LOAN].top; @@ -811,7 +811,7 @@ static void window_editor_scenario_options_financial_paint(rct_window *w, rct_dr if (w->widgets[WIDX_MAXIMUM_LOAN].type != WWT_EMPTY) { x = w->x + 8; y = w->y + w->widgets[WIDX_MAXIMUM_LOAN].top; - gfx_draw_string_left(dpi, STR_MAX_LOAN_LABEL, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_MAX_LOAN_LABEL, nullptr, COLOUR_BLACK, x, y); x = w->x + w->widgets[WIDX_MAXIMUM_LOAN].left + 1; y = w->y + w->widgets[WIDX_MAXIMUM_LOAN].top; @@ -821,7 +821,7 @@ static void window_editor_scenario_options_financial_paint(rct_window *w, rct_dr if (w->widgets[WIDX_INTEREST_RATE].type != WWT_EMPTY) { x = w->x + 8; y = w->y + w->widgets[WIDX_INTEREST_RATE].top; - gfx_draw_string_left(dpi, STR_INTEREST_RATE_LABEL, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_INTEREST_RATE_LABEL, nullptr, COLOUR_BLACK, x, y); x = w->x + w->widgets[WIDX_INTEREST_RATE].left + 1; y = w->y + w->widgets[WIDX_INTEREST_RATE].top; @@ -1094,7 +1094,7 @@ static void window_editor_scenario_options_guests_paint(rct_window *w, rct_drawp // Cash per guest label x = w->x + 8; y = w->y + w->widgets[WIDX_CASH_PER_GUEST].top; - gfx_draw_string_left(dpi, STR_CASH_PER_GUEST_LABEL, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_CASH_PER_GUEST_LABEL, nullptr, COLOUR_BLACK, x, y); // Cash per guest value x = w->x + w->widgets[WIDX_CASH_PER_GUEST].left + 1; @@ -1106,7 +1106,7 @@ static void window_editor_scenario_options_guests_paint(rct_window *w, rct_drawp // Guest initial happiness label x = w->x + 8; y = w->y + w->widgets[WIDX_GUEST_INITIAL_HAPPINESS].top; - gfx_draw_string_left(dpi, STR_GUEST_INIT_HAPPINESS, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_GUEST_INIT_HAPPINESS, nullptr, COLOUR_BLACK, x, y); // Guest initial happiness value x = w->x + w->widgets[WIDX_GUEST_INITIAL_HAPPINESS].left + 1; @@ -1117,7 +1117,7 @@ static void window_editor_scenario_options_guests_paint(rct_window *w, rct_drawp // Guest initial hunger label x = w->x + 8; y = w->y + w->widgets[WIDX_GUEST_INITIAL_HUNGER].top; - gfx_draw_string_left(dpi, STR_GUEST_INIT_HUNGER, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_GUEST_INIT_HUNGER, nullptr, COLOUR_BLACK, x, y); // Guest initial hunger value x = w->x + w->widgets[WIDX_GUEST_INITIAL_HUNGER].left + 1; @@ -1128,7 +1128,7 @@ static void window_editor_scenario_options_guests_paint(rct_window *w, rct_drawp // Guest initial thirst label x = w->x + 8; y = w->y + w->widgets[WIDX_GUEST_INITIAL_THIRST].top; - gfx_draw_string_left(dpi, STR_GUEST_INIT_THIRST, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_GUEST_INIT_THIRST, nullptr, COLOUR_BLACK, x, y); // Guest initial thirst value x = w->x + w->widgets[WIDX_GUEST_INITIAL_THIRST].left + 1; @@ -1471,7 +1471,7 @@ static void window_editor_scenario_options_park_paint(rct_window *w, rct_drawpix // Cost to buy land label x = w->x + 8; y = w->y + w->widgets[WIDX_LAND_COST].top; - gfx_draw_string_left(dpi, STR_LAND_COST_LABEL, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_LAND_COST_LABEL, nullptr, COLOUR_BLACK, x, y); // Cost to buy land value x = w->x + w->widgets[WIDX_LAND_COST].left + 1; @@ -1484,7 +1484,7 @@ static void window_editor_scenario_options_park_paint(rct_window *w, rct_drawpix // Cost to buy construction rights label x = w->x + 8; y = w->y + w->widgets[WIDX_CONSTRUCTION_RIGHTS_COST].top; - gfx_draw_string_left(dpi, STR_RIGHTS_COST_LABEL, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_RIGHTS_COST_LABEL, nullptr, COLOUR_BLACK, x, y); // Cost to buy construction rights value x = w->x + w->widgets[WIDX_CONSTRUCTION_RIGHTS_COST].left + 1; @@ -1497,7 +1497,7 @@ static void window_editor_scenario_options_park_paint(rct_window *w, rct_drawpix // Pay for park or rides label x = w->x + w->widgets[WIDX_PAY_FOR_PARK_OR_RIDES].left + 1; y = w->y + w->widgets[WIDX_PAY_FOR_PARK_OR_RIDES].top; - gfx_draw_string_left(dpi, STR_FREE_PARK_ENTER, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_FREE_PARK_ENTER, nullptr, COLOUR_BLACK, x, y); // Pay for park or rides value stringId = gParkFlags & PARK_FLAGS_PARK_FREE_ENTRY ? STR_FREE_PARK_ENTER : STR_PAY_PARK_ENTER; @@ -1508,7 +1508,7 @@ static void window_editor_scenario_options_park_paint(rct_window *w, rct_drawpix // Entry price label x = w->x + w->widgets[WIDX_PAY_FOR_PARK_OR_RIDES].right + 8; y = w->y + w->widgets[WIDX_ENTRY_PRICE].top; - gfx_draw_string_left(dpi, STR_ENTRY_PRICE_LABEL, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_ENTRY_PRICE_LABEL, nullptr, COLOUR_BLACK, x, y); // Entry price value x = w->x + w->widgets[WIDX_ENTRY_PRICE].left + 1; diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index bd09c8a530..c02848c5a0 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -115,32 +115,32 @@ static void window_footpath_paint(rct_window *w, rct_drawpixelinfo *dpi); static rct_window_event_list window_footpath_events = { window_footpath_close, window_footpath_mouseup, - NULL, + nullptr, window_footpath_mousedown, window_footpath_dropdown, - NULL, + nullptr, window_footpath_update, - NULL, - NULL, + nullptr, + nullptr, window_footpath_toolupdate, window_footpath_tooldown, window_footpath_tooldrag, window_footpath_toolup, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_footpath_invalidate, window_footpath_paint, - NULL + nullptr }; static money32 _window_footpath_cost; @@ -619,7 +619,7 @@ static void window_footpath_paint(rct_window *w, rct_drawpixelinfo *dpi) // Draw build this... label x = w->x + (window_footpath_widgets[WIDX_CONSTRUCT].left + window_footpath_widgets[WIDX_CONSTRUCT].right) / 2; y = w->y + window_footpath_widgets[WIDX_CONSTRUCT].bottom - 23; - gfx_draw_string_centred(dpi, STR_BUILD_THIS, x, y, COLOUR_BLACK, NULL); + gfx_draw_string_centred(dpi, STR_BUILD_THIS, x, y, COLOUR_BLACK, nullptr); } // Draw cost @@ -708,7 +708,7 @@ static void window_footpath_set_provisional_path_at_point(sint32 x, sint32 y) sint32 interactionType; rct_map_element *mapElement; rct_xy16 mapCoord = { 0 }; - get_map_coordinates_from_pos(x, y, VIEWPORT_INTERACTION_MASK_FOOTPATH & VIEWPORT_INTERACTION_MASK_TERRAIN, &mapCoord.x, &mapCoord.y, &interactionType, &mapElement, NULL); + get_map_coordinates_from_pos(x, y, VIEWPORT_INTERACTION_MASK_FOOTPATH & VIEWPORT_INTERACTION_MASK_TERRAIN, &mapCoord.x, &mapCoord.y, &interactionType, &mapElement, nullptr); x = mapCoord.x; y = mapCoord.y; @@ -806,7 +806,7 @@ static void window_footpath_place_path_at_point(sint32 x, sint32 y) footpath_provisional_update(); rct_xy16 mapCoord = { 0 }; - get_map_coordinates_from_pos(x, y, VIEWPORT_INTERACTION_MASK_FOOTPATH & VIEWPORT_INTERACTION_MASK_TERRAIN, &mapCoord.x, &mapCoord.y, &interactionType, &mapElement, NULL); + get_map_coordinates_from_pos(x, y, VIEWPORT_INTERACTION_MASK_FOOTPATH & VIEWPORT_INTERACTION_MASK_TERRAIN, &mapCoord.x, &mapCoord.y, &interactionType, &mapElement, nullptr); x = mapCoord.x; y = mapCoord.y; @@ -991,7 +991,7 @@ static rct_map_element *footpath_get_map_element_to_remove() x = gFootpathConstructFromPosition.x / 32; y = gFootpathConstructFromPosition.y / 32; if (x >= 256 || y >= 256) - return NULL; + return nullptr; z = (gFootpathConstructFromPosition.z >> 3) & 0xFF; zLow = z - 2; @@ -1015,7 +1015,7 @@ static rct_map_element *footpath_get_map_element_to_remove() } } while (!map_element_is_last_for_tile(mapElement++)); - return NULL; + return nullptr; } /** @@ -1030,7 +1030,7 @@ static void window_footpath_remove() footpath_provisional_update(); mapElement = footpath_get_map_element_to_remove(); - if (mapElement != NULL) + if (mapElement != nullptr) footpath_remove_map_element(mapElement); window_footpath_set_enabled_and_pressed_widgets(); @@ -1043,7 +1043,7 @@ static void window_footpath_remove() static void window_footpath_set_enabled_and_pressed_widgets() { rct_window *w = window_find_by_class(WC_FOOTPATH); - if (w == NULL) + if (w == nullptr) return; if (gFootpathConstructionMode == PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL) { diff --git a/src/openrct2-ui/windows/Land.cpp b/src/openrct2-ui/windows/Land.cpp index aeedf99f45..cd5a7dc43d 100644 --- a/src/openrct2-ui/windows/Land.cpp +++ b/src/openrct2-ui/windows/Land.cpp @@ -71,32 +71,32 @@ static void window_land_inputsize(rct_window *w); static rct_window_event_list window_land_events = { window_land_close, window_land_mouseup, - NULL, + nullptr, window_land_mousedown, window_land_dropdown, - NULL, + nullptr, window_land_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_land_textinput, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_land_invalidate, window_land_paint, - NULL + nullptr }; static sint32 _selectedFloorTexture; @@ -112,7 +112,7 @@ rct_window * window_land_open() // Check if window is already open window = window_find_by_class(WC_LAND); - if (window != NULL) + if (window != nullptr) return window; window = window_create(context_get_width() - 98, 29, 98, 160, &window_land_events, WC_LAND, 0); @@ -262,7 +262,7 @@ static void window_land_textinput(rct_window *w, rct_widgetindex widgetIndex, ch sint32 size; char* end; - if (widgetIndex != WIDX_PREVIEW || text == NULL) + if (widgetIndex != WIDX_PREVIEW || text == nullptr) return; size = strtol(text, &end, 10); diff --git a/src/openrct2-ui/windows/LandRights.cpp b/src/openrct2-ui/windows/LandRights.cpp index 488e0a8de8..5a7bcd4e8a 100644 --- a/src/openrct2-ui/windows/LandRights.cpp +++ b/src/openrct2-ui/windows/LandRights.cpp @@ -71,32 +71,32 @@ static bool land_rights_tool_is_active(); static rct_window_event_list window_land_rights_events = { window_land_rights_close, window_land_rights_mouseup, - NULL, + nullptr, window_land_rights_mousedown, - NULL, - NULL, + nullptr, + nullptr, window_land_rights_update, - NULL, - NULL, + nullptr, + nullptr, window_land_rights_toolupdate, window_land_rights_tooldown, window_land_rights_tooldrag, - NULL, + nullptr, window_land_rights_toolabort, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_land_rights_textinput, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_land_rights_invalidate, window_land_rights_paint, - NULL + nullptr }; #define LAND_RIGHTS_MODE_BUY_CONSTRUCTION_RIGHTS 0 @@ -111,7 +111,7 @@ rct_window * window_land_rights_open() // Check if window is already open window = window_find_by_class(WC_LAND_RIGHTS); - if (window != NULL) + if (window != nullptr) return window; window = window_create(context_get_width() - 98, 29, 98, 94, &window_land_rights_events, WC_LAND_RIGHTS, 0); @@ -208,7 +208,7 @@ static void window_land_rights_textinput(rct_window *w, rct_widgetindex widgetIn sint32 size; char* end; - if (widgetIndex != WIDX_PREVIEW || text == NULL) + if (widgetIndex != WIDX_PREVIEW || text == nullptr) return; size = strtol(text, &end, 10); @@ -291,7 +291,7 @@ static void window_land_rights_tool_update_land_rights(sint16 x, sint16 y) gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; rct_xy16 mapTile = { 0 }; - screen_get_map_xy(x, y, &mapTile.x, &mapTile.y, NULL); + screen_get_map_xy(x, y, &mapTile.x, &mapTile.y, nullptr); if (mapTile.x == MAP_LOCATION_NULL) { if (_landRightsCost != MONEY32_UNDEFINED) { diff --git a/src/openrct2-ui/windows/Main.cpp b/src/openrct2-ui/windows/Main.cpp index 6abedaa56b..c9a0240525 100644 --- a/src/openrct2-ui/windows/Main.cpp +++ b/src/openrct2-ui/windows/Main.cpp @@ -32,34 +32,34 @@ rct_widget window_main_widgets[] = { void window_main_paint(rct_window *w, rct_drawpixelinfo *dpi); static rct_window_event_list window_main_events = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_main_paint, - NULL + nullptr }; /** diff --git a/src/openrct2-ui/windows/MapGen.cpp b/src/openrct2-ui/windows/MapGen.cpp index cb856befce..7731b28a75 100644 --- a/src/openrct2-ui/windows/MapGen.cpp +++ b/src/openrct2-ui/windows/MapGen.cpp @@ -261,125 +261,125 @@ static void window_mapgen_heightmap_paint(rct_window *w, rct_drawpixelinfo *dpi) static rct_window_event_list BaseEvents = { window_mapgen_shared_close, window_mapgen_base_mouseup, - NULL, + nullptr, window_mapgen_base_mousedown, window_mapgen_base_dropdown, - NULL, + nullptr, window_mapgen_base_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_mapgen_textinput, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_mapgen_base_invalidate, window_mapgen_base_paint, - NULL + nullptr }; static rct_window_event_list RandomEvents = { window_mapgen_shared_close, window_mapgen_random_mouseup, - NULL, + nullptr, window_mapgen_random_mousedown, - NULL, - NULL, + nullptr, + nullptr, window_mapgen_random_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_mapgen_random_invalidate, window_mapgen_random_paint, - NULL + nullptr }; static rct_window_event_list SimplexEvents = { window_mapgen_shared_close, window_mapgen_simplex_mouseup, - NULL, + nullptr, window_mapgen_simplex_mousedown, window_mapgen_simplex_dropdown, - NULL, + nullptr, window_mapgen_simplex_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_mapgen_textinput, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_mapgen_simplex_invalidate, window_mapgen_simplex_paint, - NULL + nullptr }; static rct_window_event_list HeightmapEvents = { window_mapgen_shared_close, window_mapgen_heightmap_mouseup, - NULL, + nullptr, window_mapgen_heightmap_mousedown, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_mapgen_heightmap_invalidate, window_mapgen_heightmap_paint, - NULL + nullptr }; static rct_window_event_list *PageEvents[] = { @@ -568,7 +568,7 @@ static sint32 _heightmapHigh = 70; rct_window *window_mapgen_open() { rct_window *w = window_bring_to_front_by_class(WC_MAPGEN); - if (w != NULL) { + if (w != nullptr) { return w; } @@ -745,7 +745,7 @@ static void window_mapgen_textinput(rct_window *w, rct_widgetindex widgetIndex, sint32 value; char* end; - if (text == NULL) + if (text == nullptr) return; value = strtol(text, &end, 10); @@ -795,10 +795,10 @@ static void window_mapgen_base_paint(rct_window *w, rct_drawpixelinfo *dpi) const uint8 textColour = w->colours[1]; - gfx_draw_string_left(dpi, STR_MAP_SIZE, NULL, textColour, w->x + 4, w->y + w->widgets[WIDX_MAP_SIZE].top + 1); - gfx_draw_string_left(dpi, STR_BASE_HEIGHT_LABEL, NULL, textColour, w->x + 4, w->y + w->widgets[WIDX_BASE_HEIGHT].top + 1); - gfx_draw_string_left(dpi, STR_WATER_LEVEL_LABEL, NULL, textColour, w->x + 4, w->y + w->widgets[WIDX_WATER_LEVEL].top + 1); - gfx_draw_string_left(dpi, STR_TERRAIN_LABEL, NULL, textColour, w->x + 4, w->y + w->widgets[WIDX_FLOOR_TEXTURE].top + 1); + gfx_draw_string_left(dpi, STR_MAP_SIZE, nullptr, textColour, w->x + 4, w->y + w->widgets[WIDX_MAP_SIZE].top + 1); + gfx_draw_string_left(dpi, STR_BASE_HEIGHT_LABEL, nullptr, textColour, w->x + 4, w->y + w->widgets[WIDX_BASE_HEIGHT].top + 1); + gfx_draw_string_left(dpi, STR_WATER_LEVEL_LABEL, nullptr, textColour, w->x + 4, w->y + w->widgets[WIDX_WATER_LEVEL].top + 1); + gfx_draw_string_left(dpi, STR_TERRAIN_LABEL, nullptr, textColour, w->x + 4, w->y + w->widgets[WIDX_FLOOR_TEXTURE].top + 1); // The practical map size is 2 lower than the technical map size rct_xy16 mapSizeArgs = MakeXY16(_mapSize - 2, _mapSize -2); @@ -1051,12 +1051,12 @@ static void window_mapgen_simplex_paint(rct_window *w, rct_drawpixelinfo *dpi) const uint8 textColour = w->colours[1]; - gfx_draw_string_left(dpi, STR_MAPGEN_SIMPLEX_NOISE_LOW_, NULL, textColour, w->x + 5, w->y + w->widgets[WIDX_SIMPLEX_LOW].top + 1); - gfx_draw_string_left(dpi, STR_MAPGEN_SIMPLEX_NOISE_HIGH, NULL, textColour, w->x + 5, w->y + w->widgets[WIDX_SIMPLEX_HIGH].top + 1); - gfx_draw_string_left(dpi, STR_MAPGEN_SIMPLEX_NOISE_BASE_FREQUENCY, NULL, textColour, w->x + 5, w->y + w->widgets[WIDX_SIMPLEX_BASE_FREQ].top + 1); - gfx_draw_string_left(dpi, STR_MAPGEN_SIMPLEX_NOISE_OCTAVES, NULL, textColour, w->x + 5, w->y + w->widgets[WIDX_SIMPLEX_OCTAVES].top + 1); - gfx_draw_string_left(dpi, STR_MAP_SIZE, NULL, textColour, w->x + 5, w->y + w->widgets[WIDX_SIMPLEX_MAP_SIZE].top + 1); - gfx_draw_string_left(dpi, STR_WATER_LEVEL_LABEL, NULL, textColour, w->x + 5, w->y + w->widgets[WIDX_SIMPLEX_WATER_LEVEL].top + 1); + gfx_draw_string_left(dpi, STR_MAPGEN_SIMPLEX_NOISE_LOW_, nullptr, textColour, w->x + 5, w->y + w->widgets[WIDX_SIMPLEX_LOW].top + 1); + gfx_draw_string_left(dpi, STR_MAPGEN_SIMPLEX_NOISE_HIGH, nullptr, textColour, w->x + 5, w->y + w->widgets[WIDX_SIMPLEX_HIGH].top + 1); + gfx_draw_string_left(dpi, STR_MAPGEN_SIMPLEX_NOISE_BASE_FREQUENCY, nullptr, textColour, w->x + 5, w->y + w->widgets[WIDX_SIMPLEX_BASE_FREQ].top + 1); + gfx_draw_string_left(dpi, STR_MAPGEN_SIMPLEX_NOISE_OCTAVES, nullptr, textColour, w->x + 5, w->y + w->widgets[WIDX_SIMPLEX_OCTAVES].top + 1); + gfx_draw_string_left(dpi, STR_MAP_SIZE, nullptr, textColour, w->x + 5, w->y + w->widgets[WIDX_SIMPLEX_MAP_SIZE].top + 1); + gfx_draw_string_left(dpi, STR_WATER_LEVEL_LABEL, nullptr, textColour, w->x + 5, w->y + w->widgets[WIDX_SIMPLEX_WATER_LEVEL].top + 1); gfx_draw_string_left(dpi, STR_COMMA16, &_simplex_low, textColour, w->x + w->widgets[WIDX_SIMPLEX_LOW].left + 1, w->y + w->widgets[WIDX_SIMPLEX_LOW].top + 1); gfx_draw_string_left(dpi, STR_COMMA16, &_simplex_high, textColour, w->x + w->widgets[WIDX_SIMPLEX_HIGH].left + 1, w->y + w->widgets[WIDX_SIMPLEX_HIGH].top + 1); @@ -1162,7 +1162,7 @@ static void window_mapgen_heightmap_mouseup(rct_window *w, rct_widgetindex widge // Page widgets case WIDX_HEIGHTMAP_SELECT: - window_loadsave_open(LOADSAVETYPE_LOAD | LOADSAVETYPE_IMAGE, NULL); + window_loadsave_open(LOADSAVETYPE_LOAD | LOADSAVETYPE_IMAGE, nullptr); window_loadsave_set_loadsave_callback(window_mapgen_heightmap_loadsave_callback); return; case WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP: @@ -1216,23 +1216,23 @@ static void window_mapgen_heightmap_paint(rct_window *w, rct_drawpixelinfo *dpi) // Smooth strength label and value const uint8 strengthColour = _heightmapSmoothMap ? enabledColour : disabledColour; sint16 strength = _heightmapSmoothStrength; - gfx_draw_string_left(dpi, STR_MAPGEN_SMOOTH_STRENGTH, NULL, strengthColour, w->x + 5, w->y + w->widgets[WIDX_HEIGHTMAP_STRENGTH].top + 1); + gfx_draw_string_left(dpi, STR_MAPGEN_SMOOTH_STRENGTH, nullptr, strengthColour, w->x + 5, w->y + w->widgets[WIDX_HEIGHTMAP_STRENGTH].top + 1); gfx_draw_string_left(dpi, STR_COMMA16, &strength, strengthColour, w->x + w->widgets[WIDX_HEIGHTMAP_STRENGTH].left + 1, w->y + w->widgets[WIDX_HEIGHTMAP_STRENGTH].top + 1); // Low label and value const uint8 labelColour = _heightmapLoaded ? enabledColour : disabledColour; sint16 low = _heightmapLow; - gfx_draw_string_left(dpi, STR_MAPGEN_SIMPLEX_NOISE_LOW_, NULL, labelColour, w->x + 5, w->y + w->widgets[WIDX_HEIGHTMAP_LOW].top + 1); + gfx_draw_string_left(dpi, STR_MAPGEN_SIMPLEX_NOISE_LOW_, nullptr, labelColour, w->x + 5, w->y + w->widgets[WIDX_HEIGHTMAP_LOW].top + 1); gfx_draw_string_left(dpi, STR_COMMA16, &low, labelColour, w->x + w->widgets[WIDX_HEIGHTMAP_LOW].left + 1, w->y + w->widgets[WIDX_HEIGHTMAP_LOW].top + 1); // High label and value sint16 high = _heightmapHigh; - gfx_draw_string_left(dpi, STR_MAPGEN_SIMPLEX_NOISE_HIGH, NULL, labelColour, w->x + 5, w->y + w->widgets[WIDX_HEIGHTMAP_HIGH].top + 1); + gfx_draw_string_left(dpi, STR_MAPGEN_SIMPLEX_NOISE_HIGH, nullptr, labelColour, w->x + 5, w->y + w->widgets[WIDX_HEIGHTMAP_HIGH].top + 1); gfx_draw_string_left(dpi, STR_COMMA16, &high, labelColour, w->x + w->widgets[WIDX_HEIGHTMAP_HIGH].left + 1, w->y + w->widgets[WIDX_HEIGHTMAP_HIGH].top + 1); // Water level label and value sint16 waterLevel = _waterLevel; - gfx_draw_string_left(dpi, STR_WATER_LEVEL_LABEL, NULL, labelColour, w->x + 5, w->y + w->widgets[WIDX_HEIGHTMAP_WATER_LEVEL].top + 1); + gfx_draw_string_left(dpi, STR_WATER_LEVEL_LABEL, nullptr, labelColour, w->x + 5, w->y + w->widgets[WIDX_HEIGHTMAP_WATER_LEVEL].top + 1); gfx_draw_string_left(dpi, STR_COMMA16, &waterLevel, labelColour, w->x + w->widgets[WIDX_HEIGHTMAP_WATER_LEVEL].left + 1, w->y + w->widgets[WIDX_HEIGHTMAP_WATER_LEVEL].top + 1); } @@ -1244,9 +1244,9 @@ static void window_mapgen_set_page(rct_window *w, sint32 page) { w->page = page; w->frame_no = 0; - if (w->viewport != NULL) { + if (w->viewport != nullptr) { w->viewport->width = 0; - w->viewport = NULL; + w->viewport = nullptr; } w->enabled_widgets = PageEnabledWidgets[page]; diff --git a/src/openrct2-ui/windows/Multiplayer.cpp b/src/openrct2-ui/windows/Multiplayer.cpp index c55c72ddda..39ce902cdb 100644 --- a/src/openrct2-ui/windows/Multiplayer.cpp +++ b/src/openrct2-ui/windows/Multiplayer.cpp @@ -154,127 +154,127 @@ static void window_multiplayer_options_invalidate(rct_window *w); static void window_multiplayer_options_paint(rct_window *w, rct_drawpixelinfo *dpi); static rct_window_event_list window_multiplayer_information_events = { - NULL, + nullptr, window_multiplayer_information_mouseup, window_multiplayer_information_resize, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_multiplayer_information_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_multiplayer_information_invalidate, window_multiplayer_information_paint, - NULL + nullptr }; static rct_window_event_list window_multiplayer_players_events = { - NULL, + nullptr, window_multiplayer_players_mouseup, window_multiplayer_players_resize, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_multiplayer_players_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_multiplayer_players_scrollgetsize, window_multiplayer_players_scrollmousedown, - NULL, + nullptr, window_multiplayer_players_scrollmouseover, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_multiplayer_players_invalidate, window_multiplayer_players_paint, window_multiplayer_players_scrollpaint }; static rct_window_event_list window_multiplayer_groups_events = { - NULL, + nullptr, window_multiplayer_groups_mouseup, window_multiplayer_groups_resize, window_multiplayer_groups_mousedown, window_multiplayer_groups_dropdown, - NULL, + nullptr, window_multiplayer_groups_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_multiplayer_groups_scrollgetsize, window_multiplayer_groups_scrollmousedown, - NULL, + nullptr, window_multiplayer_groups_scrollmouseover, window_multiplayer_groups_text_input, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_multiplayer_groups_invalidate, window_multiplayer_groups_paint, window_multiplayer_groups_scrollpaint }; static rct_window_event_list window_multiplayer_options_events = { - NULL, + nullptr, window_multiplayer_options_mouseup, window_multiplayer_options_resize, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_multiplayer_options_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_multiplayer_options_invalidate, window_multiplayer_options_paint, - NULL + nullptr }; static rct_window_event_list *window_multiplayer_page_events[] = { @@ -297,7 +297,7 @@ rct_window * window_multiplayer_open() { // Check if window is already open rct_window *window = window_bring_to_front_by_class(WC_MULTIPLAYER); - if (window == NULL) { + if (window == nullptr) { window = window_create_auto_pos(320, 144, &window_multiplayer_players_events, WC_MULTIPLAYER, WF_10 | WF_RESIZABLE); window_multiplayer_set_page(window, WINDOW_MULTIPLAYER_PAGE_INFORMATION); } @@ -585,10 +585,10 @@ static void window_multiplayer_players_paint(rct_window *w, rct_drawpixelinfo *d window_multiplayer_draw_tab_images(w, dpi); // Columns - gfx_draw_string_left(dpi, STR_PLAYER, NULL, w->colours[2], w->x + 6, 58 - 12 + w->y + 1); - gfx_draw_string_left(dpi, STR_GROUP, NULL, w->colours[2], w->x + 180, 58 - 12 + w->y + 1); - gfx_draw_string_left(dpi, STR_LAST_ACTION, NULL, w->colours[2], w->x + 263, 58 - 12 + w->y + 1); - gfx_draw_string_left(dpi, STR_PING, NULL, w->colours[2], w->x + 363, 58 - 12 + w->y + 1); + gfx_draw_string_left(dpi, STR_PLAYER, nullptr, w->colours[2], w->x + 6, 58 - 12 + w->y + 1); + gfx_draw_string_left(dpi, STR_GROUP, nullptr, w->colours[2], w->x + 180, 58 - 12 + w->y + 1); + gfx_draw_string_left(dpi, STR_LAST_ACTION, nullptr, w->colours[2], w->x + 263, 58 - 12 + w->y + 1); + gfx_draw_string_left(dpi, STR_PING, nullptr, w->colours[2], w->x + 363, 58 - 12 + w->y + 1); // Number of players stringId = w->no_list_items == 1 ? STR_MULTIPLAYER_PLAYER_COUNT : STR_MULTIPLAYER_PLAYER_COUNT_PLURAL; @@ -793,7 +793,7 @@ static void window_multiplayer_groups_text_input(rct_window *w, rct_widgetindex if (widgetIndex != WIDX_RENAME_GROUP) return; - if (text == NULL) + if (text == nullptr) return; game_do_command(3 | (_selectedGroup << 8) | (1 << 16), GAME_COMMAND_FLAG_APPLY, w->number, *((sint32*)(text + 0)), GAME_COMMAND_MODIFY_GROUPS, *((sint32*)(text + 8)), *((sint32*)(text + 4))); @@ -843,7 +843,7 @@ static void window_multiplayer_groups_paint(rct_window *w, rct_drawpixelinfo *dp sint32 x = w->x + window_multiplayer_groups_widgets[WIDX_CONTENT_PANEL].left + 4; sint32 y = w->y + window_multiplayer_groups_widgets[WIDX_CONTENT_PANEL].top + 4; - gfx_draw_string_left(dpi, STR_DEFAULT_GROUP, NULL, w->colours[2], x, y); + gfx_draw_string_left(dpi, STR_DEFAULT_GROUP, nullptr, w->colours[2], x, y); y += 20; diff --git a/src/openrct2-ui/windows/MusicCredits.cpp b/src/openrct2-ui/windows/MusicCredits.cpp index 63a7e86b10..84391c1cfe 100644 --- a/src/openrct2-ui/windows/MusicCredits.cpp +++ b/src/openrct2-ui/windows/MusicCredits.cpp @@ -92,32 +92,32 @@ static void window_music_credits_paint(rct_window *w, rct_drawpixelinfo *dpi); static void window_music_credits_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint32 scrollIndex); static rct_window_event_list window_music_credits_events = { - NULL, + nullptr, window_music_credits_mouseup, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_music_credits_scrollgetsize, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_music_credits_paint, window_music_credits_scrollpaint }; @@ -132,7 +132,7 @@ rct_window * window_music_credits_open() // Check if window is already open window = window_bring_to_front_by_class(WC_MUSIC_CREDITS); - if (window != NULL) + if (window != nullptr) return window; window = window_create_centred( @@ -196,13 +196,13 @@ static void window_music_credits_scrollpaint(rct_window *w, rct_drawpixelinfo *d sint32 y = 2; for (size_t i = 0; i < Util::CountOf(music_credits); i++) { - gfx_draw_string_centred(dpi, music_credits[i], x, y, COLOUR_BLACK, NULL); + gfx_draw_string_centred(dpi, music_credits[i], x, y, COLOUR_BLACK, nullptr); y += 10; } // Add 4 more space before "Original recordings ...". y += 4; - gfx_draw_string_centred(dpi, STR_MUSIC_ACKNOWLEDGEMENTS_ORIGINAL_RECORDINGS, x, y, COLOUR_BLACK, NULL); + gfx_draw_string_centred(dpi, STR_MUSIC_ACKNOWLEDGEMENTS_ORIGINAL_RECORDINGS, x, y, COLOUR_BLACK, nullptr); y += 10; // Draw the separator @@ -211,7 +211,7 @@ static void window_music_credits_scrollpaint(rct_window *w, rct_drawpixelinfo *d y += 11; for (size_t i = 0; i < Util::CountOf(music_credits_rct2); i++) { - gfx_draw_string_centred(dpi, music_credits_rct2[i], x, y, COLOUR_BLACK, NULL); + gfx_draw_string_centred(dpi, music_credits_rct2[i], x, y, COLOUR_BLACK, nullptr); y += 10; } diff --git a/src/openrct2-ui/windows/News.cpp b/src/openrct2-ui/windows/News.cpp index c1af5fbf62..f5af0e7623 100644 --- a/src/openrct2-ui/windows/News.cpp +++ b/src/openrct2-ui/windows/News.cpp @@ -55,32 +55,32 @@ static void window_news_paint(rct_window *w, rct_drawpixelinfo *dpi); static void window_news_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint32 scrollIndex); static rct_window_event_list window_news_events = { - NULL, + nullptr, window_news_mouseup, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_news_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_news_scrollgetsize, window_news_scrollmousedown, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_news_tooltip, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_news_paint, window_news_scrollpaint }; @@ -95,7 +95,7 @@ rct_window * window_news_open() // Check if window is already open window = window_bring_to_front_by_class(WC_RECENT_NEWS); - if (window == NULL) { + if (window == nullptr) { window = window_create_auto_pos( 400, 300, @@ -171,7 +171,7 @@ static void window_news_update(rct_window *w) else if (w->news.var_482 > 1) { news_item_get_subject_location(newsItem->Type, newsItem->Assoc, &x, &y, &z); if (x != SPRITE_LOCATION_NULL) - if ((w = window_get_main()) != NULL) + if ((w = window_get_main()) != nullptr) window_scroll_to_location(w, x, y, z); return; } diff --git a/src/openrct2-ui/windows/NewsOptions.cpp b/src/openrct2-ui/windows/NewsOptions.cpp index 874d41898d..38e59c06ad 100644 --- a/src/openrct2-ui/windows/NewsOptions.cpp +++ b/src/openrct2-ui/windows/NewsOptions.cpp @@ -96,34 +96,34 @@ static void window_news_options_invalidate(rct_window *w); static void window_news_options_paint(rct_window *w, rct_drawpixelinfo *dpi); static rct_window_event_list window_news_options_events = { - NULL, + nullptr, window_news_options_mouseup, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_news_options_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_news_options_invalidate, window_news_options_paint, - NULL + nullptr }; static void window_news_options_set_page(rct_window *w, sint32 page); @@ -136,7 +136,7 @@ rct_window * window_news_options_open() // Check if window is already open window = window_bring_to_front_by_class(WC_NOTIFICATION_OPTIONS); - if (window == NULL) { + if (window == nullptr) { window = window_create_centred( 400, 300, diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp index 6a935decca..3710906103 100644 --- a/src/openrct2-ui/windows/Options.cpp +++ b/src/openrct2-ui/windows/Options.cpp @@ -423,32 +423,32 @@ static void window_options_tooltip(rct_window *w, rct_widgetindex widgetIndex, r static rct_window_event_list window_options_events = { window_options_close, window_options_mouseup, - NULL, + nullptr, window_options_mousedown, window_options_dropdown, - NULL, + nullptr, window_options_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_options_scrollgetsize, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_options_text_input, - NULL, - NULL, + nullptr, + nullptr, window_options_tooltip, - NULL, - NULL, + nullptr, + nullptr, window_options_invalidate, window_options_paint, - NULL + nullptr }; #pragma endregion @@ -574,7 +574,7 @@ static uint64 window_options_page_enabled_widgets[] = { #pragma endregion -static struct Resolution * _resolutions = NULL; +static struct Resolution * _resolutions = nullptr; static sint32 _numResolutions = 0; /** @@ -587,7 +587,7 @@ rct_window * window_options_open() // Check if window is already open w = window_bring_to_front_by_class(WC_OPTIONS); - if (w != NULL) + if (w != nullptr) return w; w = window_create_centred(WW, WH, &window_options_events, WC_OPTIONS, 0); @@ -603,7 +603,7 @@ rct_window * window_options_open() static void window_options_close(rct_window *w) { free(_resolutions); - _resolutions = NULL; + _resolutions = nullptr; _numResolutions = 0; } @@ -673,7 +673,7 @@ static void window_options_mouseup(rct_window *w, rct_widgetindex widgetIndex) gConfigGeneral.always_show_gridlines ^= 1; config_save_default(); gfx_invalidate_screen(); - if ((w = window_get_main()) != NULL) { + if ((w = window_get_main()) != nullptr) { if (gConfigGeneral.always_show_gridlines) w->viewport->flags |= VIEWPORT_FLAG_GRIDLINES; else @@ -1418,8 +1418,8 @@ static void window_options_dropdown(rct_window *w, rct_widgetindex widgetIndex, audio_init_ride_sounds(dropdownIndex); if (dropdownIndex < gAudioDeviceCount) { if (dropdownIndex == 0) { - Mixer_Init(NULL); - gConfigSound.device = NULL; + Mixer_Init(nullptr); + gConfigSound.device = nullptr; } else { char* devicename = gAudioDevices[dropdownIndex].name; @@ -1837,7 +1837,7 @@ static void window_options_paint(rct_window *w, rct_drawpixelinfo *dpi) gfx_draw_string_left_clipped( dpi, DrawingEngineStringIds[gConfigGeneral.drawing_engine], - NULL, + nullptr, w->colours[1], w->x + window_options_culture_widgets[WIDX_DRAWING_ENGINE].left + 1, w->y + window_options_culture_widgets[WIDX_DRAWING_ENGINE].top, @@ -1877,7 +1877,7 @@ static void window_options_paint(rct_window *w, rct_drawpixelinfo *dpi) gfx_draw_string_left( dpi, DateFormatStringIds[gConfigGeneral.date_format], - NULL, + nullptr, w->colours[1], w->x + window_options_culture_widgets[WIDX_DATE_FORMAT].left + 1, w->y + window_options_culture_widgets[WIDX_DATE_FORMAT].top @@ -1887,7 +1887,7 @@ static void window_options_paint(rct_window *w, rct_drawpixelinfo *dpi) { // Sound device rct_string_id audioDeviceStringId = STR_OPTIONS_SOUND_VALUE_DEFAULT; - const char * audioDeviceName = NULL; + const char * audioDeviceName = nullptr; if (gAudioCurrentDevice == -1) { audioDeviceStringId = STR_SOUND_NONE; } else { @@ -1915,7 +1915,7 @@ static void window_options_paint(rct_window *w, rct_drawpixelinfo *dpi) gfx_draw_string_left( dpi, window_options_title_music_names[gConfigSound.title_music], - NULL, + nullptr, w->colours[1], w->x + window_options_audio_widgets[WIDX_TITLE_MUSIC].left + 1, w->y + window_options_audio_widgets[WIDX_TITLE_MUSIC].top @@ -1930,7 +1930,7 @@ static void window_options_paint(rct_window *w, rct_drawpixelinfo *dpi) const utf8 * activeThemeName = theme_manager_get_available_theme_name(activeAvailableThemeIndex); set_format_arg(0, uintptr_t, (uintptr_t)activeThemeName); - gfx_draw_string_left(dpi, STR_THEMES_LABEL_CURRENT_THEME, NULL, w->colours[1], w->x + 10, w->y + window_options_controls_and_interface_widgets[WIDX_THEMES].top + 1); + gfx_draw_string_left(dpi, STR_THEMES_LABEL_CURRENT_THEME, nullptr, w->colours[1], w->x + 10, w->y + window_options_controls_and_interface_widgets[WIDX_THEMES].top + 1); gfx_draw_string_left_clipped( dpi, STR_STRING, @@ -1940,13 +1940,13 @@ static void window_options_paint(rct_window *w, rct_drawpixelinfo *dpi) w->y + window_options_controls_and_interface_widgets[WIDX_THEMES].top, window_options_controls_and_interface_widgets[WIDX_THEMES_DROPDOWN].left - window_options_controls_and_interface_widgets[WIDX_THEMES].left - 4 ); - gfx_draw_string_left(dpi, STR_OPTIONS_SCENARIO_GROUPING, NULL, w->colours[1], w->x + 10, w->y + window_options_controls_and_interface_widgets[WIDX_SCENARIO_GROUPING].top + 1); + gfx_draw_string_left(dpi, STR_OPTIONS_SCENARIO_GROUPING, nullptr, w->colours[1], w->x + 10, w->y + window_options_controls_and_interface_widgets[WIDX_SCENARIO_GROUPING].top + 1); gfx_draw_string_left_clipped( dpi, gConfigGeneral.scenario_select_mode == SCENARIO_SELECT_MODE_DIFFICULTY ? STR_OPTIONS_SCENARIO_DIFFICULTY : STR_OPTIONS_SCENARIO_ORIGIN, - NULL, + nullptr, w->colours[1], w->x + window_options_controls_and_interface_widgets[WIDX_SCENARIO_GROUPING].left + 1, w->y + window_options_controls_and_interface_widgets[WIDX_SCENARIO_GROUPING].top, @@ -1960,7 +1960,7 @@ static void window_options_paint(rct_window *w, rct_drawpixelinfo *dpi) gfx_draw_string_left( dpi, window_options_autosave_names[gConfigGeneral.autosave_frequency], - NULL, + nullptr, w->colours[1], w->x + window_options_misc_widgets[WIDX_AUTOSAVE].left + 1, w->y + window_options_misc_widgets[WIDX_AUTOSAVE].top @@ -1983,7 +1983,7 @@ static void window_options_paint(rct_window *w, rct_drawpixelinfo *dpi) gfx_draw_string_left( dpi, RideInspectionIntervalNames[gConfigGeneral.default_inspection_interval], - NULL, + nullptr, w->colours[1], w->x + window_options_misc_widgets[WIDX_DEFAULT_INSPECTION_INTERVAL].left + 1, w->y + window_options_misc_widgets[WIDX_DEFAULT_INSPECTION_INTERVAL].top @@ -2047,7 +2047,7 @@ static void window_options_scrollgetsize(rct_window *w, sint32 scrollIndex, sint static void window_options_text_input(rct_window *w, rct_widgetindex widgetIndex, char *text) { - if (text == NULL) + if (text == nullptr) return; if (widgetIndex == WIDX_CHANNEL_BUTTON) { diff --git a/src/openrct2-ui/windows/SavePrompt.cpp b/src/openrct2-ui/windows/SavePrompt.cpp index 7618f84853..6d9f1f0486 100644 --- a/src/openrct2-ui/windows/SavePrompt.cpp +++ b/src/openrct2-ui/windows/SavePrompt.cpp @@ -80,32 +80,32 @@ static void window_save_prompt_callback(sint32 result, const utf8 * path); static rct_window_event_list window_save_prompt_events = { window_save_prompt_close, window_save_prompt_mouseup, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_save_prompt_paint, - NULL + nullptr }; /** diff --git a/src/openrct2-ui/windows/ServerList.cpp b/src/openrct2-ui/windows/ServerList.cpp index dc4f5e4573..66438efeaf 100644 --- a/src/openrct2-ui/windows/ServerList.cpp +++ b/src/openrct2-ui/windows/ServerList.cpp @@ -40,7 +40,7 @@ extern "C" #define ITEM_HEIGHT (3 + 9 + 3) static char _playerName[32 + 1]; -static server_entry *_serverEntries = NULL; +static server_entry *_serverEntries = nullptr; static sint32 _numServerEntries = 0; static std::mutex _mutex; static uint32 _numPlayersOnline = 0; @@ -90,28 +90,28 @@ static rct_window_event_list window_server_list_events = { window_server_list_close, window_server_list_mouseup, window_server_list_resize, - NULL, + nullptr, window_server_list_dropdown, - NULL, + nullptr, window_server_list_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_server_list_scroll_getsize, window_server_list_scroll_mousedown, - NULL, + nullptr, window_server_list_scroll_mouseover, window_server_list_textinput, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_server_list_invalidate, window_server_list_paint, window_server_list_scrollpaint @@ -123,7 +123,7 @@ enum { }; static sint32 _hoverButtonIndex = -1; -static char * _version = NULL; +static char * _version = nullptr; static void server_list_get_item_button(sint32 buttonIndex, sint32 x, sint32 y, sint32 width, sint32 *outX, sint32 *outY); static void server_list_load_server_entries(); @@ -145,7 +145,7 @@ rct_window * window_server_list_open() // Check if window is already open window = window_bring_to_front_by_class(WC_SERVER_LIST); - if (window != NULL) + if (window != nullptr) return window; window = window_create_centred(WWIDTH_MIN, WHEIGHT_MIN, &window_server_list_events, WC_SERVER_LIST, WF_10 | WF_RESIZABLE); @@ -328,7 +328,7 @@ static void window_server_list_scroll_mouseover(rct_window *w, sint32 scrollInde static void window_server_list_textinput(rct_window *w, rct_widgetindex widgetIndex, char *text) { - if (text == NULL || text[0] == 0) return; + if (text == nullptr || text[0] == 0) return; switch (widgetIndex) { case WIDX_PLAYER_NAME_INPUT: @@ -396,7 +396,7 @@ static void window_server_list_paint(rct_window *w, rct_drawpixelinfo *dpi) { window_draw_widgets(w, dpi); - gfx_draw_string_left(dpi, STR_PLAYER_NAME, NULL, COLOUR_WHITE, w->x + 6, w->y + w->widgets[WIDX_PLAYER_NAME_INPUT].top); + gfx_draw_string_left(dpi, STR_PLAYER_NAME, nullptr, COLOUR_WHITE, w->x + 6, w->y + w->widgets[WIDX_PLAYER_NAME_INPUT].top); const char * version = NETWORK_STREAM_ID; gfx_draw_string_left(dpi, STR_NETWORK_VERSION, (void*)&version, COLOUR_WHITE, w->x + 324, w->y + w->widgets[WIDX_START_SERVER].top); @@ -525,7 +525,7 @@ static void server_list_save_server_entries() static void dispose_server_entry_list() { - if (_serverEntries != NULL) { + if (_serverEntries != nullptr) { for (sint32 i = 0; i < _numServerEntries; i++) { dispose_server_entry(&_serverEntries[i]); } @@ -551,7 +551,7 @@ static server_entry* add_server_entry(char *address) } _numServerEntries++; - if (_serverEntries == NULL) { + if (_serverEntries == nullptr) { _serverEntries = (server_entry *)malloc(_numServerEntries * sizeof(server_entry)); } else { _serverEntries = (server_entry *)realloc(_serverEntries, _numServerEntries * sizeof(server_entry)); @@ -612,7 +612,7 @@ static sint32 server_compare(const void *a, const void *b) static void sort_servers() { - if (_serverEntries == NULL) { + if (_serverEntries == nullptr) { return; } qsort(_serverEntries, _numServerEntries, sizeof(server_entry), server_compare); @@ -637,7 +637,7 @@ static void join_server(char *address) char *dot = strchr(address, '.'); char *colon = strrchr(address, ':'); - if (colon != NULL && (endbracket != NULL || dot != NULL)) { + if (colon != nullptr && (endbracket != nullptr || dot != nullptr)) { address = substr(address, (sint32)(colon - address)); sscanf(colon + 1, "%d", &port); addresscopied = true; @@ -689,7 +689,7 @@ static void fetch_servers() http_request_t request = {}; request.url = masterServerUrl; request.method = HTTP_METHOD_GET; - request.body = NULL; + request.body = nullptr; request.type = HTTP_DATA_JSON; http_request_async(&request, fetch_servers_callback); #endif @@ -698,7 +698,7 @@ static void fetch_servers() #ifndef DISABLE_HTTP static void fetch_servers_callback(http_response_t* response) { - if (response == NULL) { + if (response == nullptr) { log_warning("Unable to connect to master server"); return; } @@ -742,7 +742,7 @@ static void fetch_servers_callback(http_response_t* response) json_t *ip4 = json_object_get(ip, "v4"); json_t *addressIp = json_array_get(ip4, 0); - if (name == NULL || version == NULL) + if (name == nullptr || version == nullptr) { log_verbose("Cowardly refusing to add server without name or version specified."); continue; @@ -759,7 +759,7 @@ static void fetch_servers_callback(http_response_t* response) SafeFree(newserver->version); newserver->name = _strdup(json_string_value(name)); newserver->requiresPassword = json_is_true(requiresPassword); - newserver->description = _strdup(description == NULL ? "" : json_string_value(description)); + newserver->description = _strdup(description == nullptr ? "" : json_string_value(description)); newserver->version = _strdup(json_string_value(version)); newserver->players = (uint8)json_integer_value(players); newserver->maxplayers = (uint8)json_integer_value(maxPlayers); @@ -771,7 +771,7 @@ static void fetch_servers_callback(http_response_t* response) _numPlayersOnline = get_total_player_count(); rct_window *window = window_find_by_class(WC_SERVER_LIST); - if (window != NULL) { + if (window != nullptr) { window_invalidate(window); } } diff --git a/src/openrct2-ui/windows/ServerStart.cpp b/src/openrct2-ui/windows/ServerStart.cpp index 4721d5300e..d2b6ea5fc6 100644 --- a/src/openrct2-ui/windows/ServerStart.cpp +++ b/src/openrct2-ui/windows/ServerStart.cpp @@ -82,32 +82,32 @@ static void window_server_start_paint(rct_window *w, rct_drawpixelinfo *dpi); static rct_window_event_list window_server_start_events = { window_server_start_close, window_server_start_mouseup, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_server_start_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_server_start_textinput, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_server_start_invalidate, window_server_start_paint, - NULL + nullptr }; rct_window * window_server_start_open() @@ -116,7 +116,7 @@ rct_window * window_server_start_open() // Check if window is already open window = window_bring_to_front_by_class(WC_SERVER_START); - if (window != NULL) + if (window != nullptr) return window; window = window_create_centred(WW, WH, &window_server_start_events, WC_SERVER_START, WF_10); @@ -230,7 +230,7 @@ static void window_server_start_mouseup(rct_window *w, rct_widgetindex widgetInd break; case WIDX_LOAD_SERVER: network_set_password(_password); - window_loadsave_open(LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME, NULL); + window_loadsave_open(LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME, nullptr); window_loadsave_set_loadsave_callback(window_server_start_loadsave_callback); break; } @@ -249,7 +249,7 @@ static void window_server_start_update(rct_window *w) static void window_server_start_textinput(rct_window *w, rct_widgetindex widgetIndex, char *text) { - if (text == NULL) return; + if (text == nullptr) return; switch (widgetIndex) { case WIDX_PORT_INPUT: @@ -343,10 +343,10 @@ static void window_server_start_paint(rct_window *w, rct_drawpixelinfo *dpi) { window_draw_widgets(w, dpi); - gfx_draw_string_left(dpi, STR_PORT, NULL, w->colours[1], w->x + 6, w->y + w->widgets[WIDX_PORT_INPUT].top); - gfx_draw_string_left(dpi, STR_SERVER_NAME, NULL, w->colours[1], w->x + 6, w->y + w->widgets[WIDX_NAME_INPUT].top); - gfx_draw_string_left(dpi, STR_SERVER_DESCRIPTION, NULL, w->colours[1], w->x + 6, w->y + w->widgets[WIDX_DESCRIPTION_INPUT].top); - gfx_draw_string_left(dpi, STR_SERVER_GREETING, NULL, w->colours[1], w->x + 6, w->y + w->widgets[WIDX_GREETING_INPUT].top); - gfx_draw_string_left(dpi, STR_PASSWORD, NULL, w->colours[1], w->x + 6, w->y + w->widgets[WIDX_PASSWORD_INPUT].top); - gfx_draw_string_left(dpi, STR_MAX_PLAYERS, NULL, w->colours[1], w->x + 6, w->y + w->widgets[WIDX_MAXPLAYERS].top); + gfx_draw_string_left(dpi, STR_PORT, nullptr, w->colours[1], w->x + 6, w->y + w->widgets[WIDX_PORT_INPUT].top); + gfx_draw_string_left(dpi, STR_SERVER_NAME, nullptr, w->colours[1], w->x + 6, w->y + w->widgets[WIDX_NAME_INPUT].top); + gfx_draw_string_left(dpi, STR_SERVER_DESCRIPTION, nullptr, w->colours[1], w->x + 6, w->y + w->widgets[WIDX_DESCRIPTION_INPUT].top); + gfx_draw_string_left(dpi, STR_SERVER_GREETING, nullptr, w->colours[1], w->x + 6, w->y + w->widgets[WIDX_GREETING_INPUT].top); + gfx_draw_string_left(dpi, STR_PASSWORD, nullptr, w->colours[1], w->x + 6, w->y + w->widgets[WIDX_PASSWORD_INPUT].top); + gfx_draw_string_left(dpi, STR_MAX_PLAYERS, nullptr, w->colours[1], w->x + 6, w->y + w->widgets[WIDX_MAXPLAYERS].top); } diff --git a/src/openrct2-ui/windows/ShortcutKeyChange.cpp b/src/openrct2-ui/windows/ShortcutKeyChange.cpp index c21aaf4ba7..9730c1fbd6 100644 --- a/src/openrct2-ui/windows/ShortcutKeyChange.cpp +++ b/src/openrct2-ui/windows/ShortcutKeyChange.cpp @@ -47,34 +47,34 @@ static void window_shortcut_change_paint(rct_window *w, rct_drawpixelinfo *dpi); // 0x9A3F7C static rct_window_event_list window_shortcut_change_events = { - NULL, + nullptr, window_shortcut_change_mouseup, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_shortcut_change_paint, - NULL + nullptr }; rct_window * window_shortcut_change_open(sint32 selected_key) diff --git a/src/openrct2-ui/windows/ShortcutKeys.cpp b/src/openrct2-ui/windows/ShortcutKeys.cpp index 92b23c2e56..151b2d3d78 100644 --- a/src/openrct2-ui/windows/ShortcutKeys.cpp +++ b/src/openrct2-ui/windows/ShortcutKeys.cpp @@ -59,31 +59,31 @@ static void window_shortcut_scrollmouseover(rct_window *w, sint32 scrollIndex, s static void window_shortcut_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint32 scrollIndex); static rct_window_event_list window_shortcut_events = { - NULL, + nullptr, window_shortcut_mouseup, window_shortcut_resize, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_shortcut_scrollgetsize, window_shortcut_scrollmousedown, - NULL, + nullptr, window_shortcut_scrollmouseover, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_shortcut_tooltip, - NULL, - NULL, + nullptr, + nullptr, window_shortcut_invalidate, window_shortcut_paint, window_shortcut_scrollpaint @@ -166,7 +166,7 @@ const rct_string_id ShortcutStringIds[SHORTCUT_COUNT] = { rct_window * window_shortcut_keys_open() { rct_window * w = window_bring_to_front_by_class(WC_KEYBOARD_SHORTCUT_LIST); - if (w == NULL) + if (w == nullptr) { w = window_create_auto_pos(WW, WH, &window_shortcut_events, WC_KEYBOARD_SHORTCUT_LIST, WF_RESIZABLE); diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index 6b5a003be7..6409d5a297 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -64,26 +64,26 @@ static rct_window_event_list window_staff_list_events = { window_staff_list_resize, window_staff_list_mousedown, window_staff_list_dropdown, - NULL, + nullptr, window_staff_list_update, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_staff_list_tooldown, - NULL, - NULL, + nullptr, + nullptr, window_staff_list_toolabort, - NULL, + nullptr, window_staff_list_scrollgetsize, window_staff_list_scrollmousedown, - NULL, + nullptr, window_staff_list_scrollmouseover, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_staff_list_tooltip, - NULL, - NULL, + nullptr, + nullptr, window_staff_list_invalidate, window_staff_list_paint, window_staff_list_scrollpaint, @@ -158,7 +158,7 @@ rct_window * window_staff_list_open() // Check if window is already open window = window_bring_to_front_by_class(WC_STAFF_LIST); - if (window != NULL) + if (window != nullptr) return window; window = window_create_auto_pos(WW, WH, &window_staff_list_events, WC_STAFF_LIST, WF_10 | WF_RESIZABLE); @@ -313,7 +313,7 @@ void window_staff_list_update(rct_window *w) widget_invalidate(w, WIDX_STAFF_LIST_HANDYMEN_TAB + _windowStaffListSelectedTab); // Enable highlighting of these staff members in map window - if (window_find_by_class(WC_MAP) != NULL) { + if (window_find_by_class(WC_MAP) != nullptr) { sint32 spriteIndex; rct_peep * peep; gWindowMapFlashingFlags |= (1 << 2); @@ -346,7 +346,7 @@ static void window_staff_list_tooldown(rct_window *w, rct_widgetindex widgetInde bool isPatrolAreaSet = staff_is_patrol_area_set(200 + selectedPeepType, x, y); uint16 spriteIndex; - rct_peep *peep, *closestPeep = NULL; + rct_peep *peep, *closestPeep = nullptr; sint32 closestPeepDistance = INT_MAX; FOR_ALL_STAFF(spriteIndex, peep) { if (peep->staff_type != selectedPeepType) @@ -372,7 +372,7 @@ static void window_staff_list_tooldown(rct_window *w, rct_widgetindex widgetInde } } - if (closestPeep != NULL) { + if (closestPeep != nullptr) { tool_cancel(); rct_window *staffWindow = window_staff_open(closestPeep); window_event_dropdown_call(staffWindow, WC_PEEP__WIDX_PATROL, 0); diff --git a/src/openrct2-ui/windows/Themes.cpp b/src/openrct2-ui/windows/Themes.cpp index baf9055389..c87950f652 100644 --- a/src/openrct2-ui/windows/Themes.cpp +++ b/src/openrct2-ui/windows/Themes.cpp @@ -59,31 +59,31 @@ static void window_themes_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sin static void window_themes_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w); static rct_window_event_list window_themes_events = { - NULL, + nullptr, window_themes_mouseup, window_themes_resize, window_themes_mousedown, window_themes_dropdown, - NULL, + nullptr, window_themes_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_themes_scrollgetsize, window_themes_scrollmousedown, - NULL, + nullptr, window_themes_scrollmouseover, window_themes_textinput, - NULL, - NULL, + nullptr, + nullptr, window_themes_tooltip, - NULL, - NULL, + nullptr, + nullptr, window_themes_invalidate, window_themes_paint, window_themes_scrollpaint, @@ -257,7 +257,7 @@ static rct_windowclass window_themes_tab_7_classes[] = { }; static rct_windowclass *window_themes_tab_classes[] = { - NULL, + nullptr, window_themes_tab_1_classes, window_themes_tab_2_classes, window_themes_tab_3_classes, @@ -316,7 +316,7 @@ rct_window * window_themes_open() // Check if window is already open window = window_bring_to_front_by_class(WC_THEMES); - if (window != NULL) + if (window != nullptr) return window; window = window_create_auto_pos(320, 107, &window_themes_events, WC_THEMES, WF_10 | WF_RESIZABLE); @@ -646,7 +646,7 @@ void window_themes_scrollmouseover(rct_window *w, sint32 scrollIndex, sint32 x, static void window_themes_textinput(rct_window *w, rct_widgetindex widgetIndex, char *text) { - if (text == NULL || text[0] == 0) + if (text == nullptr || text[0] == 0) return; switch (widgetIndex) { @@ -702,7 +702,7 @@ void window_themes_invalidate(rct_window *w) w->pressed_widgets = pressed_widgets | (1 << widgetIndex); - if (window_find_by_class(WC_DROPDOWN) == NULL) { + if (window_find_by_class(WC_DROPDOWN) == nullptr) { _colour_index_1 = -1; _colour_index_2 = -1; } @@ -778,7 +778,7 @@ void window_themes_paint(rct_window *w, rct_drawpixelinfo *dpi) size_t activeAvailableThemeIndex = theme_manager_get_active_available_theme_index(); const utf8 * activeThemeName = theme_manager_get_available_theme_name(activeAvailableThemeIndex); set_format_arg(0, uintptr_t, (uintptr_t)activeThemeName); - gfx_draw_string_left(dpi, STR_THEMES_LABEL_CURRENT_THEME, NULL, w->colours[1], w->x + 10, w->y + window_themes_widgets[WIDX_THEMES_PRESETS].top + 1); + gfx_draw_string_left(dpi, STR_THEMES_LABEL_CURRENT_THEME, nullptr, w->colours[1], w->x + 10, w->y + window_themes_widgets[WIDX_THEMES_PRESETS].top + 1); gfx_draw_string_left_clipped( dpi, STR_STRING, @@ -837,7 +837,7 @@ void window_themes_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint32 scr rct_windowclass wc = get_window_class_tab_index(i); sint32 numColours = theme_desc_get_num_colours(wc); for (uint8 j = 0; j < numColours; j++) { - gfx_draw_string_left(dpi, theme_desc_get_name(wc), NULL, w->colours[1], 2, y + 4); + gfx_draw_string_left(dpi, theme_desc_get_name(wc), nullptr, w->colours[1], 2, y + 4); uint8 colour = theme_get_colour(wc, j); uint32 image = SPRITE_ID_PALETTE_COLOUR_1(colour & ~COLOUR_FLAG_TRANSLUCENT) | IMAGE_TYPE_TRANSPARENT | SPR_PALETTE_BTN; diff --git a/src/openrct2-ui/windows/TitleExit.cpp b/src/openrct2-ui/windows/TitleExit.cpp index 73030c98f7..dd467a9165 100644 --- a/src/openrct2-ui/windows/TitleExit.cpp +++ b/src/openrct2-ui/windows/TitleExit.cpp @@ -39,34 +39,34 @@ static void window_title_exit_paint(rct_window *w, rct_drawpixelinfo *dpi); static void window_title_exit_mouseup(rct_window *w, rct_widgetindex widgetIndex); static rct_window_event_list window_title_exit_events = { - NULL, + nullptr, window_title_exit_mouseup, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_title_exit_paint, - NULL + nullptr }; /** diff --git a/src/openrct2-ui/windows/TitleLogo.cpp b/src/openrct2-ui/windows/TitleLogo.cpp index 8c895451e3..5ec96a3d21 100644 --- a/src/openrct2-ui/windows/TitleLogo.cpp +++ b/src/openrct2-ui/windows/TitleLogo.cpp @@ -30,34 +30,34 @@ static rct_widget window_title_logo_widgets[] = { static void window_title_logo_paint(rct_window *w, rct_drawpixelinfo *dpi); static rct_window_event_list window_title_logo_events = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_title_logo_paint, - NULL + nullptr }; /** diff --git a/src/openrct2-ui/windows/TitleMenu.cpp b/src/openrct2-ui/windows/TitleMenu.cpp index 8383bf1d27..99ba4d4530 100644 --- a/src/openrct2-ui/windows/TitleMenu.cpp +++ b/src/openrct2-ui/windows/TitleMenu.cpp @@ -54,34 +54,34 @@ static void window_title_menu_cursor(rct_window *w, rct_widgetindex widgetIndex, static void window_title_menu_paint(rct_window *w, rct_drawpixelinfo *dpi); static rct_window_event_list window_title_menu_events = { - NULL, + nullptr, window_title_menu_mouseup, - NULL, + nullptr, window_title_menu_mousedown, window_title_menu_dropdown, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_title_menu_cursor, - NULL, - NULL, + nullptr, + nullptr, window_title_menu_paint, - NULL + nullptr }; /** @@ -141,12 +141,12 @@ static void window_title_menu_scenarioselect_callback(const utf8 *path) static void window_title_menu_mouseup(rct_window *w, rct_widgetindex widgetIndex) { - rct_window *windowToOpen = NULL; + rct_window *windowToOpen = nullptr; switch (widgetIndex) { case WIDX_START_NEW_GAME: windowToOpen = window_find_by_class(WC_SCENARIO_SELECT); - if (windowToOpen != NULL) { + if (windowToOpen != nullptr) { window_bring_to_front(windowToOpen); } else { @@ -157,7 +157,7 @@ static void window_title_menu_mouseup(rct_window *w, rct_widgetindex widgetIndex break; case WIDX_CONTINUE_SAVED_GAME: windowToOpen = window_find_by_class(WC_LOADSAVE); - if (windowToOpen != NULL) { + if (windowToOpen != nullptr) { window_bring_to_front(windowToOpen); } else { @@ -168,7 +168,7 @@ static void window_title_menu_mouseup(rct_window *w, rct_widgetindex widgetIndex break; case WIDX_MULTIPLAYER: windowToOpen = window_find_by_class(WC_SERVER_LIST); - if (windowToOpen != NULL) { + if (windowToOpen != nullptr) { window_bring_to_front(windowToOpen); } else { diff --git a/src/openrct2-ui/windows/TitleOptions.cpp b/src/openrct2-ui/windows/TitleOptions.cpp index 3155b22661..a5ab834e11 100644 --- a/src/openrct2-ui/windows/TitleOptions.cpp +++ b/src/openrct2-ui/windows/TitleOptions.cpp @@ -38,34 +38,34 @@ static void window_title_options_mouseup(rct_window *w, rct_widgetindex widgetIn static void window_title_options_paint(rct_window *w, rct_drawpixelinfo *dpi); static rct_window_event_list window_title_options_events = { - NULL, + nullptr, window_title_options_mouseup, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_title_options_paint, - NULL + nullptr }; /** diff --git a/src/openrct2-ui/windows/ViewClipping.cpp b/src/openrct2-ui/windows/ViewClipping.cpp index 817a500fc3..9f1f45579e 100644 --- a/src/openrct2-ui/windows/ViewClipping.cpp +++ b/src/openrct2-ui/windows/ViewClipping.cpp @@ -74,32 +74,32 @@ static void window_view_clipping_close(); static rct_window_event_list window_view_clipping_events = { window_view_clipping_close_button, window_view_clipping_mouseup, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_view_clipping_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_view_clipping_scrollgetsize, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_view_clipping_invalidate, window_view_clipping_paint, - NULL + nullptr }; #pragma endregion @@ -121,7 +121,7 @@ rct_window * window_view_clipping_open() // Check if window is already open window = window_find_by_class(WC_VIEW_CLIPPING); - if (window != NULL) { + if (window != nullptr) { return window; } @@ -143,7 +143,7 @@ rct_window * window_view_clipping_open() window_push_others_below(window); // Turn on view clipping when the window is opened. - if (mainWindow != NULL) { + if (mainWindow != nullptr) { mainWindow->viewport->flags |= VIEWPORT_FLAG_PAINT_CLIP_TO_HEIGHT; window_invalidate(mainWindow); } @@ -155,7 +155,7 @@ static void window_view_clipping_close() { // Turn off view clipping when the window is closed. rct_window *mainWindow = window_get_main(); - if (mainWindow != NULL) { + if (mainWindow != nullptr) { mainWindow->viewport->flags &= ~VIEWPORT_FLAG_PAINT_CLIP_TO_HEIGHT; window_invalidate(mainWindow); } @@ -179,7 +179,7 @@ static void window_view_clipping_mouseup(rct_window *w, rct_widgetindex widgetIn case WIDX_CLIP_HEIGHT_CHECKBOX: // Toggle height clipping. mainWindow = window_get_main(); - if (mainWindow != NULL) { + if (mainWindow != nullptr) { mainWindow->viewport->flags ^= VIEWPORT_FLAG_PAINT_CLIP_TO_HEIGHT; window_invalidate(mainWindow); } @@ -189,14 +189,14 @@ static void window_view_clipping_mouseup(rct_window *w, rct_widgetindex widgetIn if (gClipHeight < 255) window_view_clipping_set_clipheight(w, gClipHeight + 1); mainWindow = window_get_main(); - if (mainWindow != NULL) + if (mainWindow != nullptr) window_invalidate(mainWindow); break; case WIDX_CLIP_HEIGHT_DECREASE: if (gClipHeight > 0) window_view_clipping_set_clipheight(w, gClipHeight - 1); mainWindow = window_get_main(); - if (mainWindow != NULL) + if (mainWindow != nullptr) window_invalidate(mainWindow); break; case WIDX_CLIP_HEIGHT_VALUE: @@ -225,7 +225,7 @@ static void window_view_clipping_update(rct_window *w) // Update the main window accordingly. rct_window *mainWindow = window_get_main(); - if (mainWindow != NULL) { + if (mainWindow != nullptr) { window_invalidate(mainWindow); } } @@ -237,7 +237,7 @@ static void window_view_clipping_invalidate(rct_window *w) widget_scroll_update_thumbs(w, WIDX_CLIP_HEIGHT_SLIDER); rct_window *mainWindow = window_get_main(); - if (mainWindow != NULL) { + if (mainWindow != nullptr) { widget_set_checkbox_value(w, WIDX_CLIP_HEIGHT_CHECKBOX, mainWindow->viewport->flags & VIEWPORT_FLAG_PAINT_CLIP_TO_HEIGHT); } } @@ -249,7 +249,7 @@ static void window_view_clipping_paint(rct_window *w, rct_drawpixelinfo *dpi) // Clip height value sint32 x = w->x + 8; sint32 y = w->y + w->widgets[WIDX_CLIP_HEIGHT_VALUE].top; - gfx_draw_string_left(dpi, STR_VIEW_CLIPPING_HEIGHT_VALUE, NULL, w->colours[0], x, y); + gfx_draw_string_left(dpi, STR_VIEW_CLIPPING_HEIGHT_VALUE, nullptr, w->colours[0], x, y); x = w->x + w->widgets[WIDX_CLIP_HEIGHT_VALUE].left + 1; y = w->y + w->widgets[WIDX_CLIP_HEIGHT_VALUE].top; diff --git a/src/openrct2-ui/windows/Viewport.cpp b/src/openrct2-ui/windows/Viewport.cpp index 9c50de310a..10c9c50909 100644 --- a/src/openrct2-ui/windows/Viewport.cpp +++ b/src/openrct2-ui/windows/Viewport.cpp @@ -60,34 +60,34 @@ static void window_viewport_invalidate(rct_window *w); static void window_viewport_paint(rct_window *w, rct_drawpixelinfo *dpi); static rct_window_event_list window_viewport_events = { - NULL, + nullptr, window_viewport_mouseup, window_viewport_resize, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_viewport_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_viewport_invalidate, window_viewport_paint, - NULL + nullptr }; static sint32 _viewportNumber = 1; @@ -114,7 +114,7 @@ rct_window * window_viewport_open() // Create viewport viewport_create(w, w->x, w->y, w->width, w->height, 0, 128 * 32, 128 * 32, 0, 1, -1); rct_window *mainWindow = window_get_main(); - if (mainWindow != NULL) { + if (mainWindow != nullptr) { rct_viewport *mainViewport = mainWindow->viewport; sint32 x = mainViewport->view_x + (mainViewport->view_width / 2); sint32 y = mainViewport->view_y + (mainViewport->view_height / 2); @@ -148,21 +148,21 @@ static void window_viewport_mouseup(rct_window *w, rct_widgetindex widgetIndex) window_close(w); break; case WIDX_ZOOM_IN: - if (w->viewport != NULL && w->viewport->zoom > 0) { + if (w->viewport != nullptr && w->viewport->zoom > 0) { w->viewport->zoom--; window_invalidate(w); } break; case WIDX_ZOOM_OUT: - if (w->viewport != NULL && w->viewport->zoom < 3) { + if (w->viewport != nullptr && w->viewport->zoom < 3) { w->viewport->zoom++; window_invalidate(w); } break; case WIDX_LOCATE: mainWindow = window_get_main(); - if (mainWindow != NULL) { - get_map_coordinates_from_pos(w->x + (w->width / 2), w->y + (w->height / 2), VIEWPORT_INTERACTION_MASK_NONE, &x, &y, NULL, NULL, NULL); + if (mainWindow != nullptr) { + get_map_coordinates_from_pos(w->x + (w->width / 2), w->y + (w->height / 2), VIEWPORT_INTERACTION_MASK_NONE, &x, &y, nullptr, nullptr, nullptr); window_scroll_to_location(mainWindow, x, y, map_element_height(x, y)); } break; @@ -180,7 +180,7 @@ static void window_viewport_update(rct_window *w) rct_window *mainWindow; mainWindow = window_get_main(); - if (mainWindow == NULL) + if (mainWindow == nullptr) return; if (w->viewport->flags != mainWindow->viewport->flags) { @@ -233,6 +233,6 @@ static void window_viewport_paint(rct_window *w, rct_drawpixelinfo *dpi) window_draw_widgets(w, dpi); // Draw viewport - if (w->viewport != NULL) + if (w->viewport != nullptr) window_draw_viewport(dpi, w); } diff --git a/src/openrct2-ui/windows/Water.cpp b/src/openrct2-ui/windows/Water.cpp index df48a6d967..0d1d3cc08c 100644 --- a/src/openrct2-ui/windows/Water.cpp +++ b/src/openrct2-ui/windows/Water.cpp @@ -58,32 +58,32 @@ static void window_water_inputsize(rct_window *w); static rct_window_event_list window_water_events = { window_water_close, window_water_mouseup, - NULL, + nullptr, window_water_mousedown, - NULL, - NULL, + nullptr, + nullptr, window_water_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_water_textinput, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_water_invalidate, window_water_paint, - NULL + nullptr }; /** @@ -173,7 +173,7 @@ static void window_water_textinput(rct_window *w, rct_widgetindex widgetIndex, c sint32 size; char* end; - if (widgetIndex != WIDX_PREVIEW || text == NULL) + if (widgetIndex != WIDX_PREVIEW || text == nullptr) return; size = strtol(text, &end, 10); diff --git a/src/openrct2/PlatformEnvironment.cpp b/src/openrct2/PlatformEnvironment.cpp index 1740b29996..b79eb7c749 100644 --- a/src/openrct2/PlatformEnvironment.cpp +++ b/src/openrct2/PlatformEnvironment.cpp @@ -109,7 +109,7 @@ IPlatformEnvironment * OpenRCT2::CreatePlatformEnvironment() utf8 userPath[MAX_PATH]; platform_resolve_openrct_data_path(); platform_resolve_user_data_path(); - platform_get_user_directory(userPath, NULL, sizeof(userPath)); + platform_get_user_directory(userPath, nullptr, sizeof(userPath)); if (!platform_ensure_directory_exists(userPath)) { Console::Error::WriteLine("Could not create user directory (do you have write access to your documents folder?)"); diff --git a/src/openrct2/audio/Audio.cpp b/src/openrct2/audio/Audio.cpp index 4cc477995d..f470c3de38 100644 --- a/src/openrct2/audio/Audio.cpp +++ b/src/openrct2/audio/Audio.cpp @@ -138,7 +138,7 @@ void audio_init() { if (str_is_null_or_empty(gConfigSound.device)) { - Mixer_Init(NULL); + Mixer_Init(nullptr); gAudioCurrentDevice = 0; } else diff --git a/src/openrct2/cmdline/RootCommands.cpp b/src/openrct2/cmdline/RootCommands.cpp index aa4b1ca604..829240b60c 100644 --- a/src/openrct2/cmdline/RootCommands.cpp +++ b/src/openrct2/cmdline/RootCommands.cpp @@ -365,7 +365,7 @@ static exitcode_t HandleCommandSetRCT2(CommandLineArgEnumerator * enumerator) // Check user path that will contain the config utf8 userPath[MAX_PATH]; platform_resolve_user_data_path(); - platform_get_user_directory(userPath, NULL, sizeof(userPath)); + platform_get_user_directory(userPath, nullptr, sizeof(userPath)); if (!platform_ensure_directory_exists(userPath)) { Console::Error::WriteLine("Unable to access or create directory '%s'.", userPath); return EXITCODE_FAIL; diff --git a/src/openrct2/core/Path.cpp b/src/openrct2/core/Path.cpp index b7fa7afca5..2bb10b6622 100644 --- a/src/openrct2/core/Path.cpp +++ b/src/openrct2/core/Path.cpp @@ -182,7 +182,7 @@ namespace Path #ifdef _WIN32 wchar_t * relativePathW = utf8_to_widechar(relativePath); wchar_t absolutePathW[MAX_PATH]; - DWORD length = GetFullPathNameW(relativePathW, (DWORD)Util::CountOf(absolutePathW), absolutePathW, NULL); + DWORD length = GetFullPathNameW(relativePathW, (DWORD)Util::CountOf(absolutePathW), absolutePathW, nullptr); Memory::Free(relativePathW); if (length == 0) { @@ -196,7 +196,7 @@ namespace Path return buffer; } #else - utf8 * absolutePath = realpath(relativePath, NULL); + utf8 * absolutePath = realpath(relativePath, nullptr); if (absolutePath == nullptr) { return String::Set(buffer, bufferSize, relativePath); diff --git a/src/openrct2/core/ZipAndroid.cpp b/src/openrct2/core/ZipAndroid.cpp index 04d3e5cb7e..726bb82281 100644 --- a/src/openrct2/core/ZipAndroid.cpp +++ b/src/openrct2/core/ZipAndroid.cpp @@ -166,7 +166,7 @@ JNIEXPORT jlong JNICALL Java_website_openrct2_ZipArchive_allocBytes(JNIEnv *env, jclass, jbyteArray input, jint numBytes) { - jbyte *bufferPtr = env->GetByteArrayElements(input, NULL); + jbyte *bufferPtr = env->GetByteArrayElements(input, nullptr); void *data = Memory::Allocate((size_t) numBytes); memcpy(data, bufferPtr, numBytes); diff --git a/src/openrct2/drawing/X8DrawingEngine.cpp b/src/openrct2/drawing/X8DrawingEngine.cpp index a716b08447..262d676916 100644 --- a/src/openrct2/drawing/X8DrawingEngine.cpp +++ b/src/openrct2/drawing/X8DrawingEngine.cpp @@ -388,7 +388,7 @@ void X8DrawingEngine::ResetWindowVisbilities() for (rct_window *w = g_window_list; w < gWindowNextSlot; w++) { w->visibility = VC_UNKNOWN; - if (w->viewport != NULL) w->viewport->visibility = VC_UNKNOWN; + if (w->viewport != nullptr) w->viewport->visibility = VC_UNKNOWN; } } diff --git a/src/openrct2/interface/Screenshot.cpp b/src/openrct2/interface/Screenshot.cpp index 4a6e649e8c..6ce30634e8 100644 --- a/src/openrct2/interface/Screenshot.cpp +++ b/src/openrct2/interface/Screenshot.cpp @@ -159,7 +159,7 @@ void screenshot_giant() sint32 originalZoom = 0; rct_window *mainWindow = window_get_main(); - if (mainWindow != NULL && mainWindow->viewport != NULL) + if (mainWindow != nullptr && mainWindow->viewport != nullptr) originalZoom = mainWindow->viewport->zoom; sint32 rotation = originalRotation; diff --git a/src/openrct2/network/Http.cpp b/src/openrct2/network/Http.cpp index f5c015cf2a..a930df2278 100644 --- a/src/openrct2/network/Http.cpp +++ b/src/openrct2/network/Http.cpp @@ -159,34 +159,34 @@ static http_response_t *http_request(const HttpRequest2 &request) write_buffer writeBuffer; curl = curl_easy_init(); - if (curl == NULL) - return NULL; + if (curl == nullptr) + return nullptr; - if (request.Type == HTTP_DATA_JSON && request.Body.Json != NULL) { + if (request.Type == HTTP_DATA_JSON && request.Body.Json != nullptr) { readBuffer.ptr = json_dumps(request.Body.Json, JSON_COMPACT); readBuffer.length = strlen(readBuffer.ptr); readBuffer.position = 0; - } else if (request.Type == HTTP_DATA_RAW && request.Body.Buffer != NULL) { + } else if (request.Type == HTTP_DATA_RAW && request.Body.Buffer != nullptr) { readBuffer.ptr = request.Body.Buffer; readBuffer.length = request.Size; readBuffer.position = 0; } - writeBuffer.ptr = NULL; + writeBuffer.ptr = nullptr; writeBuffer.length = 0; writeBuffer.capacity = 0; - curl_slist *headers = NULL; + curl_slist *headers = nullptr; if (request.Type == HTTP_DATA_JSON) { headers = curl_slist_append(headers, "Accept: " MIME_TYPE_APPLICATION_JSON); - if (request.Body.Json != NULL) { + if (request.Body.Json != nullptr) { headers = curl_slist_append(headers, "Content-Type: " MIME_TYPE_APPLICATION_JSON); } } - if (readBuffer.ptr != NULL) { + if (readBuffer.ptr != nullptr) { char contentLengthHeaderValue[64]; snprintf(contentLengthHeaderValue, sizeof(contentLengthHeaderValue), "Content-Length: %zu", readBuffer.length); headers = curl_slist_append(headers, contentLengthHeaderValue); @@ -205,16 +205,16 @@ static http_response_t *http_request(const HttpRequest2 &request) curlResult = curl_easy_perform(curl); - if (request.Type == HTTP_DATA_JSON && request.Body.Json != NULL) { + if (request.Type == HTTP_DATA_JSON && request.Body.Json != nullptr) { free(readBuffer.ptr); } if (curlResult != CURLE_OK) { log_error("HTTP request failed: %s.", curl_easy_strerror(curlResult)); - if (writeBuffer.ptr != NULL) + if (writeBuffer.ptr != nullptr) free(writeBuffer.ptr); - return NULL; + return nullptr; } long httpStatusCode; @@ -229,14 +229,14 @@ static http_response_t *http_request(const HttpRequest2 &request) writeBuffer.capacity = writeBuffer.length; writeBuffer.ptr[writeBuffer.length - 1] = 0; - response = NULL; + response = nullptr; // Parse as JSON if response is JSON - if (contentType != NULL && strstr(contentType, "json") != NULL) { + if (contentType != nullptr && strstr(contentType, "json") != nullptr) { json_t *root; json_error_t error; root = json_loads(writeBuffer.ptr, 0, &error); - if (root != NULL) { + if (root != nullptr) { response = (http_response_t*) malloc(sizeof(http_response_t)); response->tag = request.Tag; response->status_code = (sint32) httpStatusCode; @@ -272,9 +272,9 @@ void http_request_async(const http_request_t * request, void (*callback)(http_re void http_request_dispose(http_response_t *response) { - if (response->type == HTTP_DATA_JSON && response->root != NULL) + if (response->type == HTTP_DATA_JSON && response->root != nullptr) json_decref(response->root); - else if (response->type == HTTP_DATA_RAW && response->body != NULL) + else if (response->type == HTTP_DATA_RAW && response->body != nullptr) free(response->body); free(response); @@ -285,7 +285,7 @@ const char *http_get_extension_from_url(const char *url, const char *fallback) const char *extension = strrchr(url, '.'); // Assume a save file by default if no valid extension can be determined - if (extension == NULL || strchr(extension, '/') != NULL) { + if (extension == nullptr || strchr(extension, '/') != nullptr) { return fallback; } else { return extension; @@ -302,19 +302,19 @@ size_t http_download_park(const char * url, void * * outData) http_response_t *response = http_request(request); - if (response == NULL || response->status_code != 200) { + if (response == nullptr || response->status_code != 200) { Console::Error::WriteLine("Failed to download '%s'", request.Url.c_str()); - if (response != NULL) { + if (response != nullptr) { http_request_dispose(response); } - *outData = NULL; + *outData = nullptr; return 0; } size_t dataSize = response->size - 1; void * data = malloc(dataSize); - if (data == NULL) { + if (data == nullptr) { dataSize = 0; Console::Error::WriteLine("Failed to allocate memory for downloaded park."); } else { diff --git a/src/openrct2/network/Network.cpp b/src/openrct2/network/Network.cpp index 21a973b991..906cd223cc 100644 --- a/src/openrct2/network/Network.cpp +++ b/src/openrct2/network/Network.cpp @@ -450,7 +450,7 @@ void Network::UpdateClient() { _lastConnectStatus = SOCKET_STATUS_RESOLVING; char str_resolving[256]; - format_string(str_resolving, 256, STR_MULTIPLAYER_RESOLVING, NULL); + format_string(str_resolving, 256, STR_MULTIPLAYER_RESOLVING, nullptr); window_network_status_open(str_resolving, []() -> void { gNetwork.Close(); }); @@ -463,7 +463,7 @@ void Network::UpdateClient() { _lastConnectStatus = SOCKET_STATUS_CONNECTING; char str_connecting[256]; - format_string(str_connecting, 256, STR_MULTIPLAYER_CONNECTING, NULL); + format_string(str_connecting, 256, STR_MULTIPLAYER_CONNECTING, nullptr); window_network_status_open(str_connecting, []() -> void { gNetwork.Close(); }); @@ -477,7 +477,7 @@ void Network::UpdateClient() server_connection->ResetLastPacketTime(); Client_Send_TOKEN(); char str_authenticating[256]; - format_string(str_authenticating, 256, STR_MULTIPLAYER_AUTHENTICATING, NULL); + format_string(str_authenticating, 256, STR_MULTIPLAYER_AUTHENTICATING, nullptr); window_network_status_open(str_authenticating, []() -> void { gNetwork.Close(); }); @@ -511,10 +511,10 @@ void Network::UpdateClient() const char * disconnect_reason = server_connection->GetLastDisconnectReason(); format_string(str_disconnected, 256, STR_MULTIPLAYER_DISCONNECTED_WITH_REASON, &disconnect_reason); } else { - format_string(str_disconnected, 256, STR_MULTIPLAYER_DISCONNECTED_NO_REASON, NULL); + format_string(str_disconnected, 256, STR_MULTIPLAYER_DISCONNECTED_NO_REASON, nullptr); } - window_network_status_open(str_disconnected, NULL); + window_network_status_open(str_disconnected, nullptr); } Close(); } @@ -634,7 +634,7 @@ void Network::KickPlayer(sint32 playerId) // Disconnect the client gracefully (*it)->SetLastDisconnectReason(STR_MULTIPLAYER_KICKED); char str_disconnect_msg[256]; - format_string(str_disconnect_msg, 256, STR_MULTIPLAYER_KICKED_REASON, NULL); + format_string(str_disconnect_msg, 256, STR_MULTIPLAYER_KICKED_REASON, nullptr); Server_Send_SETDISCONNECTMSG(*(*it), str_disconnect_msg); (*it)->Socket->Disconnect(); break; @@ -747,7 +747,7 @@ void Network::SaveGroups() if (GetMode() == NETWORK_MODE_SERVER) { utf8 path[MAX_PATH]; - platform_get_user_directory(path, NULL, sizeof(path)); + platform_get_user_directory(path, nullptr, sizeof(path)); safe_strcat_path(path, "groups.json", sizeof(path)); json_t * jsonGroupsCfg = json_object(); @@ -803,7 +803,7 @@ void Network::LoadGroups() utf8 path[MAX_PATH]; - platform_get_user_directory(path, NULL, sizeof(path)); + platform_get_user_directory(path, nullptr, sizeof(path)); safe_strcat_path(path, "groups.json", sizeof(path)); json_t * json = nullptr; @@ -903,9 +903,9 @@ void Network::BeginServerLog() // Log server start event utf8 logMessage[256]; if (GetMode() == NETWORK_MODE_CLIENT) { - format_string(logMessage, sizeof(logMessage), STR_LOG_CLIENT_STARTED, NULL); + format_string(logMessage, sizeof(logMessage), STR_LOG_CLIENT_STARTED, nullptr); } else if (GetMode() == NETWORK_MODE_SERVER) { - format_string(logMessage, sizeof(logMessage), STR_LOG_SERVER_STARTED, NULL); + format_string(logMessage, sizeof(logMessage), STR_LOG_SERVER_STARTED, nullptr); } AppendServerLog(logMessage); } @@ -922,9 +922,9 @@ void Network::CloseServerLog() // Log server stopped event char logMessage[256]; if (GetMode() == NETWORK_MODE_CLIENT) { - format_string(logMessage, sizeof(logMessage), STR_LOG_CLIENT_STOPPED, NULL); + format_string(logMessage, sizeof(logMessage), STR_LOG_CLIENT_STOPPED, nullptr); } else if (GetMode() == NETWORK_MODE_SERVER) { - format_string(logMessage, sizeof(logMessage), STR_LOG_SERVER_STOPPED, NULL); + format_string(logMessage, sizeof(logMessage), STR_LOG_SERVER_STOPPED, nullptr); } AppendServerLog(logMessage); } @@ -1060,7 +1060,7 @@ uint8 * Network::save_for_network(size_t &out_size, const std::vector void { @@ -354,7 +354,7 @@ namespace Twitch } http_request_dispose(_twitchJsonResponse); - _twitchJsonResponse = NULL; + _twitchJsonResponse = nullptr; _twitchState = TWITCH_STATE_JOINED; gfx_invalidate_screen(); @@ -420,7 +420,7 @@ namespace Twitch if (is_user_string_id(peep->name_string_idx)) { utf8 buffer[256]; - format_string(buffer, 256, peep->name_string_idx, NULL); + format_string(buffer, 256, peep->name_string_idx, nullptr); AudienceMember * member = nullptr; for (AudienceMember &m : members) diff --git a/src/openrct2/object/RideObject.cpp b/src/openrct2/object/RideObject.cpp index bfba7638c3..9211bf1af6 100644 --- a/src/openrct2/object/RideObject.cpp +++ b/src/openrct2/object/RideObject.cpp @@ -404,14 +404,14 @@ void RideObject::SetRepositoryItem(ObjectRepositoryItem * item) const const ride_group * rideGroup = get_ride_group(rideTypeIdx, (rct_ride_entry *)&_legacyType); - // If the ride group is NULL, the track type does not have ride groups. - if (rideGroup != NULL) + // If the ride group is nullptr, the track type does not have ride groups. + if (rideGroup != nullptr) { for (uint8 i = rideGroupIndex + 1; i < MAX_RIDE_GROUPS_PER_RIDE_TYPE; i++) { ride_group * irg = ride_group_find(rideTypeIdx, i); - if (irg != NULL) + if (irg != nullptr) { if (ride_groups_are_equal(irg, rideGroup)) { diff --git a/src/openrct2/platform/Crash.cpp b/src/openrct2/platform/Crash.cpp index b4005a32af..da360c3248 100644 --- a/src/openrct2/platform/Crash.cpp +++ b/src/openrct2/platform/Crash.cpp @@ -64,7 +64,7 @@ static bool OnCrash(const wchar_t * dumpPath, printf("%s\n", DumpFailedMessage); if (!gOpenRCT2SilentBreakpad) { - MessageBoxA(NULL, DumpFailedMessage, OPENRCT2_NAME, MB_OK | MB_ICONERROR); + MessageBoxA(nullptr, DumpFailedMessage, OPENRCT2_NAME, MB_OK | MB_ICONERROR); } return succeeded; } @@ -118,8 +118,8 @@ static bool OnCrash(const wchar_t * dumpPath, _wszCommitSha1Short); // Cannot use platform_show_messagebox here, it tries to set parent window already dead. - MessageBoxW(NULL, message, WSZ(OPENRCT2_NAME), MB_OK | MB_ICONERROR); - HRESULT coInitializeResult = CoInitialize(NULL); + MessageBoxW(nullptr, message, WSZ(OPENRCT2_NAME), MB_OK | MB_ICONERROR); + HRESULT coInitializeResult = CoInitialize(nullptr); if (SUCCEEDED(coInitializeResult)) { LPITEMIDLIST pidl = ILCreateFromPathW(dumpPath); @@ -149,7 +149,7 @@ static bool OnCrash(const wchar_t * dumpPath, static std::wstring GetDumpDirectory() { char userDirectory[MAX_PATH]; - platform_get_user_directory(userDirectory, NULL, sizeof(userDirectory)); + platform_get_user_directory(userDirectory, nullptr, sizeof(userDirectory)); wchar_t * userDirectoryW = utf8_to_widechar(userDirectory); auto result = std::wstring(userDirectoryW); diff --git a/src/openrct2/ride/RideGroupManager.cpp b/src/openrct2/ride/RideGroupManager.cpp index 3d051400e9..ea942ab6e3 100644 --- a/src/openrct2/ride/RideGroupManager.cpp +++ b/src/openrct2/ride/RideGroupManager.cpp @@ -118,7 +118,7 @@ public: else return (ride_group *) &ride_group_hyper_twister; default: - return NULL; + return nullptr; } } @@ -159,7 +159,7 @@ public: rideGroup = (ride_group *) &twister_rc_groups[index]; break; default: - return NULL; + return nullptr; } return rideGroup; @@ -167,7 +167,7 @@ public: bool RideGroupsAreEqual(const ride_group * a, const ride_group * b) const override { - if (a != NULL && b != NULL && (a->naming.name == b->naming.name && a->naming.description == b->naming.description)) + if (a != nullptr && b != nullptr && (a->naming.name == b->naming.name && a->naming.description == b->naming.description)) { return true; } diff --git a/src/openrct2/ride/TrackDesignRepository.cpp b/src/openrct2/ride/TrackDesignRepository.cpp index fa39260632..944559417e 100644 --- a/src/openrct2/ride/TrackDesignRepository.cpp +++ b/src/openrct2/ride/TrackDesignRepository.cpp @@ -146,7 +146,7 @@ public: uint8 rideGroupIndex = (ori != nullptr) ? ori->RideGroupIndex : 0; ride_group * itemRideGroup = ride_group_find(rideType, rideGroupIndex); - if (itemRideGroup != NULL && ride_groups_are_equal(itemRideGroup, rideGroup)) + if (itemRideGroup != nullptr && ride_groups_are_equal(itemRideGroup, rideGroup)) { count++; } @@ -212,7 +212,7 @@ public: uint8 rideGroupIndex = (ori != nullptr) ? ori->RideGroupIndex : 0; ride_group * itemRideGroup = ride_group_find(rideType, rideGroupIndex); - if (itemRideGroup != NULL && ride_groups_are_equal(itemRideGroup, rideGroup)) + if (itemRideGroup != nullptr && ride_groups_are_equal(itemRideGroup, rideGroup)) { track_design_file_ref ref; ref.name = String::Duplicate(GetNameFromTrackPath(item.Path)); diff --git a/src/openrct2/scenario/ScenarioSources.cpp b/src/openrct2/scenario/ScenarioSources.cpp index 7558b15300..0a53129961 100644 --- a/src/openrct2/scenario/ScenarioSources.cpp +++ b/src/openrct2/scenario/ScenarioSources.cpp @@ -286,7 +286,7 @@ namespace ScenarioSources } } - outDesc->title = NULL; + outDesc->title = nullptr; outDesc->id = SC_UNIDENTIFIED; outDesc->source = SCENARIO_SOURCE_OTHER; outDesc->index = -1; @@ -317,7 +317,7 @@ namespace ScenarioSources } } - outDesc->title = NULL; + outDesc->title = nullptr; outDesc->id = SC_UNIDENTIFIED; outDesc->source = SCENARIO_SOURCE_OTHER; outDesc->index = -1; diff --git a/src/openrct2/windows/Banner.cpp b/src/openrct2/windows/Banner.cpp index bee49c001d..3f02308ce1 100644 --- a/src/openrct2/windows/Banner.cpp +++ b/src/openrct2/windows/Banner.cpp @@ -82,34 +82,34 @@ static void window_banner_invalidate(rct_window *w); static void window_banner_paint(rct_window *w, rct_drawpixelinfo *dpi); static rct_window_event_list window_banner_events = { - NULL, + nullptr, window_banner_mouseup, - NULL, + nullptr, window_banner_mousedown, window_banner_dropdown, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_banner_textinput, window_banner_viewport_rotate, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_banner_invalidate, window_banner_paint, - NULL + nullptr }; /** @@ -124,7 +124,7 @@ static void _window_banner_open(rct_windownumber number) // Check if window is already open w = window_bring_to_front_by_number(WC_BANNER, number); - if (w != NULL) + if (w != nullptr) return; w = window_create_auto_pos(WW, WH, &window_banner_events, WC_BANNER, WF_NO_SCROLLING); @@ -284,7 +284,7 @@ static void window_banner_dropdown(rct_window *w, rct_widgetindex widgetIndex, s */ static void window_banner_textinput(rct_window *w, rct_widgetindex widgetIndex, char *text) { - if (widgetIndex == WIDX_BANNER_TEXT && text != NULL) { + if (widgetIndex == WIDX_BANNER_TEXT && text != nullptr) { game_do_command(1, GAME_COMMAND_FLAG_APPLY, w->number, *((sint32*)(text + 0)), GAME_COMMAND_SET_BANNER_NAME, *((sint32*)(text + 8)), *((sint32*)(text + 4))); game_do_command(2, GAME_COMMAND_FLAG_APPLY, w->number, *((sint32*)(text + 12)), GAME_COMMAND_SET_BANNER_NAME, *((sint32*)(text + 20)), *((sint32*)(text + 16))); game_do_command(0, GAME_COMMAND_FLAG_APPLY, w->number, *((sint32*)(text + 24)), GAME_COMMAND_SET_BANNER_NAME, *((sint32*)(text + 32)), *((sint32*)(text + 28))); @@ -332,7 +332,7 @@ static void window_banner_paint(rct_window *w, rct_drawpixelinfo *dpi) window_draw_widgets(w, dpi); // Draw viewport - if (w->viewport != NULL) { + if (w->viewport != nullptr) { window_draw_viewport(dpi, w); } } diff --git a/src/openrct2/windows/DemolishRidePrompt.cpp b/src/openrct2/windows/DemolishRidePrompt.cpp index 9755dcb9b9..7a93442ada 100644 --- a/src/openrct2/windows/DemolishRidePrompt.cpp +++ b/src/openrct2/windows/DemolishRidePrompt.cpp @@ -46,34 +46,34 @@ static void window_ride_demolish_paint(rct_window *w, rct_drawpixelinfo *dpi); //0x0098E2E4 static rct_window_event_list window_ride_demolish_events = { - NULL, + nullptr, window_ride_demolish_mouseup, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_ride_demolish_paint, - NULL + nullptr }; /** Based off of rct2: 0x006B486A */ @@ -82,7 +82,7 @@ static void _window_ride_demolish_prompt_open(sint32 rideIndex) rct_window *w; w = window_bring_to_front_by_number(WC_DEMOLISH_RIDE_PROMPT, rideIndex); - if (w != NULL) + if (w != nullptr) return; w = window_create_centred(WW, WH, &window_ride_demolish_events, WC_DEMOLISH_RIDE_PROMPT, WF_TRANSPARENT); @@ -107,7 +107,7 @@ static void window_ride_demolish_mouseup(rct_window *w, rct_widgetindex widgetIn // Prevents demolished rides sticking around in the ride list window window = window_find_by_class(WC_RIDE_LIST); - if (window != NULL) + if (window != nullptr) { window_ride_list_refresh_list(window); } diff --git a/src/openrct2/windows/Dropdown.cpp b/src/openrct2/windows/Dropdown.cpp index 17e8acd091..cdd53ce4f6 100644 --- a/src/openrct2/windows/Dropdown.cpp +++ b/src/openrct2/windows/Dropdown.cpp @@ -101,34 +101,34 @@ void dropdown_set_disabled(sint32 index, bool value) static void window_dropdown_paint(rct_window *w, rct_drawpixelinfo *dpi); static rct_window_event_list window_dropdown_events = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_dropdown_paint, - NULL + nullptr }; /** diff --git a/src/openrct2/windows/EditorBottomToolbar.cpp b/src/openrct2/windows/EditorBottomToolbar.cpp index 7b0d86ca91..cd0ef802b0 100644 --- a/src/openrct2/windows/EditorBottomToolbar.cpp +++ b/src/openrct2/windows/EditorBottomToolbar.cpp @@ -62,45 +62,45 @@ static void window_editor_bottom_toolbar_jump_forward_to_objective_selection(); static void window_editor_bottom_toolbar_jump_forward_to_save_scenario(); static rct_window_event_list window_editor_bottom_toolbar_events = { - NULL, + nullptr, window_editor_bottom_toolbar_mouseup, // 0x0066f5ae, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_editor_bottom_toolbar_invalidate, // 0x0066f1c9, window_editor_bottom_toolbar_paint, // 0x0066f25c, - NULL + nullptr }; static EMPTY_ARGS_VOID_POINTER *previous_button_mouseup_events[] = { - NULL, + nullptr, window_editor_bottom_toolbar_jump_back_to_object_selection, window_editor_bottom_toolbar_jump_back_to_landscape_editor, window_editor_bottom_toolbar_jump_back_to_invention_list_set_up, window_editor_bottom_toolbar_jump_back_to_options_selection, - NULL, + nullptr, window_editor_bottom_toolbar_jump_back_to_object_selection, - NULL + nullptr }; static EMPTY_ARGS_VOID_POINTER *next_button_mouseup_events[] = { @@ -109,9 +109,9 @@ static EMPTY_ARGS_VOID_POINTER *next_button_mouseup_events[] = { window_editor_bottom_toolbar_jump_forward_to_options_selection, window_editor_bottom_toolbar_jump_forward_to_objective_selection, window_editor_bottom_toolbar_jump_forward_to_save_scenario, - NULL, - NULL, - NULL + nullptr, + nullptr, + nullptr }; static const rct_string_id EditorStepNames[] = { @@ -208,7 +208,7 @@ static bool window_editor_bottom_toolbar_check_object_selection() window_error_open(STR_INVALID_SELECTION_OF_OBJECTS, gGameCommandErrorText); w = window_find_by_class(WC_EDITOR_OBJECT_SELECTION); - if (w != NULL) { + if (w != nullptr) { // Click tab with missing object window_event_mouse_up_call(w, WC_EDITOR_OBJECT_SELECTION__WIDX_TAB_1 + missingObjectType); } @@ -447,8 +447,8 @@ void window_editor_bottom_toolbar_paint(rct_window *w, rct_drawpixelinfo *dpi) if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) stringId = STR_EDITOR_STEP_OBJECT_SELECTION; - gfx_draw_string_centred(dpi, STR_BACK_TO_PREVIOUS_STEP, textX, textY, textColour, NULL); - gfx_draw_string_centred(dpi, stringId, textX, textY + 10, textColour, NULL); + gfx_draw_string_centred(dpi, STR_BACK_TO_PREVIOUS_STEP, textX, textY, textColour, nullptr); + gfx_draw_string_centred(dpi, stringId, textX, textY + 10, textColour, nullptr); } if ((drawPreviousButton || drawNextButton) && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) { @@ -472,8 +472,8 @@ void window_editor_bottom_toolbar_paint(rct_window *w, rct_drawpixelinfo *dpi) if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) stringId = STR_EDITOR_STEP_ROLLERCOASTER_DESIGNER; - gfx_draw_string_centred(dpi, STR_FORWARD_TO_NEXT_STEP, textX, textY, textColour, NULL); - gfx_draw_string_centred(dpi, stringId, textX, textY + 10, textColour, NULL); + gfx_draw_string_centred(dpi, STR_FORWARD_TO_NEXT_STEP, textX, textY, textColour, nullptr); + gfx_draw_string_centred(dpi, stringId, textX, textY + 10, textColour, nullptr); } } diff --git a/src/openrct2/windows/EditorMain.cpp b/src/openrct2/windows/EditorMain.cpp index e5d3ab2cb6..cdcc0eca9e 100644 --- a/src/openrct2/windows/EditorMain.cpp +++ b/src/openrct2/windows/EditorMain.cpp @@ -26,34 +26,34 @@ extern "C" static void window_editor_main_paint(rct_window *w, rct_drawpixelinfo *dpi); static rct_window_event_list window_editor_main_events = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_editor_main_paint,// 0x0066FC97, // window_editor_main_paint, - NULL, + nullptr, }; static rct_widget window_editor_main_widgets[] = { diff --git a/src/openrct2/windows/EditorObjectSelection.cpp b/src/openrct2/windows/EditorObjectSelection.cpp index b4cdec3965..6b351479e1 100644 --- a/src/openrct2/windows/EditorObjectSelection.cpp +++ b/src/openrct2/windows/EditorObjectSelection.cpp @@ -202,26 +202,26 @@ static rct_window_event_list window_editor_object_selection_events = { window_editor_object_selection_resize, window_editor_object_selection_mousedown, window_editor_object_selection_dropdown, - NULL, + nullptr, window_editor_object_selection_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_editor_object_selection_scrollgetsize, window_editor_object_selection_scroll_mousedown, - NULL, + nullptr, window_editor_object_selection_scroll_mouseover, window_editor_object_selection_textinput, - NULL, - NULL, + nullptr, + nullptr, window_editor_object_selection_tooltip, - NULL, - NULL, + nullptr, + nullptr, window_editor_object_selection_invalidate, window_editor_object_selection_paint, window_editor_object_selection_scrollpaint @@ -277,11 +277,11 @@ static rct_string_id get_ride_type_string_id(const ObjectRepositoryItem * item); typedef sint32(*sortFunc_t)(const void *, const void *); static sint32 _numListItems = 0; -static list_item *_listItems = NULL; +static list_item *_listItems = nullptr; static sint32 _listSortType = RIDE_SORT_TYPE; static bool _listSortDescending = false; -static void * _loadedObject = NULL; -static uint8 * _objectSelectionFlags = NULL; +static void * _loadedObject = nullptr; +static uint8 * _objectSelectionFlags = nullptr; static sint32 _numSelectedObjectsForType[11]; static sint32 _numAvailableObjectsForType[11]; static bool _maxObjectsWasHit; @@ -358,11 +358,11 @@ static void visible_list_refresh(rct_window *w) } _listItems = Memory::ReallocateArray(_listItems, _numListItems); - if (_listItems == NULL) { + if (_listItems == nullptr) { _numListItems = 0; log_error("Unable to reallocate list items"); } else { - sortFunc_t sortFunc = NULL; + sortFunc_t sortFunc = nullptr; switch (_listSortType) { case RIDE_SORT_TYPE: sortFunc = visible_list_sort_ride_type; @@ -398,7 +398,7 @@ void window_editor_object_selection_open() rct_window* window; window = window_bring_to_front_by_class(WC_EDITOR_OBJECT_SELECTION); - if (window != NULL) + if (window != nullptr) return; if (!sub_6AB211()) @@ -611,7 +611,7 @@ static sint32 sub_6AB211() { sint32 numObjects = (sint32)object_repository_get_items_count(); _objectSelectionFlags = (uint8*)calloc(numObjects, sizeof(uint8)); - if (_objectSelectionFlags == NULL){ + if (_objectSelectionFlags == nullptr){ log_error("Failed to allocate memory for object flag list."); return 0; } @@ -720,7 +720,7 @@ static void window_editor_object_selection_close(rct_window *w) editor_object_flags_free(); object_delete(_loadedObject); - _loadedObject = NULL; + _loadedObject = nullptr; if (gScreenFlags & SCREEN_FLAGS_EDITOR) { research_populate_list_random(); @@ -813,7 +813,7 @@ static void window_editor_object_selection_mouseup(rct_window *w, rct_widgetinde } window_invalidate(w); - window_loadsave_open(LOADSAVETYPE_LOAD | LOADSAVETYPE_TRACK, NULL); + window_loadsave_open(LOADSAVETYPE_LOAD | LOADSAVETYPE_TRACK, nullptr); break; case WIDX_FILTER_STRING_BUTTON: //window_text_input_open(w, widgetIndex, STR_OBJECT_SEARCH, STR_OBJECT_SEARCH_DESC, STR_STRING, (uint32)_filter_string, 40); @@ -1026,11 +1026,11 @@ static void window_editor_object_selection_scroll_mouseover(rct_window *w, sint3 w->selected_list_item = selectedObject; object_delete(_loadedObject); - _loadedObject = NULL; + _loadedObject = nullptr; list_item * listItem = &_listItems[selectedObject]; if (selectedObject == -1) { - w->object_entry = NULL; + w->object_entry = nullptr; } else { w->object_entry = listItem->entry; _loadedObject = object_repository_load_object(listItem->entry); @@ -1291,7 +1291,7 @@ static void window_editor_object_selection_paint(rct_window *w, rct_drawpixelinf gfx_draw_string_left_clipped(dpi, STR_OBJECTS_SORT_RIDE, &stringId, w->colours[1], w->x + widget->left + 1, w->y + widget->top + 1, widget->right - widget->left); } - if (w->selected_list_item == -1 || _loadedObject == NULL) + if (w->selected_list_item == -1 || _loadedObject == nullptr) return; list_item *listItem = &_listItems[w->selected_list_item]; @@ -1322,7 +1322,7 @@ static void window_editor_object_selection_paint(rct_window *w, rct_drawpixelinf // Draw description of object const char *description = object_get_description(_loadedObject); - if (description != NULL) { + if (description != nullptr) { set_format_arg(0, rct_string_id, STR_STRING); set_format_arg(2, const char *, description); @@ -1344,18 +1344,18 @@ static void window_editor_object_selection_paint(rct_window *w, rct_drawpixelinf case 2: stringId = STR_OBJECT_FILTER_TT; break; default: stringId = STR_OBJECT_FILTER_CUSTOM; break; } - gfx_draw_string_right(dpi, stringId, NULL, COLOUR_WHITE, w->x + w->width - 5, w->y + w->height - 3 - 12 - 14); + gfx_draw_string_right(dpi, stringId, nullptr, COLOUR_WHITE, w->x + w->width - 5, w->y + w->height - 3 - 12 - 14); // if (w->selected_tab == WINDOW_OBJECT_SELECTION_PAGE_RIDE_VEHICLES_ATTRACTIONS) { y = w->y + w->height - 3 - 12 - 14 - 14; stringId = get_ride_type_string_id(listItem->repositoryItem); - gfx_draw_string_right(dpi, stringId, NULL, COLOUR_WHITE, w->x + w->width - 5, y); + gfx_draw_string_right(dpi, stringId, nullptr, COLOUR_WHITE, w->x + w->width - 5, y); y -= 11; } //stringId = highlightedEntry->checksum - // gfx_draw_string_right(dpi, stringId, NULL, 2, w->x + w->width - 5, w->y + w->height - 3 - 12 - 14); + // gfx_draw_string_right(dpi, stringId, nullptr, 2, w->x + w->width - 5, w->y + w->height - 3 - 12 - 14); // Draw object dat name const char *path = path_get_filename(listItem->repositoryItem->Path); @@ -1535,7 +1535,7 @@ static sint32 window_editor_object_selection_select_object(uint8 bh, sint32 flag { sint32 numObjects = (sint32)object_repository_get_items_count(); const ObjectRepositoryItem * item = object_repository_find_object_by_entry(entry); - if (item == NULL) { + if (item == nullptr) { set_object_selection_error(bh, STR_OBJECT_SELECTION_ERR_OBJECT_DATA_NOT_FOUND); return 0; } @@ -1673,9 +1673,9 @@ static void editor_load_selected_objects() const ObjectRepositoryItem * item = &items[i]; const rct_object_entry * entry = &item->ObjectEntry; void * loadedObject = object_manager_get_loaded_object(entry); - if (loadedObject == NULL) { + if (loadedObject == nullptr) { loadedObject = object_manager_load_object(entry); - if (loadedObject == NULL) { + if (loadedObject == nullptr) { log_error("Failed to load entry %.8s", entry->name); } else if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) { @@ -1719,7 +1719,7 @@ static void window_editor_object_selection_update(rct_window *w) static void window_editor_object_selection_textinput(rct_window *w, rct_widgetindex widgetIndex, char *text) { - if (widgetIndex != WIDX_FILTER_STRING_BUTTON || text == NULL) + if (widgetIndex != WIDX_FILTER_STRING_BUTTON || text == nullptr) return; if (strcmp(_filter_string, text) == 0) @@ -1765,7 +1765,7 @@ static bool filter_string(const ObjectRepositoryItem * item) // Object doesn't have a name utf8 *name = item->Name; - if (name == NULL || name[0] == '\0') + if (name == nullptr || name[0] == '\0') return false; // Get ride type @@ -1787,7 +1787,7 @@ static bool filter_string(const ObjectRepositoryItem * item) for (sint32 i = 0; filter_lower[i] != '\0'; i++) filter_lower[i] = (char)tolower(filter_lower[i]); - return strstr(name_lower, filter_lower) != NULL || (((item->ObjectEntry.flags & 0x0F) == OBJECT_TYPE_RIDE) && strstr(type_lower, filter_lower) != NULL); + return strstr(name_lower, filter_lower) != nullptr || (((item->ObjectEntry.flags & 0x0F) == OBJECT_TYPE_RIDE) && strstr(type_lower, filter_lower) != nullptr); } static bool filter_source(const ObjectRepositoryItem * item) diff --git a/src/openrct2/windows/Error.cpp b/src/openrct2/windows/Error.cpp index fe5025bbf8..04f1b83c25 100644 --- a/src/openrct2/windows/Error.cpp +++ b/src/openrct2/windows/Error.cpp @@ -41,34 +41,34 @@ static void window_error_unknown5(rct_window *w); static void window_error_paint(rct_window *w, rct_drawpixelinfo *dpi); static rct_window_event_list window_error_events = { - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_error_unknown5, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_error_paint, - NULL + nullptr }; static char _window_error_text[512]; diff --git a/src/openrct2/windows/Finances.cpp b/src/openrct2/windows/Finances.cpp index 30474cd9a1..6238d4cc48 100644 --- a/src/openrct2/windows/Finances.cpp +++ b/src/openrct2/windows/Finances.cpp @@ -231,194 +231,194 @@ static void window_finances_research_paint(rct_window *w, rct_drawpixelinfo *dpi // 0x00988EB8 static rct_window_event_list window_finances_summary_events = { - NULL, + nullptr, window_finances_summary_mouseup, - NULL, + nullptr, window_finances_summary_mousedown, - NULL, - NULL, + nullptr, + nullptr, window_finances_summary_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_finances_summary_invalidate, window_finances_summary_paint, - NULL + nullptr }; // 0x00988F28 static rct_window_event_list window_finances_financial_graph_events = { - NULL, + nullptr, window_finances_financial_graph_mouseup, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_finances_financial_graph_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_finances_financial_graph_invalidate, window_finances_financial_graph_paint, - NULL + nullptr }; // 0x00988F98 static rct_window_event_list window_finances_value_graph_events = { - NULL, + nullptr, window_finances_park_value_graph_mouseup, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_finances_park_value_graph_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_finances_park_value_graph_invalidate, window_finances_park_value_graph_paint, - NULL + nullptr }; // 0x00989008 static rct_window_event_list window_finances_profit_graph_events = { - NULL, + nullptr, window_finances_profit_graph_mouseup, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_finances_profit_graph_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_finances_profit_graph_invalidate, window_finances_profit_graph_paint, - NULL + nullptr }; // 0x00989078 static rct_window_event_list window_finances_marketing_events = { - NULL, + nullptr, window_finances_marketing_mouseup, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_finances_marketing_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_finances_marketing_invalidate, window_finances_marketing_paint, - NULL + nullptr }; // 0x009890E8 static rct_window_event_list window_finances_research_events = { - NULL, + nullptr, window_finances_research_mouseup, - NULL, + nullptr, window_finances_research_mousedown, window_finances_research_dropdown, - NULL, + nullptr, window_finances_research_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_finances_research_invalidate, window_finances_research_paint, - NULL + nullptr }; static rct_window_event_list *window_finances_page_events[] = { @@ -549,7 +549,7 @@ void window_finances_open() rct_window *w; w = window_bring_to_front_by_class(WC_FINANCES); - if (w == NULL) { + if (w == nullptr) { w = window_create_auto_pos(530, 257, window_finances_page_events[0], WC_FINANCES, WF_10); w->number = 0; w->frame_no = 0; @@ -582,7 +582,7 @@ void window_finances_research_open() window_finances_open(); w = window_find_by_class(WC_FINANCES); - if (w != NULL) + if (w != nullptr) window_finances_set_page(w, WINDOW_FINANCES_PAGE_RESEARCH); } @@ -666,7 +666,7 @@ static void window_finances_summary_paint(rct_window *w, rct_drawpixelinfo *dpi) y = w->y + 47; // Expenditure / Income heading - draw_string_left_underline(dpi, STR_FINANCES_SUMMARY_EXPENDITURE_INCOME, NULL, COLOUR_BLACK, x, y - 1); + draw_string_left_underline(dpi, STR_FINANCES_SUMMARY_EXPENDITURE_INCOME, nullptr, COLOUR_BLACK, x, y - 1); y += 14; // Expenditure / Income row labels @@ -675,7 +675,7 @@ static void window_finances_summary_paint(rct_window *w, rct_drawpixelinfo *dpi) if (i % 2 == 0) gfx_fill_rect(dpi, x, y, x + 513 - 2, y + 9, ColourMapA[w->colours[1]].lighter | 0x1000000); - gfx_draw_string_left(dpi, window_finances_summary_row_labels[i], NULL, COLOUR_BLACK, x, y - 1); + gfx_draw_string_left(dpi, window_finances_summary_row_labels[i], nullptr, COLOUR_BLACK, x, y - 1); y += 10; } @@ -741,7 +741,7 @@ static void window_finances_summary_paint(rct_window *w, rct_drawpixelinfo *dpi) gfx_fill_rect_inset(dpi, w->x + 8, w->y + 223, w->x + 8 + 513, w->y + 223 + 1, w->colours[1], INSET_RECT_FLAG_BORDER_INSET); // Loan and interest rate - gfx_draw_string_left(dpi, STR_FINANCES_SUMMARY_LOAN, NULL, COLOUR_BLACK, w->x + 4, w->y + 229); + gfx_draw_string_left(dpi, STR_FINANCES_SUMMARY_LOAN, nullptr, COLOUR_BLACK, w->x + 4, w->y + 229); set_format_arg(0, uint16, gBankLoanInterestRate); gfx_draw_string_left(dpi, STR_FINANCES_SUMMARY_AT_X_PER_YEAR, gCommonFormatArgs, COLOUR_BLACK, w->x + 156, w->y + 229); @@ -1203,7 +1203,7 @@ static void window_finances_marketing_paint(rct_window *w, rct_drawpixelinfo *dp } if (noCampaignsActive) { - gfx_draw_string_left(dpi, STR_MARKETING_CAMPAGINS_NONE, NULL, COLOUR_BLACK, x + 4, y); + gfx_draw_string_left(dpi, STR_MARKETING_CAMPAGINS_NONE, nullptr, COLOUR_BLACK, x + 4, y); y += 10; } y += 31; @@ -1218,7 +1218,7 @@ static void window_finances_marketing_paint(rct_window *w, rct_drawpixelinfo *dp money32 pricePerWeek = AdvertisingCampaignPricePerWeek[i]; // Draw button text - gfx_draw_string_left(dpi, MarketingCampaignNames[i][0], NULL, COLOUR_BLACK, x + 4, y - 1); + gfx_draw_string_left(dpi, MarketingCampaignNames[i][0], nullptr, COLOUR_BLACK, x + 4, y - 1); gfx_draw_string_left(dpi, STR_MARKETING_PER_WEEK, &pricePerWeek, COLOUR_BLACK, x + 310, y - 1); y += 12; @@ -1388,9 +1388,9 @@ static void window_finances_set_page(rct_window *w, sint32 page) { w->page = page; w->frame_no = 0; - if (w->viewport != NULL) { + if (w->viewport != nullptr) { w->viewport->width = 0; - w->viewport = NULL; + w->viewport = nullptr; } w->enabled_widgets = window_finances_page_enabled_widgets[page]; diff --git a/src/openrct2/windows/GameBottomToolbar.cpp b/src/openrct2/windows/GameBottomToolbar.cpp index e4f13a2058..70ee1d12c3 100644 --- a/src/openrct2/windows/GameBottomToolbar.cpp +++ b/src/openrct2/windows/GameBottomToolbar.cpp @@ -90,34 +90,34 @@ static void window_game_bottom_toolbar_draw_news_item(rct_drawpixelinfo *dpi, rc * rct2: 0x0097BFDC */ static rct_window_event_list window_game_bottom_toolbar_events = { - NULL, + nullptr, window_game_bottom_toolbar_mouseup, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_game_bottom_toolbar_unknown05, window_game_bottom_toolbar_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_game_bottom_toolbar_tooltip, window_game_bottom_toolbar_cursor, - NULL, + nullptr, window_game_bottom_toolbar_invalidate, window_game_bottom_toolbar_paint, - NULL + nullptr }; static void window_game_bottom_toolbar_invalidate_dirty_widgets(rct_window *w); @@ -200,7 +200,7 @@ static void window_game_bottom_toolbar_mouseup(rct_window *w, rct_widgetindex wi break; rct_window *mainWindow = window_get_main(); - if (mainWindow != NULL) + if (mainWindow != nullptr) window_scroll_to_location(mainWindow, x, y, z); } break; diff --git a/src/openrct2/windows/Guest.cpp b/src/openrct2/windows/Guest.cpp index 8981ab0c7d..593b6f9eba 100644 --- a/src/openrct2/windows/Guest.cpp +++ b/src/openrct2/windows/Guest.cpp @@ -221,186 +221,186 @@ static rct_window_event_list window_guest_overview_events = { window_guest_overview_close, window_guest_overview_mouse_up, window_guest_overview_resize, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_guest_overview_update, - NULL, - NULL, + nullptr, + nullptr, window_guest_overview_tool_update, window_guest_overview_tool_down, - NULL, - NULL, + nullptr, + nullptr, window_guest_overview_tool_abort, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_guest_overview_text_input, window_guest_overview_viewport_rotate, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_guest_overview_invalidate, window_guest_overview_paint, - NULL + nullptr }; static rct_window_event_list window_guest_stats_events = { - NULL, + nullptr, window_guest_mouse_up, window_guest_stats_resize, - NULL, - NULL, + nullptr, + nullptr, window_guest_unknown_05, window_guest_stats_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_guest_stats_invalidate, window_guest_stats_paint, - NULL + nullptr }; static rct_window_event_list window_guest_rides_events = { - NULL, + nullptr, window_guest_mouse_up, window_guest_rides_resize, - NULL, - NULL, + nullptr, + nullptr, window_guest_unknown_05, window_guest_rides_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_guest_rides_scroll_get_size, window_guest_rides_scroll_mouse_down, - NULL, + nullptr, window_guest_rides_scroll_mouse_over, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_guest_rides_tooltip, - NULL, - NULL, + nullptr, + nullptr, window_guest_rides_invalidate, window_guest_rides_paint, window_guest_rides_scroll_paint }; static rct_window_event_list window_guest_finance_events = { - NULL, + nullptr, window_guest_mouse_up, window_guest_finance_resize, - NULL, - NULL, + nullptr, + nullptr, window_guest_unknown_05, window_guest_finance_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_guest_finance_invalidate, window_guest_finance_paint, - NULL + nullptr }; static rct_window_event_list window_guest_thoughts_events = { - NULL, + nullptr, window_guest_mouse_up, window_guest_thoughts_resize, - NULL, - NULL, + nullptr, + nullptr, window_guest_unknown_05, window_guest_thoughts_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_guest_thoughts_invalidate, window_guest_thoughts_paint, - NULL + nullptr }; static rct_window_event_list window_guest_inventory_events = { - NULL, + nullptr, window_guest_mouse_up, window_guest_inventory_resize, - NULL, - NULL, + nullptr, + nullptr, window_guest_unknown_05, window_guest_inventory_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_guest_inventory_invalidate, window_guest_inventory_paint, - NULL + nullptr }; // 0x981D24 @@ -486,7 +486,7 @@ void window_guest_open(rct_peep* peep){ rct_window* window; window = window_bring_to_front_by_number(WC_PEEP, peep->sprite_index); - if (window == NULL){ + if (window == nullptr){ window = window_create_auto_pos(192, 157, &window_guest_overview_events, WC_PEEP, WF_RESIZABLE); window->widgets = window_guest_overview_widgets; window->enabled_widgets = window_guest_page_enabled_widgets[0]; @@ -1146,7 +1146,7 @@ void window_guest_overview_text_input(rct_window *w, rct_widgetindex widgetIndex if (widgetIndex != WIDX_RENAME) return; - if (text == NULL) + if (text == nullptr) return; gGameCommandErrorTitle = STR_CANT_NAME_GUEST; @@ -1169,7 +1169,7 @@ void window_guest_overview_tool_update(rct_window* w, rct_widgetindex widgetInde gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; sint32 map_x, map_y; - footpath_get_coordinates_from_pos(x, y + 16, &map_x, &map_y, NULL, NULL); + footpath_get_coordinates_from_pos(x, y + 16, &map_x, &map_y, nullptr, nullptr); if (map_x != MAP_LOCATION_NULL) { gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; gMapSelectType = MAP_SELECT_TYPE_FULL; @@ -1183,7 +1183,7 @@ void window_guest_overview_tool_update(rct_window* w, rct_widgetindex widgetInde gPickupPeepImage = UINT32_MAX; sint32 interactionType; - get_map_coordinates_from_pos(x, y, VIEWPORT_INTERACTION_MASK_NONE, NULL, NULL, &interactionType, NULL, NULL); + get_map_coordinates_from_pos(x, y, VIEWPORT_INTERACTION_MASK_NONE, nullptr, nullptr, &interactionType, nullptr, nullptr); if (interactionType == VIEWPORT_INTERACTION_ITEM_NONE) return; @@ -1217,7 +1217,7 @@ void window_guest_overview_tool_down(rct_window* w, rct_widgetindex widgetIndex, sint32 dest_x, dest_y; rct_map_element* mapElement; - footpath_get_coordinates_from_pos(x, y + 16, &dest_x, &dest_y, NULL, &mapElement); + footpath_get_coordinates_from_pos(x, y + 16, &dest_x, &dest_y, nullptr, &mapElement); if (dest_x == MAP_LOCATION_NULL) return; @@ -1479,7 +1479,7 @@ void window_guest_stats_paint(rct_window *w, rct_drawpixelinfo *dpi) gfx_fill_rect_inset(dpi, x, y - 6, x + 179, y - 5, w->colours[1], INSET_RECT_FLAG_BORDER_INSET); // Preferred Ride - gfx_draw_string_left(dpi, STR_GUEST_STAT_PREFERRED_RIDE, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_GUEST_STAT_PREFERRED_RIDE, nullptr, COLOUR_BLACK, x, y); y += 10; // Intensity @@ -1675,7 +1675,7 @@ void window_guest_rides_paint(rct_window *w, rct_drawpixelinfo *dpi) // dx sint32 y = w->y + window_guest_rides_widgets[WIDX_PAGE_BACKGROUND].top + 2; - gfx_draw_string_left(dpi, STR_GUEST_LABEL_RIDES_BEEN_ON, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_GUEST_LABEL_RIDES_BEEN_ON, nullptr, COLOUR_BLACK, x, y); y = w->y + window_guest_rides_widgets[WIDX_PAGE_BACKGROUND].bottom - 12; @@ -1938,7 +1938,7 @@ void window_guest_thoughts_paint(rct_window *w, rct_drawpixelinfo *dpi) // dx sint32 y = w->y + window_guest_thoughts_widgets[WIDX_PAGE_BACKGROUND].top + 4; - gfx_draw_string_left(dpi, STR_GUEST_RECENT_THOUGHTS_LABEL, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_GUEST_RECENT_THOUGHTS_LABEL, nullptr, COLOUR_BLACK, x, y); y += 10; for (rct_peep_thought* thought = peep->thoughts; thought < &peep->thoughts[PEEP_MAX_THOUGHTS]; ++thought){ @@ -2114,7 +2114,7 @@ void window_guest_inventory_paint(rct_window *w, rct_drawpixelinfo *dpi) sint32 maxY = w->y + w->height - 22; sint32 numItems = 0; - gfx_draw_string_left(dpi, STR_CARRYING, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_CARRYING, nullptr, COLOUR_BLACK, x, y); y += 10; for (sint32 item = 0; item < SHOP_ITEM_COUNT; item++) { @@ -2127,6 +2127,6 @@ void window_guest_inventory_paint(rct_window *w, rct_drawpixelinfo *dpi) } if (numItems == 0) { - gfx_draw_string_left(dpi, STR_NOTHING, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_NOTHING, nullptr, COLOUR_BLACK, x, y); } } diff --git a/src/openrct2/windows/GuestList.cpp b/src/openrct2/windows/GuestList.cpp index 85433a0cfb..3111073d54 100644 --- a/src/openrct2/windows/GuestList.cpp +++ b/src/openrct2/windows/GuestList.cpp @@ -102,31 +102,31 @@ static void window_guest_list_paint(rct_window *w, rct_drawpixelinfo *dpi); static void window_guest_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint32 scrollIndex); static rct_window_event_list window_guest_list_events = { - NULL, + nullptr, window_guest_list_mouseup, window_guest_list_resize, window_guest_list_mousedown, window_guest_list_dropdown, - NULL, + nullptr, window_guest_list_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_guest_list_scrollgetsize, window_guest_list_scrollmousedown, - NULL, + nullptr, window_guest_list_scrollmouseover, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_guest_list_tooltip, - NULL, - NULL, + nullptr, + nullptr, window_guest_list_invalidate, window_guest_list_paint, window_guest_list_scrollpaint @@ -191,7 +191,7 @@ void window_guest_list_open() // Check if window is already open window = window_bring_to_front_by_class(WC_GUEST_LIST); - if (window != NULL) + if (window != nullptr) return; window = window_create_auto_pos(350, 330, &window_guest_list_events, WC_GUEST_LIST, WF_10 | WF_RESIZABLE); diff --git a/src/openrct2/windows/InstallTrack.cpp b/src/openrct2/windows/InstallTrack.cpp index 89c6b87017..084fbadcc8 100644 --- a/src/openrct2/windows/InstallTrack.cpp +++ b/src/openrct2/windows/InstallTrack.cpp @@ -63,32 +63,32 @@ static void window_install_track_text_input(rct_window *w, rct_widgetindex widge static rct_window_event_list window_install_track_events = { window_install_track_close, window_install_track_mouseup, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_install_track_text_input, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_install_track_invalidate, window_install_track_paint, - NULL + nullptr }; static rct_track_td6 *_trackDesign; @@ -106,7 +106,7 @@ static void window_install_track_design(rct_window *w); void window_install_track_open(const utf8 *path) { _trackDesign = track_design_open(path); - if (_trackDesign == NULL) { + if (_trackDesign == nullptr) { window_error_open(STR_UNABLE_TO_LOAD_FILE, STR_NONE); return; } @@ -116,7 +116,7 @@ void window_install_track_open(const utf8 *path) log_error("Failed to load track (ride type null): %s", path); return; } - if (object_manager_load_object(&_trackDesign->vehicle_object) == NULL) { + if (object_manager_load_object(&_trackDesign->vehicle_object) == nullptr) { log_error("Failed to load track (vehicle load fail): %s", path); return; } @@ -157,7 +157,7 @@ static void window_install_track_close(rct_window *w) SafeFree(_trackName); SafeFree(_trackDesignPreviewPixels); track_design_dispose(_trackDesign); - _trackDesign = NULL; + _trackDesign = nullptr; } /** @@ -242,7 +242,7 @@ static void window_install_track_paint(rct_window *w, rct_drawpixelinfo *dpi) if (td6->track_flags & TRACK_DESIGN_FLAG_SCENERY_UNAVAILABLE) { if (!gTrackDesignSceneryToggle) { // Scenery not available - gfx_draw_string_centred_clipped(dpi, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, NULL, COLOUR_BLACK, x, y, 368); + gfx_draw_string_centred_clipped(dpi, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, nullptr, COLOUR_BLACK, x, y, 368); y -= 10; } } diff --git a/src/openrct2/windows/LoadSave.cpp b/src/openrct2/windows/LoadSave.cpp index 44df6a791b..e535974809 100644 --- a/src/openrct2/windows/LoadSave.cpp +++ b/src/openrct2/windows/LoadSave.cpp @@ -83,30 +83,30 @@ static void window_loadsave_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, s static rct_window_event_list window_loadsave_events = { window_loadsave_close, window_loadsave_mouseup, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_loadsave_scrollgetsize, window_loadsave_scrollmousedown, - NULL, + nullptr, window_loadsave_scrollmouseover, window_loadsave_textinput, - NULL, - NULL, + nullptr, + nullptr, window_loadsave_tooltip, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_loadsave_paint, window_loadsave_scrollpaint }; @@ -129,7 +129,7 @@ typedef struct loadsave_list_item { static loadsave_callback _loadSaveCallback; static sint32 _listItemsCount = 0; -static loadsave_list_item *_listItems = NULL; +static loadsave_list_item *_listItems = nullptr; static char _directory[MAX_PATH]; static char _shortenedDirectory[MAX_PATH]; static char _parentDirectory[MAX_PATH]; @@ -164,7 +164,7 @@ static sint32 window_loadsave_get_dir(utf8 *last_save, char *path, const char *s rct_window *window_loadsave_open(sint32 type, char *defaultName) { - _loadSaveCallback = NULL; + _loadSaveCallback = nullptr; _type = type; _defaultName[0] = '\0'; @@ -173,7 +173,7 @@ rct_window *window_loadsave_open(sint32 type, char *defaultName) } rct_window *w = window_bring_to_front_by_class(WC_LOADSAVE); - if (w == NULL) { + if (w == nullptr) { w = window_create_centred(WW, WH, &window_loadsave_events, WC_LOADSAVE, WF_STICK_TO_FRONT); w->widgets = window_loadsave_widgets; w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_UP) | (1 << WIDX_NEW_FOLDER) | (1 << WIDX_NEW_FILE) | (1 << WIDX_SORT_NAME) | (1 << WIDX_SORT_DATE) | (1 << WIDX_BROWSE) | (1 << WIDX_DEFAULT); @@ -232,7 +232,7 @@ rct_window *window_loadsave_open(sint32 type, char *defaultName) if (!success) { window_close(w); - return NULL; + return nullptr; } w->no_list_items = _listItemsCount; @@ -242,9 +242,9 @@ rct_window *window_loadsave_open(sint32 type, char *defaultName) static void window_loadsave_close(rct_window *w) { - if (_listItems != NULL) { + if (_listItems != nullptr) { free(_listItems); - _listItems = NULL; + _listItems = nullptr; } window_close_by_class(WC_LOADSAVE_OVERWRITE_PROMPT); @@ -259,7 +259,7 @@ static bool browse(bool isSave, char *path, size_t pathSize) file_dialog_desc desc = { 0 }; desc.initial_directory = _directory; desc.type = isSave ? FD_SAVE : FD_OPEN; - desc.default_filename = isSave ? path : NULL; + desc.default_filename = isSave ? path : nullptr; rct_string_id title = STR_NONE; switch (_type & 0x0E) { @@ -317,7 +317,7 @@ static void window_loadsave_mouseup(rct_window *w, rct_widgetindex widgetIndex) window_text_input_open(w, WIDX_NEW_FILE, STR_NONE, STR_FILEBROWSER_FILE_NAME_PROMPT, STR_STRING, (uintptr_t)&_defaultName, 64); break; case WIDX_NEW_FOLDER: - window_text_input_raw_open(w, WIDX_NEW_FOLDER, STR_NONE, STR_FILEBROWSER_FOLDER_NAME_PROMPT, NULL, 64); + window_text_input_raw_open(w, WIDX_NEW_FOLDER, STR_NONE, STR_FILEBROWSER_FOLDER_NAME_PROMPT, nullptr, 64); break; case WIDX_BROWSE: if (browse(isSave, path, sizeof(path))) @@ -421,7 +421,7 @@ static void window_loadsave_textinput(rct_window *w, rct_widgetindex widgetIndex char path[MAX_PATH]; sint32 i, overwrite; - if (text == NULL || text[0] == 0) + if (text == nullptr || text[0] == 0) return; switch (widgetIndex) { @@ -581,7 +581,7 @@ static void window_loadsave_populate_list(rct_window *w, sint32 includeNewItem, } _shortenedDirectory[0] = '\0'; - if (_listItems != NULL) + if (_listItems != nullptr) free(_listItems); sint32 listItemCapacity = 8; @@ -600,7 +600,7 @@ static void window_loadsave_populate_list(rct_window *w, sint32 includeNewItem, if (listItemCapacity <= _listItemsCount) { listItemCapacity *= 2; void *new_memory = realloc(_listItems, listItemCapacity * sizeof(loadsave_list_item)); - if (new_memory == NULL) { + if (new_memory == nullptr) { log_error("Failed to reallocate memory for loadsave list"); return; } @@ -628,7 +628,7 @@ static void window_loadsave_populate_list(rct_window *w, sint32 includeNewItem, // Remove everything past the now last separator char *ch = strrchr(_parentDirectory, *PATH_SEPARATOR); - if (ch != NULL) { + if (ch != nullptr) { *(ch + 1) = '\0'; } else if (drives) { // If on Windows, clear the entire path to show the drives @@ -675,7 +675,7 @@ static void window_loadsave_populate_list(rct_window *w, sint32 includeNewItem, char * extToken; bool showExtension = false; extToken = strtok(extCopy, ";"); - while (extToken != NULL) { + while (extToken != nullptr) { safe_strcpy(filter, directory, sizeof(filter)); safe_strcat_path(filter, "*", sizeof(filter)); path_append_extension(filter, extToken, sizeof(filter)); @@ -706,7 +706,7 @@ static void window_loadsave_populate_list(rct_window *w, sint32 includeNewItem, } platform_enumerate_files_end(fileEnumHandle); - extToken = strtok(NULL, ";"); + extToken = strtok(nullptr, ";"); showExtension = true; //Show any extension after the first iteration } @@ -716,7 +716,7 @@ static void window_loadsave_populate_list(rct_window *w, sint32 includeNewItem, static void window_loadsave_invoke_callback(sint32 result, const utf8 * path) { - if (_loadSaveCallback != NULL) { + if (_loadSaveCallback != nullptr) { _loadSaveCallback(result, path); } } @@ -872,34 +872,34 @@ static void window_overwrite_prompt_mouseup(rct_window *w, rct_widgetindex widge static void window_overwrite_prompt_paint(rct_window *w, rct_drawpixelinfo *dpi); static rct_window_event_list window_overwrite_prompt_events = { - NULL, + nullptr, window_overwrite_prompt_mouseup, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_overwrite_prompt_paint, - NULL + nullptr }; static char _window_overwrite_prompt_name[256]; @@ -931,7 +931,7 @@ static void window_overwrite_prompt_mouseup(rct_window *w, rct_widgetindex widge switch (widgetIndex) { case WIDX_OVERWRITE_OVERWRITE: loadsaveWindow = window_find_by_class(WC_LOADSAVE); - if (loadsaveWindow != NULL) + if (loadsaveWindow != nullptr) window_loadsave_select(loadsaveWindow, _window_overwrite_prompt_path); // As the window_loadsave_select function can change the order of the // windows we can't use window_close(w). diff --git a/src/openrct2/windows/Map.cpp b/src/openrct2/windows/Map.cpp index f4cc23a52f..3386af1af0 100644 --- a/src/openrct2/windows/Map.cpp +++ b/src/openrct2/windows/Map.cpp @@ -144,27 +144,27 @@ static rct_window_event_list window_map_events = { window_map_mouseup, window_map_resize, window_map_mousedown, - NULL, - NULL, + nullptr, + nullptr, window_map_update, - NULL, - NULL, + nullptr, + nullptr, window_map_toolupdate, window_map_tooldown, window_map_tooldrag, - NULL, + nullptr, window_map_toolabort, - NULL, + nullptr, window_map_scrollgetsize, window_map_scrollmousedown, window_map_scrollmousedown, - NULL, + nullptr, window_map_textinput, - NULL, - NULL, + nullptr, + nullptr, window_map_tooltip, - NULL, - NULL, + nullptr, + nullptr, window_map_invalidate, window_map_paint, window_map_scrollpaint @@ -213,14 +213,14 @@ void window_map_open() // Check if window is already open w = window_bring_to_front_by_class(WC_MAP); - if (w != NULL) { + if (w != nullptr) { w->selected_tab = 0; w->list_information_type = 0; return; } _mapImageData = Memory::Allocate(); - if (_mapImageData == NULL) { + if (_mapImageData == nullptr) { return; } @@ -270,7 +270,7 @@ void window_map_reset() // Check if window is even opened w = window_bring_to_front_by_class(WC_MAP); - if (w == NULL) { + if (w == nullptr) { return; } @@ -578,7 +578,7 @@ static void window_map_scrollmousedown(rct_window *w, sint32 scrollIndex, sint32 mapZ = map_element_height(x, y); mainWindow = window_get_main(); - if (mainWindow != NULL) { + if (mainWindow != nullptr) { window_scroll_to_location(mainWindow, mapX, mapY, mapZ); } @@ -644,7 +644,7 @@ static void window_map_textinput(rct_window *w, rct_widgetindex widgetIndex, cha sint32 size; char* end; - if (text == NULL) + if (text == nullptr) return; switch (widgetIndex) { @@ -871,7 +871,7 @@ static void window_map_paint(rct_window *w, rct_drawpixelinfo *dpi) } } } else if (!widget_is_active_tool(w, WIDX_SET_LAND_RIGHTS)) { - gfx_draw_string_left(dpi, STR_MAP_SIZE, NULL, w->colours[1], w->x + 4, w->y + w->widgets[WIDX_MAP_SIZE_SPINNER].top + 1); + gfx_draw_string_left(dpi, STR_MAP_SIZE, nullptr, w->colours[1], w->x + 4, w->y + w->widgets[WIDX_MAP_SIZE_SPINNER].top + 1); } } @@ -928,11 +928,11 @@ static void window_map_centre_on_view_point() sint16 ax, bx, cx, dx; sint16 bp, di; - if (w == NULL || w->viewport == NULL) + if (w == nullptr || w->viewport == nullptr) return; w_map = window_find_by_class(WC_MAP); - if (w_map == NULL) + if (w_map == nullptr) return; rct_xy16 offset = MiniMapOffsets[get_current_rotation()]; @@ -1145,11 +1145,11 @@ static void window_map_paint_train_overlay(rct_drawpixelinfo *dpi) static void window_map_paint_hud_rectangle(rct_drawpixelinfo *dpi) { rct_window *main_window = window_get_main(); - if (main_window == NULL) + if (main_window == nullptr) return; rct_viewport *viewport = main_window->viewport; - if (viewport == NULL) + if (viewport == nullptr) return; rct_xy16 offset = MiniMapOffsets[get_current_rotation()]; @@ -1363,7 +1363,7 @@ static void window_map_set_peep_spawn_tool_down(sint32 x, sint32 y) return; surfaceMapElement = map_get_surface_element_at(mapX >> 5, mapY >> 5); - if (surfaceMapElement == NULL) { + if (surfaceMapElement == nullptr) { return; } if (surfaceMapElement->properties.surface.ownership & 0xF0) { diff --git a/src/openrct2/windows/MapTooltip.cpp b/src/openrct2/windows/MapTooltip.cpp index 4c1d7dbcb9..cc9768c1ea 100644 --- a/src/openrct2/windows/MapTooltip.cpp +++ b/src/openrct2/windows/MapTooltip.cpp @@ -32,34 +32,34 @@ static void window_map_tooltip_update(rct_window *w); static void window_map_tooltip_paint(rct_window *w, rct_drawpixelinfo *dpi); static rct_window_event_list window_map_tooltip_events = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_map_tooltip_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_map_tooltip_paint, - NULL + nullptr }; #define MAP_TOOLTIP_ARGS @@ -97,7 +97,7 @@ void window_map_tooltip_update_visibility() if (_cursorHoldDuration < 25 || stringId == STR_NONE || input_test_place_object_modifier((PLACE_OBJECT_MODIFIER) (PLACE_OBJECT_MODIFIER_COPY_Z | PLACE_OBJECT_MODIFIER_SHIFT_Z)) || - window_find_by_class(WC_ERROR) != NULL + window_find_by_class(WC_ERROR) != nullptr ) { window_close_by_class(WC_MAP_TOOLTIP); } else { @@ -121,7 +121,7 @@ static void window_map_tooltip_open() y = state->y + 15; w = window_find_by_class(WC_MAP_TOOLTIP); - if (w == NULL) { + if (w == nullptr) { w = window_create( x, y, width, height, &window_map_tooltip_events, WC_MAP_TOOLTIP, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND ); diff --git a/src/openrct2/windows/MazeConstruction.cpp b/src/openrct2/windows/MazeConstruction.cpp index e4e4f65e4f..ce16980d48 100644 --- a/src/openrct2/windows/MazeConstruction.cpp +++ b/src/openrct2/windows/MazeConstruction.cpp @@ -104,30 +104,30 @@ static rct_window_event_list window_maze_construction_events = { window_maze_construction_mouseup, window_maze_construction_resize, window_maze_construction_mousedown, - NULL, - NULL, + nullptr, + nullptr, window_maze_construction_update, - NULL, - NULL, + nullptr, + nullptr, window_maze_construction_toolupdate, window_maze_construction_tooldown, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_maze_construction_invalidate, window_maze_construction_paint, - NULL + nullptr }; #pragma endregion @@ -297,7 +297,7 @@ static void window_maze_construction_mousedown(rct_window *w, rct_widgetindex wi static void window_maze_construction_update(rct_window *w) { rct_ride *ride = get_ride(_currentRideIndex); - if (ride == NULL || ride->status != RIDE_STATUS_CLOSED) { + if (ride == nullptr || ride->status != RIDE_STATUS_CLOSED) { window_close(w); return; } @@ -454,7 +454,7 @@ void window_maze_construction_update_pressed_widgets() rct_window *w; w = window_find_by_class(WC_RIDE_CONSTRUCTION); - if (w == NULL) + if (w == nullptr) return; uint64 pressedWidgets = w->pressed_widgets; diff --git a/src/openrct2/windows/NetworkStatus.cpp b/src/openrct2/windows/NetworkStatus.cpp index 973c8b5058..f33332c5a9 100644 --- a/src/openrct2/windows/NetworkStatus.cpp +++ b/src/openrct2/windows/NetworkStatus.cpp @@ -51,35 +51,35 @@ static void window_network_status_paint(rct_window *w, rct_drawpixelinfo *dpi); static rct_window_event_list window_network_status_events = { window_network_status_onclose, window_network_status_mouseup, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_network_status_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_network_status_textinput, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_network_status_invalidate, window_network_status_paint, - NULL + nullptr }; -static close_callback _onClose = NULL; +static close_callback _onClose = nullptr; void window_network_status_open(const char* text, close_callback onClose) { @@ -88,7 +88,7 @@ void window_network_status_open(const char* text, close_callback onClose) // Check if window is already open rct_window *window = window_bring_to_front_by_class_with_flags(WC_NETWORK_STATUS, 0); - if (window != NULL) + if (window != nullptr) return; window = window_create_centred(420, 90, &window_network_status_events, WC_NETWORK_STATUS, WF_10 | WF_TRANSPARENT); @@ -110,7 +110,7 @@ void window_network_status_open(const char* text, close_callback onClose) void window_network_status_close() { - _onClose = NULL; + _onClose = nullptr; window_close_by_class(WC_NETWORK_STATUS); } @@ -118,7 +118,7 @@ void window_network_status_open_password() { rct_window* window; window = window_bring_to_front_by_class(WC_NETWORK_STATUS); - if (window == NULL) + if (window == nullptr) return; window_text_input_raw_open(window, WIDX_PASSWORD, STR_PASSWORD_REQUIRED, STR_PASSWORD_REQUIRED_DESC, _password, 32); @@ -126,7 +126,7 @@ void window_network_status_open_password() static void window_network_status_onclose(rct_window *w) { - if (_onClose != NULL) { + if (_onClose != nullptr) { _onClose(); } } @@ -150,11 +150,11 @@ static void window_network_status_textinput(rct_window *w, rct_widgetindex widge _password[0] = '\0'; switch (widgetIndex) { case WIDX_PASSWORD: - if (text != NULL) + if (text != nullptr) safe_strcpy(_password, text, sizeof(_password)); break; } - if (text == NULL) { + if (text == nullptr) { network_shutdown_client(); } else { network_send_password(_password); diff --git a/src/openrct2/windows/NewCampaign.cpp b/src/openrct2/windows/NewCampaign.cpp index 7295b39cd9..708c5f404a 100644 --- a/src/openrct2/windows/NewCampaign.cpp +++ b/src/openrct2/windows/NewCampaign.cpp @@ -65,34 +65,34 @@ static void window_new_campaign_invalidate(rct_window *w); static void window_new_campaign_paint(rct_window *w, rct_drawpixelinfo *dpi); static rct_window_event_list window_new_campaign_events = { - NULL, + nullptr, window_new_campaign_mouseup, - NULL, + nullptr, window_new_campaign_mousedown, window_new_campaign_dropdown, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_new_campaign_invalidate, window_new_campaign_paint, - NULL + nullptr }; uint8 window_new_campaign_rides[MAX_RIDES]; @@ -132,7 +132,7 @@ void window_new_campaign_open(sint16 campaignType) sint32 i, numApplicableRides; w = window_bring_to_front_by_class(WC_NEW_CAMPAIGN); - if (w != NULL) { + if (w != nullptr) { if (w->campaign.campaign_type == campaignType) return; @@ -206,7 +206,7 @@ static void window_new_campaign_get_shop_items() uint64 items = 0; FOR_ALL_RIDES(i, ride) { rct_ride_entry *rideType = get_ride_entry(ride->subtype); - if (rideType == NULL) { + if (rideType == nullptr) { continue; } uint8 itemType = rideType->shop_item; diff --git a/src/openrct2/windows/NewRide.cpp b/src/openrct2/windows/NewRide.cpp index 5422aaa33a..55d32fe398 100644 --- a/src/openrct2/windows/NewRide.cpp +++ b/src/openrct2/windows/NewRide.cpp @@ -214,31 +214,31 @@ static void window_new_ride_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, s // 0x0098E354 static rct_window_event_list window_new_ride_events = { - NULL, + nullptr, window_new_ride_mouseup, - NULL, + nullptr, window_new_ride_mousedown, - NULL, - NULL, + nullptr, + nullptr, window_new_ride_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_new_ride_scrollgetsize, window_new_ride_scrollmousedown, - NULL, + nullptr, window_new_ride_scrollmouseover, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_new_ride_tooltip, - NULL, - NULL, + nullptr, + nullptr, window_new_ride_invalidate, window_new_ride_paint, window_new_ride_scrollpaint @@ -452,7 +452,7 @@ rct_window *window_new_ride_open() rct_window *w; w = window_bring_to_front_by_class(WC_CONSTRUCT_RIDE); - if (w != NULL) + if (w != nullptr) return w; // Not sure what these windows are @@ -514,7 +514,7 @@ void window_new_ride_focus(ride_list_item rideItem) // Find the first non-null ride type index. w = window_find_by_class(WC_CONSTRUCT_RIDE); - if (w == NULL) + if (w == nullptr) return; rideEntry = get_ride_entry(rideItem.entry_index); @@ -907,8 +907,8 @@ static ride_list_item window_new_ride_scroll_get_ride_list_item_at(rct_window *w static sint32 get_num_track_designs(ride_list_item item) { char entry[9]; - const char *entryPtr = NULL; - rct_ride_entry * rideEntry = NULL; + const char *entryPtr = nullptr; + rct_ride_entry * rideEntry = nullptr; if (item.type < 0x80) { rideEntry = get_ride_entry(item.entry_index); @@ -918,7 +918,7 @@ static sint32 get_num_track_designs(ride_list_item item) } } - if (rideEntry != NULL && ride_type_has_ride_groups(item.type)) + if (rideEntry != nullptr && ride_type_has_ride_groups(item.type)) { const ride_group * rideGroup = get_ride_group(item.type, rideEntry); return (sint32)track_repository_get_count_for_ride_group(item.type, rideGroup); diff --git a/src/openrct2/windows/ObjectLoadError.cpp b/src/openrct2/windows/ObjectLoadError.cpp index bf33e235bd..05254577db 100644 --- a/src/openrct2/windows/ObjectLoadError.cpp +++ b/src/openrct2/windows/ObjectLoadError.cpp @@ -70,37 +70,37 @@ static void window_object_load_error_scrollpaint(rct_window *w, rct_drawpixelinf static rct_window_event_list window_object_load_error_events = { window_object_load_error_close, window_object_load_error_mouseup, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_object_load_error_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_object_load_error_scrollgetsize, window_object_load_error_scrollmousedown, - NULL, + nullptr, window_object_load_error_scrollmouseover, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_object_load_error_paint, window_object_load_error_scrollpaint }; -rct_object_entry * invalid_entries = NULL; +rct_object_entry * invalid_entries = nullptr; sint32 highlighted_index = -1; -utf8* file_path = NULL; +utf8* file_path = nullptr; /** * Returns an rct_string_id that represents an rct_object_entry's type. @@ -162,7 +162,7 @@ static utf8* combine_object_names(rct_window *w) // Something's gone wrong, this shouldn't happen // We don't want to allocate stupidly large amounts of memory // for no reason, so bail - return NULL; + return nullptr; } utf8* buffer; @@ -189,7 +189,7 @@ rct_window * window_object_load_error_open(utf8 * path, size_t numMissingObjects // Check if window is already open rct_window * window = window_bring_to_front_by_class(WC_OBJECT_LOAD_ERROR); - if (window == NULL) { + if (window == nullptr) { window = window_create_centred( WW, WH, @@ -328,10 +328,10 @@ static void window_object_load_error_scrollpaint(rct_window *w, rct_drawpixelinf // ... source game ... rct_string_id sourceStringId = object_manager_get_source_game_string(&invalid_entries[i]); - gfx_draw_string_left(dpi, sourceStringId, NULL, COLOUR_DARK_GREEN, SOURCE_COL_LEFT, y); + gfx_draw_string_left(dpi, sourceStringId, nullptr, COLOUR_DARK_GREEN, SOURCE_COL_LEFT, y); // ... and type rct_string_id type = get_object_type_string(&invalid_entries[i]); - gfx_draw_string_left(dpi, type, NULL, COLOUR_DARK_GREEN, TYPE_COL_LEFT, y); + gfx_draw_string_left(dpi, type, nullptr, COLOUR_DARK_GREEN, TYPE_COL_LEFT, y); } } diff --git a/src/openrct2/windows/Park.cpp b/src/openrct2/windows/Park.cpp index c7d2b40d14..dc3148a79a 100644 --- a/src/openrct2/windows/Park.cpp +++ b/src/openrct2/windows/Park.cpp @@ -206,215 +206,215 @@ static rct_window_event_list window_park_entrance_events = { window_park_entrance_resize, window_park_entrance_mousedown, window_park_entrance_dropdown, - NULL, + nullptr, window_park_entrance_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_park_entrance_textinput, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_park_entrance_invalidate, window_park_entrance_paint, - NULL + nullptr }; static rct_window_event_list window_park_rating_events = { - NULL, + nullptr, window_park_rating_mouseup, window_park_rating_resize, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_park_rating_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_park_rating_invalidate, window_park_rating_paint, - NULL + nullptr }; static rct_window_event_list window_park_guests_events = { - NULL, + nullptr, window_park_guests_mouseup, window_park_guests_resize, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_park_guests_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_park_guests_invalidate, window_park_guests_paint, - NULL + nullptr }; static rct_window_event_list window_park_price_events = { - NULL, + nullptr, window_park_price_mouseup, window_park_price_resize, window_park_price_mousedown, - NULL, - NULL, + nullptr, + nullptr, window_park_price_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_park_price_invalidate, window_park_price_paint, - NULL + nullptr }; static rct_window_event_list window_park_stats_events = { - NULL, + nullptr, window_park_stats_mouseup, window_park_stats_resize, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_park_stats_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_park_stats_invalidate, window_park_stats_paint, - NULL + nullptr }; static rct_window_event_list window_park_objective_events = { - NULL, + nullptr, window_park_objective_mouseup, window_park_objective_resize, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_park_objective_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_park_objective_textinput, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_park_objective_invalidate, window_park_objective_paint, - NULL + nullptr }; static rct_window_event_list window_park_awards_events = { - NULL, + nullptr, window_park_awards_mouseup, window_park_awards_resize, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_park_awards_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_park_awards_invalidate, window_park_awards_paint, - NULL + nullptr }; static rct_window_event_list *window_park_page_events[] = { @@ -602,7 +602,7 @@ void window_park_entrance_open() rct_window* window; window = window_bring_to_front_by_class(WC_PARK_INFORMATION); - if (window == NULL) { + if (window == nullptr) { window = window_park_open(); window->viewport_focus_coordinates.y = -1; window->viewport_focus_coordinates.x = -1; @@ -744,7 +744,7 @@ static void window_park_entrance_update(rct_window *w) */ static void window_park_entrance_textinput(rct_window *w, rct_widgetindex widgetIndex, char *text) { - if (widgetIndex == WIDX_RENAME && text != NULL) + if (widgetIndex == WIDX_RENAME && text != nullptr) park_set_name(text); } @@ -839,7 +839,7 @@ static void window_park_entrance_paint(rct_window *w, rct_drawpixelinfo *dpi) window_park_draw_tab_images(dpi, w); // Draw viewport - if (w->viewport != NULL) { + if (w->viewport != nullptr) { window_draw_viewport(dpi, w); if (w->viewport->flags & VIEWPORT_FLAG_SOUND_ON) gfx_draw_sprite(dpi, SPR_HEARING_VIEWPORT, w->x + 2, w->y + 2, 0); @@ -886,14 +886,14 @@ static void window_park_init_viewport(rct_window *w) } } - if (w->viewport == NULL) { + if (w->viewport == nullptr) { viewportFlags = gConfigGeneral.always_show_gridlines ? VIEWPORT_FLAG_GRIDLINES : 0; } else { // if (w->var_482 == x && w->var_484 == y && w->var_486 == z && (uint16)w->var_488 >> 8 == r) // return; viewport = w->viewport; - w->viewport = NULL; + w->viewport = nullptr; viewportFlags = viewport->flags; viewport->width = 0; viewport_update_pointers(); @@ -910,7 +910,7 @@ static void window_park_init_viewport(rct_window *w) if (zr != 0xFFFF) { // Create viewport - if (w->viewport == NULL) { + if (w->viewport == nullptr) { rct_widget *viewportWidget = &window_park_entrance_widgets[WIDX_VIEWPORT]; viewport_create( w, @@ -930,7 +930,7 @@ static void window_park_init_viewport(rct_window *w) } } - if (w->viewport != NULL) + if (w->viewport != nullptr) w->viewport->flags = viewportFlags; window_invalidate(w); } @@ -948,7 +948,7 @@ void window_park_rating_open() rct_window* window; window = window_bring_to_front_by_class(WC_PARK_INFORMATION); - if (window == NULL) { + if (window == nullptr) { window = window_park_open(); window->viewport_focus_coordinates.x = -1; window->viewport_focus_coordinates.y = -1; @@ -958,7 +958,7 @@ void window_park_rating_open() if (window->classification == gCurrentToolWidget.window_classification && window->number == gCurrentToolWidget.window_number) tool_cancel(); - window->viewport = NULL; + window->viewport = nullptr; window->page = WINDOW_PARK_PAGE_RATING; window_invalidate(window); window->widgets = window_park_rating_widgets; @@ -1062,7 +1062,7 @@ void window_park_guests_open() rct_window* window; window = window_bring_to_front_by_class(WC_PARK_INFORMATION); - if (window == NULL) { + if (window == nullptr) { window = window_park_open(); window->viewport_focus_coordinates.x = -1; window->viewport_focus_coordinates.y = -1; @@ -1072,7 +1072,7 @@ void window_park_guests_open() if (window->classification == gCurrentToolWidget.window_classification && window->number == gCurrentToolWidget.window_number) tool_cancel(); - window->viewport = NULL; + window->viewport = nullptr; window->page = WINDOW_PARK_PAGE_GUESTS; window_invalidate(window); window->widgets = window_park_guests_widgets; @@ -1426,7 +1426,7 @@ void window_park_objective_open() rct_window* window; window = window_bring_to_front_by_class(WC_PARK_INFORMATION); - if (window == NULL) { + if (window == nullptr) { window = window_park_open(); window->viewport_focus_coordinates.x = -1; window->viewport_focus_coordinates.y = -1; @@ -1436,7 +1436,7 @@ void window_park_objective_open() if (window->classification == gCurrentToolWidget.window_classification && window->number == gCurrentToolWidget.window_number) tool_cancel(); - window->viewport = NULL; + window->viewport = nullptr; window->page = WINDOW_PARK_PAGE_OBJECTIVE; window_invalidate(window); window->widgets = window_park_objective_widgets; @@ -1507,7 +1507,7 @@ static void window_park_objective_update(rct_window *w) */ static void window_park_objective_textinput(rct_window *w, rct_widgetindex widgetIndex, char *text) { - if (widgetIndex == WIDX_ENTER_NAME && text != NULL && text[0] != 0) { + if (widgetIndex == WIDX_ENTER_NAME && text != nullptr && text[0] != 0) { scenario_success_submit_name(text); window_invalidate(w); } @@ -1552,7 +1552,7 @@ static void window_park_objective_paint(rct_window *w, rct_drawpixelinfo *dpi) y += 5; // Your objective: - gfx_draw_string_left(dpi, STR_OBJECTIVE_LABEL, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_OBJECTIVE_LABEL, nullptr, COLOUR_BLACK, x, y); y += 10; // Objective @@ -1567,7 +1567,7 @@ static void window_park_objective_paint(rct_window *w, rct_drawpixelinfo *dpi) if (gScenarioCompletedCompanyValue != MONEY32_UNDEFINED) { if ((uint32)gScenarioCompletedCompanyValue == 0x80000001) { // Objective failed - gfx_draw_string_left_wrapped(dpi, NULL, x, y, 222, STR_OBJECTIVE_FAILED, COLOUR_BLACK); + gfx_draw_string_left_wrapped(dpi, nullptr, x, y, 222, STR_OBJECTIVE_FAILED, COLOUR_BLACK); } else { // Objective completed set_format_arg(0, money32, gScenarioCompletedCompanyValue); @@ -1589,7 +1589,7 @@ void window_park_awards_open() rct_window* window; window = window_bring_to_front_by_class(WC_PARK_INFORMATION); - if (window == NULL) { + if (window == nullptr) { window = window_park_open(); window->viewport_focus_coordinates.x = -1; window->viewport_focus_coordinates.y = -1; @@ -1599,7 +1599,7 @@ void window_park_awards_open() if (window->classification == gCurrentToolWidget.window_classification && window->number == gCurrentToolWidget.window_number) tool_cancel(); - window->viewport = NULL; + window->viewport = nullptr; window->page = WINDOW_PARK_PAGE_AWARDS; window_invalidate(window); window->widgets = window_park_awards_widgets; @@ -1679,14 +1679,14 @@ static void window_park_awards_paint(rct_window *w, rct_drawpixelinfo *dpi) continue; gfx_draw_sprite(dpi, ParkAwards[award->Type].sprite, x, y, 0); - gfx_draw_string_left_wrapped(dpi, NULL, x + 34, y + 6, 180, ParkAwards[award->Type].text, COLOUR_BLACK); + gfx_draw_string_left_wrapped(dpi, nullptr, x + 34, y + 6, 180, ParkAwards[award->Type].text, COLOUR_BLACK); y += 32; count++; } if (count == 0) - gfx_draw_string_left(dpi, STR_NO_RECENT_AWARDS, NULL, COLOUR_BLACK, x + 6, y + 6); + gfx_draw_string_left(dpi, STR_NO_RECENT_AWARDS, nullptr, COLOUR_BLACK, x + 6, y + 6); } #pragma endregion @@ -1707,15 +1707,15 @@ static void window_park_set_page(rct_window *w, sint32 page) // Set listen only to viewport listen = 0; - if (page == WINDOW_PARK_PAGE_ENTRANCE && w->page == WINDOW_PARK_PAGE_ENTRANCE && w->viewport != NULL && !(w->viewport->flags & VIEWPORT_FLAG_SOUND_ON)) + if (page == WINDOW_PARK_PAGE_ENTRANCE && w->page == WINDOW_PARK_PAGE_ENTRANCE && w->viewport != nullptr && !(w->viewport->flags & VIEWPORT_FLAG_SOUND_ON)) listen++; w->page = page; w->frame_no = 0; w->var_492 = 0; - if (w->viewport != NULL) { + if (w->viewport != nullptr) { w->viewport->width = 0; - w->viewport = NULL; + w->viewport = nullptr; } w->enabled_widgets = window_park_page_enabled_widgets[page]; @@ -1728,7 +1728,7 @@ static void window_park_set_page(rct_window *w, sint32 page) window_event_resize_call(w); window_event_invalidate_call(w); window_event_update_call(w); - if (listen != 0 && w->viewport != NULL) + if (listen != 0 && w->viewport != nullptr) w->viewport->flags |= VIEWPORT_FLAG_SOUND_ON; } diff --git a/src/openrct2/windows/Player.cpp b/src/openrct2/windows/Player.cpp index 76c212b3cf..e03f933903 100644 --- a/src/openrct2/windows/Player.cpp +++ b/src/openrct2/windows/Player.cpp @@ -98,29 +98,29 @@ static rct_window_event_list window_player_overview_events = { window_player_overview_resize, window_player_overview_mouse_down, window_player_overview_dropdown, - NULL, + nullptr, window_player_overview_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_player_overview_invalidate, window_player_overview_paint, - NULL + nullptr }; static void window_player_statistics_close(rct_window *w); @@ -134,31 +134,31 @@ static rct_window_event_list window_player_statistics_events = { window_player_statistics_close, window_player_statistics_mouse_up, window_player_statistics_resize, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_player_statistics_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_player_statistics_invalidate, window_player_statistics_paint, - NULL + nullptr }; static rct_window_event_list *window_player_page_events[] = { @@ -192,7 +192,7 @@ void window_player_open(uint8 id) rct_window* window; window = window_bring_to_front_by_number(WC_PLAYER, id); - if (window == NULL) { + if (window == nullptr) { window = window_create_auto_pos(240, 170, &window_player_overview_events, WC_PLAYER, WF_RESIZABLE); window->number = id; window->page = 0; @@ -273,7 +273,7 @@ void window_player_overview_mouse_up(rct_window *w, rct_widgetindex widgetIndex) break; case WIDX_LOCATE:{ rct_window* mainWindow = window_get_main(); - if (mainWindow != NULL) { + if (mainWindow != nullptr) { sint32 player = network_get_player_index((uint8)w->number); if (player == -1) { return; @@ -392,7 +392,7 @@ void window_player_overview_paint(rct_window *w, rct_drawpixelinfo *dpi) } gfx_draw_string_centred_clipped(dpi, STR_LAST_ACTION_RAN, gCommonFormatArgs, COLOUR_BLACK, x, y, width); - if (w->viewport != NULL && w->var_492 != -1) { + if (w->viewport != nullptr && w->var_492 != -1) { window_draw_viewport(dpi, w); } } @@ -433,7 +433,7 @@ void window_player_overview_invalidate(rct_window *w) window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_2); rct_viewport *viewport = w->viewport; - if (viewport != NULL) { + if (viewport != nullptr) { rct_widget *viewportWidget = &window_player_overview_widgets[WIDX_VIEWPORT]; viewport->x = w->x + viewportWidget->left; @@ -548,7 +548,7 @@ static void window_player_set_page(rct_window* w, sint32 page) window_invalidate(w); if (page == WINDOW_PLAYER_PAGE_OVERVIEW) { - if (w->viewport == NULL) { + if (w->viewport == nullptr) { viewport_create(w, w->x, w->y, w->width, w->height, 0, 128 * 32, 128 * 32, 0, 1, -1); w->flags |= WF_NO_SCROLLING; window_event_invalidate_call(w); @@ -558,9 +558,9 @@ static void window_player_set_page(rct_window* w, sint32 page) window_player_update_viewport(w, false); } } else { - if (w->viewport != NULL) { + if (w->viewport != nullptr) { w->viewport->width = 0; - w->viewport = NULL; + w->viewport = nullptr; } } } @@ -602,7 +602,7 @@ static void window_player_update_viewport(rct_window *w, bool scroll) } rct_viewport *viewport = w->viewport; - if (viewport != NULL) { + if (viewport != nullptr) { rct_xyz16 coord = network_get_player_last_action_coord(playerIndex); if (coord.x != 0 || coord.y != 0 || coord.z != 0) { sint32 viewX, viewY; diff --git a/src/openrct2/windows/Research.cpp b/src/openrct2/windows/Research.cpp index 94f6d0fe5c..afcc7c6e0d 100644 --- a/src/openrct2/windows/Research.cpp +++ b/src/openrct2/windows/Research.cpp @@ -115,66 +115,66 @@ static void window_research_funding_paint(rct_window *w, rct_drawpixelinfo *dpi) // static rct_window_event_list window_research_development_events = { - NULL, + nullptr, window_research_development_mouseup, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_research_development_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_research_development_invalidate, window_research_development_paint, - NULL + nullptr }; // 0x009890E8 static rct_window_event_list window_research_funding_events = { - NULL, + nullptr, window_research_funding_mouseup, - NULL, + nullptr, window_research_funding_mousedown, window_research_funding_dropdown, - NULL, + nullptr, window_research_funding_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_research_funding_invalidate, window_research_funding_paint, - NULL + nullptr }; static rct_window_event_list *window_research_page_events[] = { @@ -236,7 +236,7 @@ void window_research_open() rct_window *w; w = window_bring_to_front_by_class(WC_RESEARCH); - if (w == NULL) { + if (w == nullptr) { w = window_create_auto_pos(530, 257, window_research_page_events[0], WC_RESEARCH, WF_10); w->widgets = window_research_page_widgets[0]; w->enabled_widgets = window_research_page_enabled_widgets[0]; @@ -398,7 +398,7 @@ void window_research_development_page_paint(rct_window *w, rct_drawpixelinfo *dp if (typeId != 0xFFFFFFFF) { if (typeId >= 0x10000) { rct_ride_entry *rideEntry = get_ride_entry(typeId & 0xFF); - if (rideEntry == NULL) { + if (rideEntry == nullptr) { return; } stringId = (rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) ? @@ -408,7 +408,7 @@ void window_research_development_page_paint(rct_window *w, rct_drawpixelinfo *dp lastDevelopmentFormat = STR_RESEARCH_RIDE_LABEL; } else { rct_scenery_set_entry *sse = get_scenery_group_entry(typeId); - if (sse == NULL) { + if (sse == nullptr) { return; } stringId = sse->name; @@ -594,9 +594,9 @@ static void window_research_set_page(rct_window *w, sint32 page) { w->page = page; w->frame_no = 0; - if (w->viewport != NULL) { + if (w->viewport != nullptr) { w->viewport->width = 0; - w->viewport = NULL; + w->viewport = nullptr; } w->enabled_widgets = window_research_page_enabled_widgets[page]; diff --git a/src/openrct2/windows/Ride.cpp b/src/openrct2/windows/Ride.cpp index e37120a892..0346aeb654 100644 --- a/src/openrct2/windows/Ride.cpp +++ b/src/openrct2/windows/Ride.cpp @@ -621,63 +621,63 @@ static void window_ride_set_page(rct_window *w, sint32 page); // 0x0098DFD4 static rct_window_event_list window_ride_main_events = { - NULL, + nullptr, window_ride_main_mouseup, window_ride_main_resize, window_ride_main_mousedown, window_ride_main_dropdown, - NULL, + nullptr, window_ride_main_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_ride_main_textinput, window_ride_main_viewport_rotate, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_ride_main_invalidate, window_ride_main_paint, - NULL + nullptr }; // 0x0098E204 static rct_window_event_list window_ride_vehicle_events = { - NULL, + nullptr, window_ride_vehicle_mouseup, window_ride_vehicle_resize, window_ride_vehicle_mousedown, window_ride_vehicle_dropdown, - NULL, + nullptr, window_ride_vehicle_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_ride_vehicle_invalidate, window_ride_vehicle_paint, window_ride_vehicle_scrollpaint @@ -685,66 +685,66 @@ static rct_window_event_list window_ride_vehicle_events = { // 0x0098E0B4 static rct_window_event_list window_ride_operating_events = { - NULL, + nullptr, window_ride_operating_mouseup, window_ride_operating_resize, window_ride_operating_mousedown, window_ride_operating_dropdown, - NULL, + nullptr, window_ride_operating_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_ride_operating_invalidate, window_ride_operating_paint, - NULL + nullptr }; // 0x0098E124 static rct_window_event_list window_ride_maintenance_events = { - NULL, + nullptr, window_ride_maintenance_mouseup, window_ride_maintenance_resize, window_ride_maintenance_mousedown, window_ride_maintenance_dropdown, - NULL, + nullptr, window_ride_maintenance_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_ride_maintenance_invalidate, window_ride_maintenance_paint, - NULL + nullptr }; // 0x0098E044 @@ -754,26 +754,26 @@ static rct_window_event_list window_ride_colour_events = { window_ride_colour_resize, window_ride_colour_mousedown, window_ride_colour_dropdown, - NULL, + nullptr, window_ride_colour_update, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_ride_colour_tooldown, window_ride_colour_tooldrag, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_ride_colour_invalidate, window_ride_colour_paint, window_ride_colour_scrollpaint @@ -781,34 +781,34 @@ static rct_window_event_list window_ride_colour_events = { // 0x0098E194 static rct_window_event_list window_ride_music_events = { - NULL, + nullptr, window_ride_music_mouseup, window_ride_music_resize, window_ride_music_mousedown, window_ride_music_dropdown, - NULL, + nullptr, window_ride_music_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_ride_music_invalidate, window_ride_music_paint, - NULL + nullptr }; // 0x0098DE14 @@ -818,58 +818,58 @@ static rct_window_event_list window_ride_measurements_events = { window_ride_measurements_resize, window_ride_measurements_mousedown, window_ride_measurements_dropdown, - NULL, + nullptr, window_ride_measurements_update, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_ride_measurements_tooldown, window_ride_measurements_tooldrag, - NULL, + nullptr, window_ride_measurements_toolabort, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_ride_measurements_invalidate, window_ride_measurements_paint, - NULL + nullptr }; // 0x0098DF64 static rct_window_event_list window_ride_graphs_events = { - NULL, + nullptr, window_ride_graphs_mouseup, window_ride_graphs_resize, window_ride_graphs_mousedown, - NULL, - NULL, + nullptr, + nullptr, window_ride_graphs_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_ride_graphs_scrollgetheight, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_ride_graphs_15, window_ride_graphs_tooltip, - NULL, - NULL, + nullptr, + nullptr, window_ride_graphs_invalidate, window_ride_graphs_paint, window_ride_graphs_scrollpaint @@ -877,66 +877,66 @@ static rct_window_event_list window_ride_graphs_events = { // 0x0098DEF4 static rct_window_event_list window_ride_income_events = { - NULL, + nullptr, window_ride_income_mouseup, window_ride_income_resize, window_ride_income_mousedown, - NULL, - NULL, + nullptr, + nullptr, window_ride_income_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_ride_income_invalidate, window_ride_income_paint, - NULL + nullptr }; // 0x0098DE84 static rct_window_event_list window_ride_customer_events = { - NULL, + nullptr, window_ride_customer_mouseup, window_ride_customer_resize, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_ride_customer_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_ride_customer_invalidate, window_ride_customer_paint, - NULL + nullptr }; static rct_window_event_list *window_ride_page_events[] = { @@ -1427,7 +1427,7 @@ static void window_ride_disable_tabs(rct_window *w) rct_ride_entry *type = get_ride_entry(ride->subtype); - if (type == NULL) { + if (type == nullptr) { disabled_tabs |= 1 << WIDX_TAB_2 | 1 << WIDX_TAB_3 | 1 << WIDX_TAB_4 | 1 << WIDX_TAB_5 | 1 << WIDX_TAB_6 | 1 << WIDX_TAB_7 | 1 << WIDX_TAB_8 | 1 << WIDX_TAB_9 | 1 << WIDX_TAB_10; } else if ((type->flags & RIDE_ENTRY_FLAG_DISABLE_COLOUR_TAB) != 0) @@ -1528,7 +1528,7 @@ rct_window *window_ride_main_open(sint32 rideIndex) rct_window *w; w = window_bring_to_front_by_number(WC_RIDE, rideIndex); - if (w == NULL) { + if (w == nullptr) { w = window_ride_open(rideIndex); w->ride.var_482 = -1; } @@ -1566,7 +1566,7 @@ rct_window *window_ride_open_station(sint32 rideIndex, sint32 stationIndex) return window_ride_main_open(rideIndex); w = window_bring_to_front_by_number(WC_RIDE, rideIndex); - if (w == NULL) { + if (w == nullptr) { w = window_ride_open(rideIndex); w->ride.var_482 = -1; } @@ -1645,7 +1645,7 @@ rct_window *window_ride_open_vehicle(rct_vehicle *vehicle) rct_window *w = window_find_by_number(WC_RIDE, rideIndex); - if (w != NULL) { + if (w != nullptr) { window_invalidate(w); if ( @@ -1666,7 +1666,7 @@ rct_window *window_ride_open_vehicle(rct_vehicle *vehicle) numPeepsLeft--; rct_window *w2 = window_find_by_number(WC_PEEP, peepSpriteIndex); - if (w2 == NULL) { + if (w2 == nullptr) { rct_peep *peep = &(get_sprite(peepSpriteIndex)->peep); window_guest_open(peep); openedPeepWindow = 1; @@ -1681,7 +1681,7 @@ rct_window *window_ride_open_vehicle(rct_vehicle *vehicle) window_bring_to_front_by_number(WC_RIDE, rideIndex); } - if (w == NULL) { + if (w == nullptr) { w = window_ride_open(rideIndex); w->ride.var_482 = -1; } @@ -1721,7 +1721,7 @@ static void window_ride_set_page(rct_window *w, sint32 page) // Set listen only to viewport listen = 0; - if (page == WINDOW_RIDE_PAGE_MAIN && w->page == WINDOW_RIDE_PAGE_MAIN && w->viewport != NULL && !(w->viewport->flags & VIEWPORT_FLAG_SOUND_ON)) + if (page == WINDOW_RIDE_PAGE_MAIN && w->page == WINDOW_RIDE_PAGE_MAIN && w->viewport != nullptr && !(w->viewport->flags & VIEWPORT_FLAG_SOUND_ON)) listen++; w->page = page; @@ -1733,9 +1733,9 @@ static void window_ride_set_page(rct_window *w, sint32 page) //ride_update_max_vehicles(w->number); //} - if (w->viewport != NULL) { + if (w->viewport != nullptr) { w->viewport->width = 0; - w->viewport = NULL; + w->viewport = nullptr; } w->enabled_widgets = window_ride_page_enabled_widgets[page]; @@ -1751,7 +1751,7 @@ static void window_ride_set_page(rct_window *w, sint32 page) window_init_scroll_widgets(w); window_invalidate(w); - if (listen != 0 && w->viewport != NULL) + if (listen != 0 && w->viewport != nullptr) w->viewport->flags |= VIEWPORT_FLAG_SOUND_ON; } @@ -1851,7 +1851,7 @@ static void window_ride_init_viewport(rct_window *w) uint16 viewport_flags = 0; - if (w->viewport != NULL) { + if (w->viewport != nullptr) { if (focus.coordinate.x == w->viewport_focus_coordinates.x && focus.coordinate.y == w->viewport_focus_coordinates.y && focus.coordinate.z == w->viewport_focus_coordinates.z && @@ -1864,7 +1864,7 @@ static void window_ride_init_viewport(rct_window *w) } viewport_flags = w->viewport->flags; w->viewport->width = 0; - w->viewport = NULL; + w->viewport = nullptr; viewport_update_pointers(); } else if (gConfigGeneral.always_show_gridlines) { @@ -1953,7 +1953,7 @@ static void window_ride_main_mouseup(rct_window *w, rct_widgetindex widgetIndex) case WIDX_CONSTRUCTION: rideIndex = (uint8)w->number; ride_construct(rideIndex); - if (window_find_by_number(WC_RIDE_CONSTRUCTION, rideIndex) != NULL) { + if (window_find_by_number(WC_RIDE_CONSTRUCTION, rideIndex) != nullptr) { window_close(w); } break; @@ -2310,7 +2310,7 @@ static void window_ride_main_update(rct_window *w) */ static void window_ride_main_textinput(rct_window *w, rct_widgetindex widgetIndex, char *text) { - if (widgetIndex != WIDX_RENAME || text == NULL) + if (widgetIndex != WIDX_RENAME || text == nullptr) return; ride_set_name(w->number, text); @@ -2589,7 +2589,7 @@ static void window_ride_main_paint(rct_window *w, rct_drawpixelinfo *dpi) window_ride_draw_tab_images(dpi, w); // Viewport and ear icon - if (w->viewport != NULL) { + if (w->viewport != nullptr) { window_draw_viewport(dpi, w); if (w->viewport->flags & VIEWPORT_FLAG_SOUND_ON) gfx_draw_sprite(dpi, SPR_HEARING_VIEWPORT, w->x + 2, w->y + 2, 0); @@ -2931,7 +2931,7 @@ static void window_ride_vehicle_paint(rct_window *w, rct_drawpixelinfo *dpi) // Capacity void * loadedObject = object_manager_get_loaded_object_by_index(ride->subtype); - if (loadedObject != NULL) + if (loadedObject != nullptr) { const utf8 * capacity = object_get_capacity(loadedObject); set_format_arg(0, rct_string_id, STR_STRING); @@ -3649,10 +3649,10 @@ static void window_ride_locate_mechanic(rct_window *w) mechanic = ride_get_assigned_mechanic(ride); // Otherwise find the closest mechanic - if (mechanic == NULL) + if (mechanic == nullptr) mechanic = ride_find_closest_mechanic(ride, 1); - if (mechanic == NULL) + if (mechanic == nullptr) window_error_open(STR_UNABLE_TO_LOCATE_MECHANIC, STR_NONE); else window_staff_open(mechanic); @@ -3722,7 +3722,7 @@ static void window_ride_maintenance_mousedown(rct_window *w, rct_widgetindex wid { rct_ride *ride = get_ride(w->number); rct_ride_entry *ride_type = get_ride_entry(ride->subtype); - if (ride_type == NULL) { + if (ride_type == nullptr) { return; } @@ -3973,7 +3973,7 @@ static void window_ride_maintenance_paint(rct_window *w, rct_drawpixelinfo *dpi) widget = &window_ride_maintenance_widgets[WIDX_INSPECTION_INTERVAL]; x = w->x + 4; y = w->y + widget->top + 1; - gfx_draw_string_left(dpi, STR_INSPECTION, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_INSPECTION, nullptr, COLOUR_BLACK, x, y); // Reliability widget = &window_ride_maintenance_widgets[WIDX_PAGE_BACKGROUND]; @@ -4046,7 +4046,7 @@ static void window_ride_maintenance_paint(rct_window *w, rct_drawpixelinfo *dpi) if (stringId != 0) { if (stringId == STR_CALLING_MECHANIC || stringId == STR_NO_MECHANICS_ARE_HIRED_MESSAGE) { - gfx_draw_string_left_wrapped(dpi, NULL, x + 4, y, 280, stringId, COLOUR_BLACK); + gfx_draw_string_left_wrapped(dpi, nullptr, x + 4, y, 280, stringId, COLOUR_BLACK); } else { rct_peep *mechanicSprite = &(get_sprite(ride->mechanic)->peep); if (peep_is_mechanic(mechanicSprite)) { @@ -4105,7 +4105,7 @@ static void window_ride_set_track_colour_scheme(rct_window *w, sint32 x, sint32 newColourScheme = (uint8)w->ride_colour; rct_xy16 mapCoord = { 0 }; - get_map_coordinates_from_pos(x, y, VIEWPORT_INTERACTION_MASK_RIDE, &mapCoord.x, &mapCoord.y, &interactionType, &mapElement, NULL); + get_map_coordinates_from_pos(x, y, VIEWPORT_INTERACTION_MASK_RIDE, &mapCoord.x, &mapCoord.y, &interactionType, &mapElement, nullptr); x = mapCoord.x; y = mapCoord.y; @@ -4118,7 +4118,7 @@ static void window_ride_set_track_colour_scheme(rct_window *w, sint32 x, sint32 z = mapElement->base_height * 8; direction = map_element_get_direction(mapElement); - sub_6C683D(&x, &y, &z, direction, mapElement->properties.track.type, newColourScheme, NULL, 4); + sub_6C683D(&x, &y, &z, direction, mapElement->properties.track.type, newColourScheme, nullptr, 4); } /** @@ -5164,7 +5164,7 @@ static void window_ride_measurements_tooldown(rct_window *w, rct_widgetindex wid _lastSceneryY = y; _collectTrackDesignScenery = true; // Default to true in case user does not select anything valid - get_map_coordinates_from_pos(x, y, 0xFCCF, &mapX, &mapY, &interactionType, &mapElement, NULL); + get_map_coordinates_from_pos(x, y, 0xFCCF, &mapX, &mapY, &interactionType, &mapElement, nullptr); switch (interactionType) { case VIEWPORT_INTERACTION_ITEM_SCENERY: case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY: @@ -5187,7 +5187,7 @@ static void window_ride_measurements_tooldrag(rct_window *w, rct_widgetindex wid sint16 mapX, mapY; sint32 interactionType; - get_map_coordinates_from_pos(x, y, 0xFCCF, &mapX, &mapY, &interactionType, &mapElement, NULL); + get_map_coordinates_from_pos(x, y, 0xFCCF, &mapX, &mapY, &interactionType, &mapElement, nullptr); switch (interactionType) { case VIEWPORT_INTERACTION_ITEM_SCENERY: case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY: @@ -5273,7 +5273,7 @@ static void window_ride_measurements_paint(rct_window *w, rct_drawpixelinfo *dpi sint32 x = w->x + (widget->right - widget->left) / 2; sint32 y = w->y + widget->top + 40; - gfx_draw_string_centred_wrapped(dpi, NULL, x, y, w->width - 8, STR_CLICK_ITEMS_OF_SCENERY_TO_SELECT, COLOUR_BLACK); + gfx_draw_string_centred_wrapped(dpi, nullptr, x, y, w->width - 8, STR_CLICK_ITEMS_OF_SCENERY_TO_SELECT, COLOUR_BLACK); x = w->x + 4; y = w->y + window_ride_measurements_widgets[WIDX_SELECT_NEARBY_SCENERY].bottom + 17; @@ -5438,7 +5438,7 @@ static void window_ride_measurements_paint(rct_window *w, rct_drawpixelinfo *dpi } } } else { - gfx_draw_string_left(dpi, STR_NO_TEST_RESULTS_YET, NULL, COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_NO_TEST_RESULTS_YET, nullptr, COLOUR_BLACK, x, y); } } } @@ -5544,8 +5544,8 @@ static void window_ride_graphs_update(rct_window *w) widget = &window_ride_graphs_widgets[WIDX_GRAPH]; x = w->scrolls[0].h_left; if (!(w->list_information_type & 0x8000)) { - measurement = ride_get_measurement(w->number, NULL); - x = measurement == NULL ? + measurement = ride_get_measurement(w->number, nullptr); + x = measurement == nullptr ? 0 : measurement->current_item - (((widget->right - widget->left) / 4) * 3); } @@ -5568,8 +5568,8 @@ static void window_ride_graphs_scrollgetheight(rct_window *w, sint32 scrollIndex *width = window_ride_graphs_widgets[WIDX_GRAPH].right - window_ride_graphs_widgets[WIDX_GRAPH].left - 2; // Get measurement size - measurement = ride_get_measurement(w->number, NULL); - if (measurement != NULL) + measurement = ride_get_measurement(w->number, nullptr); + if (measurement != nullptr) *width = Math::Max(*width, measurement->num_items); } @@ -5592,7 +5592,7 @@ static void window_ride_graphs_tooltip(rct_window* w, rct_widgetindex widgetInde set_format_arg(0, rct_string_id, STR_GRAPH); rct_string_id message; rct_ride_measurement *measurement = ride_get_measurement(w->number, &message); - if (measurement != NULL && (measurement->flags & RIDE_MEASUREMENT_FLAG_RUNNING)) { + if (measurement != nullptr && (measurement->flags & RIDE_MEASUREMENT_FLAG_RUNNING)) { set_format_arg(4, uint16, measurement->vehicle_index + 1); rct_ride *ride = get_ride(w->number); set_format_arg(2, rct_string_id, RideComponentNames[RideNameConvention[ride->type].vehicle].count); @@ -5685,7 +5685,7 @@ static void window_ride_graphs_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi rct_widget *widget = &window_ride_graphs_widgets[WIDX_GRAPH]; rct_string_id stringId; rct_ride_measurement *measurement = ride_get_measurement(w->number, &stringId); - if (measurement == NULL) { + if (measurement == nullptr) { // No measurement message sint32 x = (widget->right - widget->left) / 2; sint32 y = (widget->bottom - widget->top) / 2 - 5; diff --git a/src/openrct2/windows/RideConstruction.cpp b/src/openrct2/windows/RideConstruction.cpp index a9cfbc0e9d..d53d931ccf 100644 --- a/src/openrct2/windows/RideConstruction.cpp +++ b/src/openrct2/windows/RideConstruction.cpp @@ -153,29 +153,29 @@ static rct_window_event_list window_ride_construction_events = { window_ride_construction_resize, window_ride_construction_mousedown, window_ride_construction_dropdown, - NULL, + nullptr, window_ride_construction_update, - NULL, - NULL, + nullptr, + nullptr, window_ride_construction_toolupdate, window_ride_construction_tooldown, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_ride_construction_invalidate, window_ride_construction_paint, - NULL + nullptr }; #pragma endregion @@ -529,7 +529,7 @@ static sint32 ride_get_alternative_type(rct_ride *ride) static void close_ride_window_for_construction(rct_windownumber number) { rct_window* w = window_find_by_number(WC_RIDE, number); - if (w != NULL && w->page == 1) + if (w != nullptr && w->page == 1) window_close(w); } @@ -652,7 +652,7 @@ static void window_ride_construction_close(rct_window *w) hide_gridlines(); uint8 rideIndex = _currentRideIndex; - if (ride_try_get_origin_element(rideIndex, NULL)) { + if (ride_try_get_origin_element(rideIndex, nullptr)) { rct_ride *ride = get_ride(rideIndex); // Auto open shops if required. if (ride->mode == RIDE_MODE_SHOP_STALL && gConfigGeneral.auto_open_shops) { @@ -1230,12 +1230,12 @@ static void window_ride_construction_resize(rct_window *w) } if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_FRONT) { disabledWidgets |= (1ULL << WIDX_NEXT_SECTION); - if (_sub_6CA2DF(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)) { + if (_sub_6CA2DF(nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr)) { disabledWidgets |= (1ULL << WIDX_CONSTRUCT); } } else if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_BACK) { disabledWidgets |= (1ULL << WIDX_PREVIOUS_SECTION); - if (_sub_6CA2DF(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)) { + if (_sub_6CA2DF(nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr)) { disabledWidgets |= (1ULL << WIDX_CONSTRUCT); } } @@ -1885,7 +1885,7 @@ void window_ride_construction_mouseup_demolish_next_piece(sint32 x, sint32 y, si sint32 b4 = _currentTrackLiftHill; ride_construction_set_default_next_piece(); window_ride_construction_update_active_elements(); - if (!ride_try_get_origin_element(_currentRideIndex, NULL)) { + if (!ride_try_get_origin_element(_currentRideIndex, nullptr)) { ride_initialise_construction_window(_currentRideIndex); _currentTrackPieceDirection = direction; if (!(slope & 0x100)) { @@ -1954,7 +1954,7 @@ static void window_ride_construction_rotate(rct_window *w) static void window_ride_construction_entrance_click(rct_window *w) { if (tool_set(w, WIDX_ENTRANCE, TOOL_CROSSHAIR)) { - if (!ride_try_get_origin_element(_currentRideIndex, NULL)) { + if (!ride_try_get_origin_element(_currentRideIndex, nullptr)) { ride_initialise_construction_window(_currentRideIndex); } } else { @@ -1978,7 +1978,7 @@ static void window_ride_construction_entrance_click(rct_window *w) static void window_ride_construction_exit_click(rct_window *w) { if (tool_set(w, WIDX_EXIT, TOOL_CROSSHAIR)) { - if (!ride_try_get_origin_element(_currentRideIndex, NULL)) { + if (!ride_try_get_origin_element(_currentRideIndex, nullptr)) { ride_initialise_construction_window(_currentRideIndex); } } else { @@ -2216,7 +2216,7 @@ static void window_ride_construction_paint(rct_window *w, rct_drawpixelinfo *dpi return; sint32 trackType, trackDirection, rideIndex, liftHillAndAlternativeState; - if (_sub_6CA2DF(&trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, NULL, NULL, NULL, NULL)) + if (_sub_6CA2DF(&trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, nullptr, nullptr, nullptr, nullptr)) return; // Draw track piece @@ -2467,7 +2467,7 @@ void window_ride_construction_update_active_elements() window_ride_construction_update_enabled_track_pieces(); w = window_find_by_class(WC_RIDE_CONSTRUCTION); - if (w == NULL) + if (w == nullptr) return; window_ride_construction_update_map_selection(); @@ -2711,14 +2711,14 @@ bool _sub_6CA2DF(sint32 *_trackType, sint32 *_trackDirection, sint32 *_rideIndex } - if (_trackType != NULL) *_trackType = trackType; - if (_trackDirection != NULL) *_trackDirection = trackDirection; - if (_rideIndex != NULL) *_rideIndex = rideIndex; - if (_liftHillAndAlternativeState != NULL) *_liftHillAndAlternativeState = liftHillAndAlternativeState; - if (_x != NULL) *_x = x; - if (_y != NULL) *_y = y; - if (_z != NULL) *_z = z; - if (_properties != NULL) *_properties = properties; + if (_trackType != nullptr) *_trackType = trackType; + if (_trackDirection != nullptr) *_trackDirection = trackDirection; + if (_rideIndex != nullptr) *_rideIndex = rideIndex; + if (_liftHillAndAlternativeState != nullptr) *_liftHillAndAlternativeState = liftHillAndAlternativeState; + if (_x != nullptr) *_x = x; + if (_y != nullptr) *_y = y; + if (_z != nullptr) *_z = z; + if (_properties != nullptr) *_properties = properties; return false; } @@ -2732,7 +2732,7 @@ static void window_ride_construction_update_enabled_track_pieces() rct_ride *ride = get_ride(_currentRideIndex); rct_ride_entry *rideEntry = get_ride_entry_by_ride(ride); - if (rideEntry == NULL) + if (rideEntry == nullptr) return; sint32 rideType = (_currentTrackAlternative & RIDE_TYPE_ALTERNATIVE_TRACK_TYPE) ? RideData4[ride->type].alternate_type : ride->type; @@ -2823,7 +2823,7 @@ void sub_6C94D8() case RIDE_CONSTRUCTION_STATE_FRONT: case RIDE_CONSTRUCTION_STATE_BACK: if (!(_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_TRACK)) { - if (_sub_6CA2DF(&type, &direction, &rideIndex, &liftHillAndAlternativeState, &x, &y, &z, NULL)) { + if (_sub_6CA2DF(&type, &direction, &rideIndex, &liftHillAndAlternativeState, &x, &y, &z, nullptr)) { ride_construction_remove_ghosts(); } else { _currentTrackPrice = _place_provisional_track_piece(rideIndex, type, direction, liftHillAndAlternativeState, x, y, z); @@ -2866,7 +2866,7 @@ void sub_6C94D8() z = _currentTrackBeginZ; direction = _currentTrackPieceDirection & 3; type = _currentTrackPieceType; - if (sub_6C683D(&x, &y, &z, direction, type, 0, NULL, _currentTrackSelectionFlags & TRACK_SELECTION_FLAG_ARROW ? 2 : 1)) { + if (sub_6C683D(&x, &y, &z, direction, type, 0, nullptr, _currentTrackSelectionFlags & TRACK_SELECTION_FLAG_ARROW ? 2 : 1)) { ride_construction_remove_ghosts(); _rideConstructionState = RIDE_CONSTRUCTION_STATE_0; } @@ -2930,7 +2930,7 @@ static void window_ride_construction_update_map_selection() y = _currentTrackBeginY; break; default: - if (_sub_6CA2DF(&trackType, &trackDirection, NULL, NULL, &x, &y, NULL, NULL)) { + if (_sub_6CA2DF(&trackType, &trackDirection, nullptr, nullptr, &x, &y, nullptr, nullptr)) { trackDirection = _currentTrackPieceDirection; trackType = 0; x = _currentTrackBeginX; @@ -3601,7 +3601,7 @@ static void ride_selected_track_set_seat_rotation(sint32 seatRotation) x = _currentTrackBeginX; y = _currentTrackBeginY; z = _currentTrackBeginZ; - sub_6C683D(&x, &y, &z, _currentTrackPieceDirection & 3, _currentTrackPieceType, seatRotation, NULL, (1 << 5)); + sub_6C683D(&x, &y, &z, _currentTrackPieceDirection & 3, _currentTrackPieceType, seatRotation, nullptr, (1 << 5)); window_ride_construction_update_active_elements(); } @@ -3684,7 +3684,7 @@ void ride_construction_toolupdate_construct(sint32 screenX, sint32 screenY) gMapSelectionTiles[1].y = -1; sint32 trackType, trackDirection, rideIndex, liftHillAndAlternativeState; - if (_sub_6CA2DF(&trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, NULL, NULL, NULL, NULL)) { + if (_sub_6CA2DF(&trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, nullptr, nullptr, nullptr, nullptr)) { ride_construction_invalidate_current_track(); map_invalidate_map_selection_tiles(); return; @@ -3744,7 +3744,7 @@ void ride_construction_toolupdate_construct(sint32 screenX, sint32 screenY) _previousTrackPieceZ = z; if (ride->type == RIDE_TYPE_MAZE) { for (;;) { - _sub_6CA2DF(&trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, &x, &y, &z, NULL); + _sub_6CA2DF(&trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, &x, &y, &z, nullptr); _currentTrackPrice = _place_provisional_track_piece(rideIndex, trackType, trackDirection, liftHillAndAlternativeState, x, y, z); if (_currentTrackPrice != MONEY32_UNDEFINED) break; @@ -3767,7 +3767,7 @@ void ride_construction_toolupdate_construct(sint32 screenX, sint32 screenY) } for (;;) { - _sub_6CA2DF(&trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, &x, &y, &z, NULL); + _sub_6CA2DF(&trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, &x, &y, &z, nullptr); _currentTrackPrice = _place_provisional_track_piece(rideIndex, trackType, trackDirection, liftHillAndAlternativeState, x, y, z); if (_currentTrackPrice != MONEY32_UNDEFINED) break; @@ -3910,7 +3910,7 @@ void ride_construction_tooldown_construct(sint32 screenX, sint32 screenY) _rideConstructionArrowPulseTime = 0; window_maze_construction_update_pressed_widgets(); w = window_find_by_class(WC_RIDE_CONSTRUCTION); - if (w == NULL) + if (w == nullptr) break; gDisableErrorWindowSound = true; @@ -3942,7 +3942,7 @@ void ride_construction_tooldown_construct(sint32 screenX, sint32 screenY) ) { audio_play_sound(SOUND_ERROR, 0, state->x); w = window_find_by_class(WC_RIDE_CONSTRUCTION); - if (w != NULL){ + if (w != nullptr){ tool_set(w, WIDX_CONSTRUCT, TOOL_CROSSHAIR); input_set_flag(INPUT_FLAG_6, true); _trackPlaceCtrlState = false; @@ -3973,7 +3973,7 @@ void ride_construction_tooldown_construct(sint32 screenX, sint32 screenY) _rideConstructionArrowPulseTime = 0; window_ride_construction_update_active_elements(); w = window_find_by_class(WC_RIDE_CONSTRUCTION); - if (w == NULL) + if (w == nullptr) break; gDisableErrorWindowSound = true; @@ -4021,7 +4021,7 @@ void ride_construction_tooldown_construct(sint32 screenX, sint32 screenY) window_close_by_class(WC_ERROR); if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_0) { w = window_find_by_class(WC_RIDE_CONSTRUCTION); - if (w != NULL) { + if (w != nullptr) { if (ride_are_all_possible_entrances_and_exits_built(ride)) { // Clients don't necessarily have any ride built at this point if (network_get_mode() != NETWORK_MODE_CLIENT) { @@ -4094,7 +4094,7 @@ void game_command_callback_place_ride_entrance_or_exit(sint32 eax, sint32 ebx, s void window_ride_construction_do_station_check() { rct_ride *ride = get_ride(_currentRideIndex); - if (ride != NULL) { + if (ride != nullptr) { _stationConstructed = ride->num_stations != 0; } } @@ -4104,13 +4104,13 @@ void window_ride_construction_do_entrance_exit_check() rct_window *w = window_find_by_class(WC_RIDE_CONSTRUCTION); rct_ride *ride = get_ride(_currentRideIndex); - if (w == NULL || ride == NULL) { + if (w == nullptr || ride == nullptr) { return; } if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_0) { w = window_find_by_class(WC_RIDE_CONSTRUCTION); - if (w != NULL) { + if (w != nullptr) { if (!ride_are_all_possible_entrances_and_exits_built(ride)) { window_event_mouse_up_call(w, WIDX_ENTRANCE); } else { @@ -4123,7 +4123,7 @@ void window_ride_construction_do_entrance_exit_check() void window_ride_construction_keyboard_shortcut_turn_left() { rct_window *w = window_find_by_class(WC_RIDE_CONSTRUCTION); - if (w == NULL || widget_is_disabled(w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WWT_EMPTY) { + if (w == nullptr || widget_is_disabled(w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WWT_EMPTY) { return; } @@ -4246,7 +4246,7 @@ void window_ride_construction_keyboard_shortcut_turn_left() void window_ride_construction_keyboard_shortcut_turn_right() { rct_window *w = window_find_by_class(WC_RIDE_CONSTRUCTION); - if (w == NULL || widget_is_disabled(w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WWT_EMPTY) { + if (w == nullptr || widget_is_disabled(w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WWT_EMPTY) { return; } @@ -4369,7 +4369,7 @@ void window_ride_construction_keyboard_shortcut_turn_right() void window_ride_construction_keyboard_shortcut_use_track_default() { rct_window *w = window_find_by_class(WC_RIDE_CONSTRUCTION); - if (w == NULL || widget_is_disabled(w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WWT_EMPTY) { + if (w == nullptr || widget_is_disabled(w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WWT_EMPTY) { return; } @@ -4393,7 +4393,7 @@ void window_ride_construction_keyboard_shortcut_use_track_default() void window_ride_construction_keyboard_shortcut_slope_down() { rct_window * w = window_find_by_class(WC_RIDE_CONSTRUCTION); - if (w == NULL || widget_is_disabled(w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WWT_EMPTY) { + if (w == nullptr || widget_is_disabled(w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WWT_EMPTY) { return; } @@ -4444,7 +4444,7 @@ void window_ride_construction_keyboard_shortcut_slope_down() void window_ride_construction_keyboard_shortcut_slope_up() { rct_window *w = window_find_by_class(WC_RIDE_CONSTRUCTION); - if (w == NULL || widget_is_disabled(w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WWT_EMPTY) { + if (w == nullptr || widget_is_disabled(w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WWT_EMPTY) { return; } @@ -4495,7 +4495,7 @@ void window_ride_construction_keyboard_shortcut_slope_up() void window_ride_construction_keyboard_shortcut_chain_lift_toggle() { rct_window *w = window_find_by_class(WC_RIDE_CONSTRUCTION); - if (w == NULL || widget_is_disabled(w, WIDX_CHAIN_LIFT) || w->widgets[WIDX_CHAIN_LIFT].type == WWT_EMPTY) { + if (w == nullptr || widget_is_disabled(w, WIDX_CHAIN_LIFT) || w->widgets[WIDX_CHAIN_LIFT].type == WWT_EMPTY) { return; } @@ -4505,7 +4505,7 @@ void window_ride_construction_keyboard_shortcut_chain_lift_toggle() void window_ride_construction_keyboard_shortcut_bank_left() { rct_window *w = window_find_by_class(WC_RIDE_CONSTRUCTION); - if (w == NULL || widget_is_disabled(w, WIDX_BANK_STRAIGHT) || w->widgets[WIDX_BANK_STRAIGHT].type == WWT_EMPTY) { + if (w == nullptr || widget_is_disabled(w, WIDX_BANK_STRAIGHT) || w->widgets[WIDX_BANK_STRAIGHT].type == WWT_EMPTY) { return; } @@ -4532,7 +4532,7 @@ void window_ride_construction_keyboard_shortcut_bank_left() void window_ride_construction_keyboard_shortcut_bank_right() { rct_window *w = window_find_by_class(WC_RIDE_CONSTRUCTION); - if (w == NULL || widget_is_disabled(w, WIDX_BANK_STRAIGHT) || w->widgets[WIDX_BANK_STRAIGHT].type == WWT_EMPTY) { + if (w == nullptr || widget_is_disabled(w, WIDX_BANK_STRAIGHT) || w->widgets[WIDX_BANK_STRAIGHT].type == WWT_EMPTY) { return; } @@ -4559,7 +4559,7 @@ void window_ride_construction_keyboard_shortcut_bank_right() void window_ride_construction_keyboard_shortcut_previous_track() { rct_window *w = window_find_by_class(WC_RIDE_CONSTRUCTION); - if (w == NULL || widget_is_disabled(w, WIDX_PREVIOUS_SECTION) || w->widgets[WIDX_PREVIOUS_SECTION].type == WWT_EMPTY) { + if (w == nullptr || widget_is_disabled(w, WIDX_PREVIOUS_SECTION) || w->widgets[WIDX_PREVIOUS_SECTION].type == WWT_EMPTY) { return; } @@ -4569,7 +4569,7 @@ void window_ride_construction_keyboard_shortcut_previous_track() void window_ride_construction_keyboard_shortcut_next_track() { rct_window *w = window_find_by_class(WC_RIDE_CONSTRUCTION); - if (w == NULL || widget_is_disabled(w, WIDX_NEXT_SECTION) || w->widgets[WIDX_NEXT_SECTION].type == WWT_EMPTY) { + if (w == nullptr || widget_is_disabled(w, WIDX_NEXT_SECTION) || w->widgets[WIDX_NEXT_SECTION].type == WWT_EMPTY) { return; } @@ -4579,7 +4579,7 @@ void window_ride_construction_keyboard_shortcut_next_track() void window_ride_construction_keyboard_shortcut_build_current() { rct_window *w = window_find_by_class(WC_RIDE_CONSTRUCTION); - if (w == NULL || widget_is_disabled(w, WIDX_CONSTRUCT) || w->widgets[WIDX_CONSTRUCT].type == WWT_EMPTY) { + if (w == nullptr || widget_is_disabled(w, WIDX_CONSTRUCT) || w->widgets[WIDX_CONSTRUCT].type == WWT_EMPTY) { return; } @@ -4589,7 +4589,7 @@ void window_ride_construction_keyboard_shortcut_build_current() void window_ride_construction_keyboard_shortcut_demolish_current() { rct_window *w = window_find_by_class(WC_RIDE_CONSTRUCTION); - if (w == NULL || widget_is_disabled(w, WIDX_DEMOLISH) || w->widgets[WIDX_DEMOLISH].type == WWT_EMPTY) { + if (w == nullptr || widget_is_disabled(w, WIDX_DEMOLISH) || w->widgets[WIDX_DEMOLISH].type == WWT_EMPTY) { return; } diff --git a/src/openrct2/windows/RideList.cpp b/src/openrct2/windows/RideList.cpp index 6738345dc8..8942609615 100644 --- a/src/openrct2/windows/RideList.cpp +++ b/src/openrct2/windows/RideList.cpp @@ -88,31 +88,31 @@ static void window_ride_list_paint(rct_window *w, rct_drawpixelinfo *dpi); static void window_ride_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint32 scrollIndex); static rct_window_event_list window_ride_list_events = { - NULL, + nullptr, window_ride_list_mouseup, window_ride_list_resize, window_ride_list_mousedown, window_ride_list_dropdown, - NULL, + nullptr, window_ride_list_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_ride_list_scrollgetsize, window_ride_list_scrollmousedown, - NULL, + nullptr, window_ride_list_scrollmouseover, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_ride_list_tooltip, - NULL, - NULL, + nullptr, + nullptr, window_ride_list_invalidate, window_ride_list_paint, window_ride_list_scrollpaint @@ -201,7 +201,7 @@ void window_ride_list_open() // Check if window is already open window = window_bring_to_front_by_class(WC_RIDE_LIST); - if (window == NULL) { + if (window == nullptr) { window = window_create_auto_pos(340, 240, &window_ride_list_events, WC_RIDE_LIST, WF_10 | WF_RESIZABLE); window->widgets = window_ride_list_widgets; window->enabled_widgets = diff --git a/src/openrct2/windows/Scenery.cpp b/src/openrct2/windows/Scenery.cpp index e22b1471cd..228fe8fc3c 100644 --- a/src/openrct2/windows/Scenery.cpp +++ b/src/openrct2/windows/Scenery.cpp @@ -80,26 +80,26 @@ static rct_window_event_list window_scenery_events = { window_scenery_resize, window_scenery_mousedown, window_scenery_dropdown, - NULL, + nullptr, window_scenery_update, window_scenery_event_07, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_scenery_scrollgetsize, window_scenery_scrollmousedown, - NULL, + nullptr, window_scenery_scrollmouseover, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_scenery_tooltip, - NULL, - NULL, + nullptr, + nullptr, window_scenery_invalidate, window_scenery_paint, window_scenery_scrollpaint, @@ -416,7 +416,7 @@ void window_scenery_open() // Check if window is already open window = window_bring_to_front_by_class(WC_SCENERY); - if (window != NULL) + if (window != nullptr) return; init_scenery(); @@ -902,7 +902,7 @@ void window_scenery_invalidate(rct_window *w) uint32 titleStringId = STR_MISCELLANEOUS; if (tabIndex < 19) { rct_scenery_set_entry * sgEntry = get_scenery_group_entry(tabIndex); - if (sgEntry != NULL && sgEntry != (rct_scenery_set_entry *)-1) { + if (sgEntry != nullptr && sgEntry != (rct_scenery_set_entry *)-1) { titleStringId = sgEntry->name; } } @@ -960,7 +960,7 @@ void window_scenery_invalidate(rct_window *w) window_scenery_widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].type = WWT_COLOURBTN; window_scenery_widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type = WWT_EMPTY; } else if (tabSelectedSceneryId != -1) { - rct_scenery_entry* sceneryEntry = NULL; + rct_scenery_entry* sceneryEntry = nullptr; if (tabSelectedSceneryId >= 0x400) { sceneryEntry = get_banner_entry(tabSelectedSceneryId - 0x400); @@ -1059,7 +1059,7 @@ void window_scenery_paint(rct_window *w, rct_drawpixelinfo *dpi) uint32 price = 0; - rct_scenery_entry* sceneryEntry = NULL; + rct_scenery_entry* sceneryEntry = nullptr; if (selectedSceneryEntryId >= 0x400) { sceneryEntry = get_banner_entry(selectedSceneryEntryId - 0x400); price = sceneryEntry->banner.price; @@ -1248,7 +1248,7 @@ bool window_scenery_set_selected_item(sint32 sceneryId) { bool result = false; rct_window * w = window_bring_to_front_by_class(WC_SCENERY); - if (w != NULL) { + if (w != nullptr) { sint32 tabIndex = window_scenery_find_tab_with_scenery_id(sceneryId); if (tabIndex != -1) { gWindowSceneryActiveTabIndex = tabIndex; diff --git a/src/openrct2/windows/Sign.cpp b/src/openrct2/windows/Sign.cpp index 01f1168ea4..59e6bcebe6 100644 --- a/src/openrct2/windows/Sign.cpp +++ b/src/openrct2/windows/Sign.cpp @@ -65,34 +65,34 @@ static void window_sign_paint(rct_window *w, rct_drawpixelinfo *dpi); // 0x98E44C static rct_window_event_list window_sign_events = { - NULL, + nullptr, window_sign_mouseup, - NULL, + nullptr, window_sign_mousedown, window_sign_dropdown, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_sign_textinput, window_sign_viewport_rotate, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_sign_invalidate, window_sign_paint, - NULL + nullptr }; static void window_sign_small_mouseup(rct_window *w, rct_widgetindex widgetIndex); @@ -101,34 +101,34 @@ static void window_sign_small_invalidate(rct_window *w); // 0x9A410C static rct_window_event_list window_sign_small_events = { - NULL, + nullptr, window_sign_small_mouseup, - NULL, + nullptr, window_sign_mousedown, window_sign_small_dropdown, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_sign_textinput, window_sign_viewport_rotate, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_sign_small_invalidate, window_sign_paint, - NULL + nullptr }; /** @@ -143,7 +143,7 @@ void window_sign_open(rct_windownumber number) // Check if window is already open w = window_bring_to_front_by_number(WC_BANNER, number); - if (w != NULL) + if (w != nullptr) return; w = window_create_auto_pos(WW, WH, &window_sign_events, WC_BANNER, WF_NO_SCROLLING); @@ -309,7 +309,7 @@ static void window_sign_dropdown(rct_window *w, rct_widgetindex widgetIndex, sin */ static void window_sign_textinput(rct_window *w, rct_widgetindex widgetIndex, char *text) { - if (widgetIndex == WIDX_SIGN_TEXT && text != NULL) { + if (widgetIndex == WIDX_SIGN_TEXT && text != nullptr) { game_do_command(1, GAME_COMMAND_FLAG_APPLY, w->number, *((sint32*)(text + 0)), GAME_COMMAND_SET_SIGN_NAME, *((sint32*)(text + 8)), *((sint32*)(text + 4))); game_do_command(2, GAME_COMMAND_FLAG_APPLY, w->number, *((sint32*)(text + 12)), GAME_COMMAND_SET_SIGN_NAME, *((sint32*)(text + 20)), *((sint32*)(text + 16))); game_do_command(0, GAME_COMMAND_FLAG_APPLY, w->number, *((sint32*)(text + 24)), GAME_COMMAND_SET_SIGN_NAME, *((sint32*)(text + 32)), *((sint32*)(text + 28))); @@ -350,7 +350,7 @@ static void window_sign_paint(rct_window *w, rct_drawpixelinfo *dpi) window_draw_widgets(w, dpi); // Draw viewport - if (w->viewport != NULL) { + if (w->viewport != nullptr) { window_draw_viewport(dpi, w); } } @@ -405,7 +405,7 @@ void window_sign_small_open(rct_windownumber number){ // Check if window is already open w = window_bring_to_front_by_number(WC_BANNER, number); - if (w != NULL) + if (w != nullptr) return; w = window_create_auto_pos(WW, WH, &window_sign_small_events, WC_BANNER, 0); diff --git a/src/openrct2/windows/Staff.cpp b/src/openrct2/windows/Staff.cpp index a4a71b5410..de830f908a 100644 --- a/src/openrct2/windows/Staff.cpp +++ b/src/openrct2/windows/Staff.cpp @@ -167,93 +167,93 @@ static rct_window_event_list window_staff_overview_events = { window_staff_overview_resize, window_staff_overview_mousedown, window_staff_overview_dropdown, - NULL, + nullptr, window_staff_overview_update, - NULL, - NULL, + nullptr, + nullptr, window_staff_overview_tool_update, window_staff_overview_tool_down, - NULL, - NULL, + nullptr, + nullptr, window_staff_overview_tool_abort, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_staff_overview_text_input, window_staff_overview_viewport_rotate, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_staff_overview_invalidate, //Invalidate window_staff_overview_paint, //Paint - NULL + nullptr }; // 0x992B5C static rct_window_event_list window_staff_options_events = { - NULL, + nullptr, window_staff_options_mouseup, window_staff_stats_resize, window_staff_options_mousedown, window_staff_options_dropdown, window_staff_unknown_05, window_staff_options_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_staff_options_invalidate, //Invalidate window_staff_options_paint, //Paint - NULL + nullptr }; // 0x992BCC static rct_window_event_list window_staff_stats_events = { - NULL, + nullptr, window_staff_stats_mouseup, window_staff_stats_resize, - NULL, - NULL, + nullptr, + nullptr, window_staff_unknown_05, window_staff_stats_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_staff_stats_invalidate, //Invalidate window_staff_stats_paint, //Paint - NULL + nullptr }; static rct_window_event_list *window_staff_page_events[] = { @@ -298,7 +298,7 @@ static uint8 _availableCostumes[ENTERTAINER_COSTUME_COUNT]; rct_window *window_staff_open(rct_peep* peep) { rct_window* w = window_bring_to_front_by_number(WC_PEEP, peep->sprite_index); - if (w == NULL) { + if (w == nullptr) { w = window_create_auto_pos(WW, WH, &window_staff_overview_events, WC_PEEP, WF_10 | WF_RESIZABLE); w->number = peep->sprite_index; @@ -1101,7 +1101,7 @@ void window_staff_overview_tool_update(rct_window* w, rct_widgetindex widgetInde gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; sint32 map_x, map_y; - footpath_get_coordinates_from_pos(x, y + 16, &map_x, &map_y, NULL, NULL); + footpath_get_coordinates_from_pos(x, y + 16, &map_x, &map_y, nullptr, nullptr); if (map_x != MAP_LOCATION_NULL) { gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; gMapSelectType = MAP_SELECT_TYPE_FULL; @@ -1115,7 +1115,7 @@ void window_staff_overview_tool_update(rct_window* w, rct_widgetindex widgetInde gPickupPeepImage = UINT32_MAX; sint32 interactionType; - get_map_coordinates_from_pos(x, y, VIEWPORT_INTERACTION_MASK_NONE, NULL, NULL, &interactionType, NULL, NULL); + get_map_coordinates_from_pos(x, y, VIEWPORT_INTERACTION_MASK_NONE, nullptr, nullptr, &interactionType, nullptr, nullptr); if (interactionType == VIEWPORT_INTERACTION_ITEM_NONE) return; @@ -1147,7 +1147,7 @@ void window_staff_overview_tool_down(rct_window* w, rct_widgetindex widgetIndex, if (widgetIndex == WIDX_PICKUP) { sint32 dest_x, dest_y; rct_map_element* mapElement; - footpath_get_coordinates_from_pos(x, y + 16, &dest_x, &dest_y, NULL, &mapElement); + footpath_get_coordinates_from_pos(x, y + 16, &dest_x, &dest_y, nullptr, &mapElement); if (dest_x == MAP_LOCATION_NULL) return; @@ -1157,7 +1157,7 @@ void window_staff_overview_tool_down(rct_window* w, rct_widgetindex widgetIndex, } else if (widgetIndex == WIDX_PATROL){ sint32 dest_x, dest_y; - footpath_get_coordinates_from_pos(x, y, &dest_x, &dest_y, NULL, NULL); + footpath_get_coordinates_from_pos(x, y, &dest_x, &dest_y, nullptr, nullptr); if (dest_x == MAP_LOCATION_NULL) return; @@ -1187,7 +1187,7 @@ void window_staff_overview_text_input(rct_window *w, rct_widgetindex widgetIndex if (widgetIndex != WIDX_RENAME) return; - if (text == NULL) + if (text == nullptr) return; gGameCommandErrorTitle = STR_STAFF_ERROR_CANT_NAME_STAFF_MEMBER; diff --git a/src/openrct2/windows/StaffFirePrompt.cpp b/src/openrct2/windows/StaffFirePrompt.cpp index c06984d2de..2c884b3f26 100644 --- a/src/openrct2/windows/StaffFirePrompt.cpp +++ b/src/openrct2/windows/StaffFirePrompt.cpp @@ -47,34 +47,34 @@ static void window_staff_fire_paint(rct_window *w, rct_drawpixelinfo *dpi); //0x9A3F7C static rct_window_event_list window_staff_fire_events = { - NULL, + nullptr, window_staff_fire_mouseup, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_staff_fire_paint, - NULL + nullptr }; /** Based off of rct2: 0x6C0A77 */ void window_staff_fire_prompt_open(rct_peep* peep) diff --git a/src/openrct2/windows/TextInput.cpp b/src/openrct2/windows/TextInput.cpp index 8cb8050cf4..252c57c9f2 100644 --- a/src/openrct2/windows/TextInput.cpp +++ b/src/openrct2/windows/TextInput.cpp @@ -64,32 +64,32 @@ static void draw_ime_composition(rct_drawpixelinfo * dpi, int cursorX, int curso static rct_window_event_list window_text_input_events = { window_text_input_close, window_text_input_mouseup, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_text_input_update7, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_text_input_invalidate, window_text_input_paint, - NULL + nullptr }; rct_string_id input_text_description; @@ -169,7 +169,7 @@ void window_text_input_raw_open(rct_window* call_w, rct_widgetindex call_widget, // Enter in the text input buffer any existing // text. - if (existing_text != NULL) + if (existing_text != nullptr) safe_strcpy(text_input, existing_text, maxLength); // In order to prevent strings that exceed the maxLength @@ -233,15 +233,15 @@ static void window_text_input_mouseup(rct_window *w, rct_widgetindex widgetIndex context_stop_text_input(); // Pass back the text that has been entered. // ecx when zero means text input failed - if (calling_w != NULL) - window_event_textinput_call(calling_w, calling_widget, NULL); + if (calling_w != nullptr) + window_event_textinput_call(calling_w, calling_widget, nullptr); window_close(w); break; case WIDX_OKAY: context_stop_text_input(); // Pass back the text that has been entered. // ecx when none zero means text input success - if (calling_w != NULL) + if (calling_w != nullptr) window_event_textinput_call(calling_w, calling_widget, text_input); window_close(w); } @@ -301,7 +301,7 @@ static void window_text_input_paint(rct_window *w, rct_drawpixelinfo *dpi) // Make a 1 utf8-character wide string for measuring the width // of the currently selected character. utf8 tmp[5] = { 0 }; // This is easier than setting temp_string[0..5] - uint32 codepoint = utf8_get_next(text_input + gTextInput->SelectionStart, NULL); + uint32 codepoint = utf8_get_next(text_input + gTextInput->SelectionStart, nullptr); utf8_write_codepoint(tmp, codepoint); width = Math::Max(gfx_get_string_width(tmp) - 2, 4); } diff --git a/src/openrct2/windows/TileInspector.cpp b/src/openrct2/windows/TileInspector.cpp index 1f13b6f934..3e11fd3151 100644 --- a/src/openrct2/windows/TileInspector.cpp +++ b/src/openrct2/windows/TileInspector.cpp @@ -477,31 +477,31 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi); static void window_tile_inspector_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint32 scrollIndex); static rct_window_event_list TileInspectorWindowEvents = { - NULL, + nullptr, window_tile_inspector_mouseup, window_tile_inspector_resize, window_tile_inspector_mousedown, window_tile_inspector_dropdown, - NULL, + nullptr, window_tile_inspector_update, - NULL, - NULL, + nullptr, + nullptr, window_tile_inspector_tool_update, window_tile_inspector_tool_down, window_tile_inspector_tool_drag, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_tile_inspector_scrollgetsize, window_tile_inspector_scrollmousedown, - NULL, + nullptr, window_tile_inspector_scrollmouseover, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_tile_inspector_invalidate, window_tile_inspector_paint, window_tile_inspector_scrollpaint @@ -539,7 +539,7 @@ void window_tile_inspector_open() // Check if window is already open window = window_bring_to_front_by_class(WC_TILE_INSPECTOR); - if (window != NULL) + if (window != nullptr) return; window = window_create( @@ -1673,7 +1673,7 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi) // Raise / lower label x = w->x + w->widgets[WIDX_GROUPBOX_DETAILS].left + 7; y = w->y + w->widgets[WIDX_SURFACE_SPINNER_HEIGHT].top; - gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, NULL, COLOUR_DARK_GREEN, x, y); + gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, nullptr, COLOUR_DARK_GREEN, x, y); // Current base height x = w->x + w->widgets[WIDX_SURFACE_SPINNER_HEIGHT].left + 3; @@ -1683,7 +1683,7 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi) // Raised corners x = w->x + w->widgets[WIDX_GROUPBOX_DETAILS].left + 7; y = w->y + w->widgets[WIDX_SURFACE_CHECK_CORNER_E].top; - gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_SURFACE_CORNERS, NULL, COLOUR_DARK_GREEN, x, y); + gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_SURFACE_CORNERS, nullptr, COLOUR_DARK_GREEN, x, y); break; } @@ -1700,13 +1700,13 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi) gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_PATH_ADDITIONS, &additionNameId, COLOUR_DARK_GREEN, x, y + 11); } else - gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_PATH_ADDITIONS_NONE, NULL, COLOUR_DARK_GREEN, x, y + 11); + gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_PATH_ADDITIONS_NONE, nullptr, COLOUR_DARK_GREEN, x, y + 11); // Properties // Raise / lower label x = w->x + w->widgets[WIDX_GROUPBOX_DETAILS].left + 7; y = w->y + w->widgets[WIDX_PATH_SPINNER_HEIGHT].top; - gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, NULL, COLOUR_DARK_GREEN, x, y); + gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, nullptr, COLOUR_DARK_GREEN, x, y); // Current base height x = w->x + w->widgets[WIDX_PATH_SPINNER_HEIGHT].left + 3; @@ -1716,7 +1716,7 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi) // Path connections x = w->x + w->widgets[WIDX_GROUPBOX_DETAILS].left + 7; y = w->y + w->widgets[WIDX_PATH_CHECK_EDGE_W].top; - gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_PATH_CONECTED_EDGES, NULL, COLOUR_DARK_GREEN, x, y); + gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_PATH_CONECTED_EDGES, nullptr, COLOUR_DARK_GREEN, x, y); break; } @@ -1740,7 +1740,7 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi) // Properties // Raise / lower label y = w->y + w->widgets[WIDX_TRACK_SPINNER_HEIGHT].top; - gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, NULL, COLOUR_DARK_GREEN, x, y); + gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, nullptr, COLOUR_DARK_GREEN, x, y); // Current base height x = w->x + w->widgets[WIDX_TRACK_SPINNER_HEIGHT].left + 3; @@ -1774,7 +1774,7 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi) // Properties // Raise / Lower y = w->y + w->widgets[WIDX_SCENERY_SPINNER_HEIGHT].top; - gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, NULL, COLOUR_DARK_GREEN, x, y); + gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, nullptr, COLOUR_DARK_GREEN, x, y); // Current base height x = w->x + w->widgets[WIDX_SCENERY_SPINNER_HEIGHT].left + 3; @@ -1784,11 +1784,11 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi) // Quarter tile x = w->x + w->widgets[WIDX_GROUPBOX_DETAILS].left + 7; y = w->y + w->widgets[WIDX_SCENERY_CHECK_QUARTER_E].top; - gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_SCENERY_QUADRANT_LABEL, NULL, COLOUR_DARK_GREEN, x, y); + gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_SCENERY_QUADRANT_LABEL, nullptr, COLOUR_DARK_GREEN, x, y); // Collision y = w->y + w->widgets[WIDX_SCENERY_CHECK_COLLISION_E].top; - gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_COLLISSION, NULL, COLOUR_DARK_GREEN, x, y); + gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_COLLISSION, nullptr, COLOUR_DARK_GREEN, x, y); break; } @@ -1832,7 +1832,7 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi) // Properties // Raise / Lower y = w->y + w->widgets[WIDX_ENTRANCE_SPINNER_HEIGHT].top; - gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, NULL, COLOUR_DARK_GREEN, x, y); + gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, nullptr, COLOUR_DARK_GREEN, x, y); // Current base height x = w->x + w->widgets[WIDX_ENTRANCE_SPINNER_HEIGHT].left + 3; @@ -1853,13 +1853,13 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi) gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT, &gBanners[mapElement->properties.wall.banner_index].string_idx, COLOUR_DARK_GREEN, x, y + 11); } else { - gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_ENTRY_BANNER_NONE, NULL, COLOUR_DARK_GREEN, x, y + 11); + gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_ENTRY_BANNER_NONE, nullptr, COLOUR_DARK_GREEN, x, y + 11); } // Properties // Raise / lower label y = w->y + w->widgets[WIDX_WALL_SPINNER_HEIGHT].top; - gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, NULL, COLOUR_DARK_GREEN, x, y); + gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, nullptr, COLOUR_DARK_GREEN, x, y); // Current base height x = w->x + w->widgets[WIDX_WALL_SPINNER_HEIGHT].left + 3; @@ -1869,7 +1869,7 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi) // Slope label x = w->x + w->widgets[WIDX_GROUPBOX_DETAILS].left + 7; y = w->y + w->widgets[WIDX_WALL_DROPDOWN_SLOPE].top; - gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_WALL_SLOPE, NULL, COLOUR_DARK_GREEN, x, y); + gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_WALL_SLOPE, nullptr, COLOUR_DARK_GREEN, x, y); break; } @@ -1894,13 +1894,13 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi) gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT, &gBanners[bannerIndex].string_idx, COLOUR_DARK_GREEN, x, y + 22); } else { - gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_ENTRY_BANNER_NONE, NULL, COLOUR_DARK_GREEN, x, y + 22); + gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_ENTRY_BANNER_NONE, nullptr, COLOUR_DARK_GREEN, x, y + 22); } // Properties // Raise / lower label y = w->y + w->widgets[WIDX_LARGE_SCENERY_SPINNER_HEIGHT].top; - gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, NULL, COLOUR_DARK_GREEN, x, y); + gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, nullptr, COLOUR_DARK_GREEN, x, y); // Current base height x = w->x + w->widgets[WIDX_LARGE_SCENERY_SPINNER_HEIGHT].left + 3; @@ -1925,7 +1925,7 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi) // Properties // Raise / lower label y = w->y + w->widgets[WIDX_BANNER_SPINNER_HEIGHT].top; - gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, NULL, COLOUR_DARK_GREEN, x, y); + gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, nullptr, COLOUR_DARK_GREEN, x, y); // Current base height x = w->x + w->widgets[WIDX_BANNER_SPINNER_HEIGHT].left + 3; @@ -1935,7 +1935,7 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi) // Blocked paths y += 28; x = w->x + w->widgets[WIDX_GROUPBOX_DETAILS].left + 7; - gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_BANNER_BLOCKED_PATHS, NULL, COLOUR_DARK_GREEN, x, y); + gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_BANNER_BLOCKED_PATHS, nullptr, COLOUR_DARK_GREEN, x, y); break; } @@ -1944,7 +1944,7 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi) // Properties // Raise / lower label y = w->y + w->widgets[WIDX_CORRUPT_SPINNER_HEIGHT].top; - gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, NULL, COLOUR_DARK_GREEN, x, y); + gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, nullptr, COLOUR_DARK_GREEN, x, y); // Current base height x = w->x + w->widgets[WIDX_CORRUPT_SPINNER_HEIGHT].left + 3; diff --git a/src/openrct2/windows/TitleCommandEditor.cpp b/src/openrct2/windows/TitleCommandEditor.cpp index 6b7ca032ad..64b20e6a27 100644 --- a/src/openrct2/windows/TitleCommandEditor.cpp +++ b/src/openrct2/windows/TitleCommandEditor.cpp @@ -79,7 +79,7 @@ static sint32 _window_title_command_editor_index; static char textbox1Buffer[BUF_SIZE]; static char textbox2Buffer[BUF_SIZE]; static TitleCommand command = { TITLE_SCRIPT_LOAD, { 0 } }; -static TitleSequence * _sequence = NULL; +static TitleSequence * _sequence = nullptr; static rct_widget window_title_command_editor_widgets[] = { { WWT_FRAME, 1, 0, WW-1, 0, WH-1, 0xFFFFFFFF, STR_NONE }, // panel / background @@ -117,34 +117,34 @@ static rct_xy16 get_location(); static uint8 get_zoom(); static rct_window_event_list window_title_command_editor_events = { - NULL, + nullptr, window_title_command_editor_mouseup, - NULL, + nullptr, window_title_command_editor_mousedown, window_title_command_editor_dropdown, - NULL, + nullptr, window_title_command_editor_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_title_command_editor_textinput, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_title_command_editor_invalidate, window_title_command_editor_paint, - NULL + nullptr }; static sint32 get_command_info_index(sint32 index) @@ -169,11 +169,11 @@ static rct_xy16 get_location() { rct_xy16 mapCoord = { 0 }; rct_window *w = window_get_main(); - if (w != NULL) { + if (w != nullptr) { sint32 interactionType; rct_map_element *mapElement; - get_map_coordinates_from_pos(w->viewport->view_width / 2, w->viewport->view_height / 2, VIEWPORT_INTERACTION_MASK_TERRAIN, &mapCoord.x, &mapCoord.y, &interactionType, &mapElement, NULL); + get_map_coordinates_from_pos(w->viewport->view_width / 2, w->viewport->view_height / 2, VIEWPORT_INTERACTION_MASK_TERRAIN, &mapCoord.x, &mapCoord.y, &interactionType, &mapElement, nullptr); mapCoord.x -= 16; mapCoord.x /= 32; mapCoord.y -= 16; @@ -188,7 +188,7 @@ static uint8 get_zoom() { uint8 zoom = 0; rct_window *w = window_get_main(); - if (w != NULL) { + if (w != nullptr) { zoom = w->viewport->zoom; } return zoom; @@ -199,7 +199,7 @@ static void _window_title_command_editor_open(TitleSequence * sequence, sint32 i _sequence = sequence; // Check if window is already open - if (window_find_by_class(WC_TITLE_COMMAND_EDITOR) != NULL) + if (window_find_by_class(WC_TITLE_COMMAND_EDITOR) != nullptr) return; rct_window * window = window_create_centred( @@ -304,7 +304,7 @@ static void window_title_command_editor_mouseup(rct_window *w, rct_widgetindex w TileSequenceSave(_sequence); rct_window *title_editor_w = window_find_by_class(WC_TITLE_EDITOR); - if (title_editor_w != NULL) { + if (title_editor_w != nullptr) { title_editor_w->selected_list_item = _window_title_command_editor_index; } window_close(w); @@ -452,7 +452,7 @@ static void window_title_command_editor_textinput(rct_window * w, rct_widgetinde if (value > 255 && command.Type != TITLE_SCRIPT_WAIT) value = 255; switch (widgetIndex) { case WIDX_TEXTBOX_FULL: - if (text == NULL) { + if (text == nullptr) { if (*end == '\0') { if (command.Type == TITLE_SCRIPT_WAIT) { if (value < 100) value = 100; @@ -474,7 +474,7 @@ static void window_title_command_editor_textinput(rct_window * w, rct_widgetinde } break; case WIDX_TEXTBOX_X: - if (text == NULL) { + if (text == nullptr) { if (*end == '\0') { command.X = (uint8)value; } @@ -485,7 +485,7 @@ static void window_title_command_editor_textinput(rct_window * w, rct_widgetinde } break; case WIDX_TEXTBOX_Y: - if (text == NULL) { + if (text == nullptr) { if (*end == '\0') { command.Y = (uint8)value; } @@ -550,13 +550,13 @@ static void window_title_command_editor_paint(rct_window *w, rct_drawpixelinfo * { window_draw_widgets(w, dpi); - gfx_draw_string_left(dpi, STR_TITLE_COMMAND_EDITOR_COMMAND_LABEL, NULL, w->colours[1], w->x + WS, w->y + BY - 14); - gfx_draw_string_left(dpi, get_command_info(command.Type).descStringId, NULL, w->colours[1], w->x + WS, w->y + BY2 - 14); + gfx_draw_string_left(dpi, STR_TITLE_COMMAND_EDITOR_COMMAND_LABEL, nullptr, w->colours[1], w->x + WS, w->y + BY - 14); + gfx_draw_string_left(dpi, get_command_info(command.Type).descStringId, nullptr, w->colours[1], w->x + WS, w->y + BY2 - 14); gfx_draw_string_left_clipped( dpi, get_command_info(command.Type).nameStringId, - NULL, + nullptr, w->colours[1], w->x + w->widgets[WIDX_COMMAND].left + 1, w->y + w->widgets[WIDX_COMMAND].top, @@ -566,7 +566,7 @@ static void window_title_command_editor_paint(rct_window *w, rct_drawpixelinfo * gfx_draw_string_left_clipped( dpi, SpeedNames[command.Speed - 1], - NULL, + nullptr, w->colours[1], w->x + w->widgets[WIDX_INPUT].left + 1, w->y + w->widgets[WIDX_INPUT].top, @@ -577,7 +577,7 @@ static void window_title_command_editor_paint(rct_window *w, rct_drawpixelinfo * gfx_draw_string_left_clipped( dpi, STR_TITLE_COMMAND_EDITOR_NO_SAVE_SELECTED, - NULL, + nullptr, w->colours[1], w->x + w->widgets[WIDX_INPUT].left + 1, w->y + w->widgets[WIDX_INPUT].top, diff --git a/src/openrct2/windows/TitleEditor.cpp b/src/openrct2/windows/TitleEditor.cpp index e93d317d61..9a2f1a12d2 100644 --- a/src/openrct2/windows/TitleEditor.cpp +++ b/src/openrct2/windows/TitleEditor.cpp @@ -72,26 +72,26 @@ static rct_window_event_list window_title_editor_events = { window_title_editor_resize, window_title_editor_mousedown, window_title_editor_dropdown, - NULL, + nullptr, window_title_editor_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_title_editor_scrollgetsize, window_title_editor_scrollmousedown, - NULL, + nullptr, window_title_editor_scrollmouseover, window_title_editor_textinput, - NULL, - NULL, + nullptr, + nullptr, window_title_editor_tooltip, - NULL, - NULL, + nullptr, + nullptr, window_title_editor_invalidate, window_title_editor_paint, window_title_editor_scrollpaint, @@ -194,11 +194,11 @@ static rct_widget window_title_editor_widgets[] = { static size_t _selectedTitleSequence = 0; static bool _isSequenceReadOnly; -static TitleSequence * _editingTitleSequence = NULL; +static TitleSequence * _editingTitleSequence = nullptr; static bool _isSequencePlaying = false; static const utf8 * _sequenceName; -static utf8 * _renameSavePath = NULL; +static utf8 * _renameSavePath = nullptr; static sint16 _window_title_editor_highlighted_index; @@ -224,7 +224,7 @@ static void _window_title_editor_open(sint32 tab) // Check if window is already open window = window_bring_to_front_by_class(WC_TITLE_EDITOR); - if (window != NULL) + if (window != nullptr) return; window = window_create_auto_pos(WW, WH2, &window_title_editor_events, WC_TITLE_EDITOR, WF_10 | WF_RESIZABLE); @@ -286,16 +286,16 @@ static void window_title_editor_close(rct_window *w) window_close_by_class(WC_TITLE_COMMAND_EDITOR); FreeTitleSequence(_editingTitleSequence); - _editingTitleSequence = NULL; + _editingTitleSequence = nullptr; _isSequencePlaying = false; - _sequenceName = NULL; + _sequenceName = nullptr; SafeFree(_renameSavePath); } static void window_title_editor_mouseup(rct_window *w, rct_widgetindex widgetIndex) { - bool commandEditorOpen = (window_find_by_class(WC_TITLE_COMMAND_EDITOR) != NULL); + bool commandEditorOpen = (window_find_by_class(WC_TITLE_COMMAND_EDITOR) != nullptr); switch (widgetIndex) { case WIDX_TITLE_EDITOR_CLOSE: window_close(w); @@ -311,7 +311,7 @@ static void window_title_editor_mouseup(rct_window *w, rct_widgetindex widgetInd } break; case WIDX_TITLE_EDITOR_DUPLICATE_BUTTON: - if (!commandEditorOpen && _editingTitleSequence != NULL) { + if (!commandEditorOpen && _editingTitleSequence != nullptr) { window_text_input_open(w, widgetIndex, STR_TITLE_EDITOR_ACTION_DUPLICATE, STR_TITLE_EDITOR_ENTER_NAME_FOR_SEQUENCE, STR_STRING, (uintptr_t)_editingTitleSequence->Name, 64); } break; @@ -322,7 +322,7 @@ static void window_title_editor_mouseup(rct_window *w, rct_widgetindex widgetInd } break; case WIDX_TITLE_EDITOR_RENAME_SAVE_BUTTON: - if (window_title_editor_check_can_edit() && _editingTitleSequence != NULL) { + if (window_title_editor_check_can_edit() && _editingTitleSequence != nullptr) { window_text_input_open(w, widgetIndex, STR_TRACK_MANAGE_RENAME, STR_TITLE_EDITOR_ENTER_NAME_FOR_SEQUENCE, STR_STRING, (uintptr_t)_editingTitleSequence->Name, 64); } break; @@ -332,7 +332,7 @@ static void window_title_editor_mouseup(rct_window *w, rct_widgetindex widgetInd ////////////////////////////////////////////////////////////////////////////////////////////////////// case WIDX_TITLE_EDITOR_ADD_SAVE: if (!_isSequenceReadOnly && !_isSequencePlaying && !commandEditorOpen) { - window_loadsave_open(LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME, NULL); + window_loadsave_open(LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME, nullptr); window_loadsave_set_loadsave_callback(window_title_editor_add_park_callback); } break; @@ -500,7 +500,7 @@ static void window_title_editor_mousedown(rct_window *w, rct_widgetindex widgetI break; } case WIDX_TITLE_EDITOR_PRESETS_DROPDOWN: - if (window_find_by_class(WC_TITLE_COMMAND_EDITOR) != NULL) { + if (window_find_by_class(WC_TITLE_COMMAND_EDITOR) != nullptr) { window_error_open(STR_TITLE_EDITOR_ERR_CANT_CHANGE_WHILE_EDITOR_IS_OPEN, STR_NONE); } else { sint32 numItems = (sint32)title_sequence_manager_get_count(); @@ -765,7 +765,7 @@ static void window_title_editor_paint(rct_window *w, rct_drawpixelinfo *dpi) switch (w->selected_tab) { case WINDOW_TITLE_EDITOR_TAB_PRESETS: set_format_arg(0, uintptr_t, _sequenceName); - gfx_draw_string_left(dpi, STR_TITLE_SEQUENCE, NULL, w->colours[1], w->x + 10, w->y + window_title_editor_widgets[WIDX_TITLE_EDITOR_PRESETS].top + 1); + gfx_draw_string_left(dpi, STR_TITLE_SEQUENCE, nullptr, w->colours[1], w->x + 10, w->y + window_title_editor_widgets[WIDX_TITLE_EDITOR_PRESETS].top + 1); gfx_draw_string_left_clipped( dpi, STR_STRING, @@ -804,7 +804,7 @@ static void window_title_editor_scrollpaint_saves(rct_window *w, rct_drawpixelin sint32 x = 0; sint32 y = 0; - if (_editingTitleSequence == NULL) { + if (_editingTitleSequence == nullptr) { return; } for (sint32 i = 0; i < (sint32)_editingTitleSequence->NumSaves; i++, y += ROW_HEIGHT) { @@ -952,7 +952,7 @@ static void window_title_editor_load_sequence(size_t index) const char * path = title_sequence_manager_get_path(index); TitleSequence * titleSequence = LoadTitleSequence(path); - if (titleSequence == NULL) { + if (titleSequence == nullptr) { window_error_open(STR_FAILED_TO_LOAD_FILE_CONTAINS_INVALID_DATA, STR_NONE); return; } @@ -974,7 +974,7 @@ static ITitleSequencePlayer * window_title_editor_get_player() static bool window_title_editor_check_can_edit() { - bool commandEditorOpen = (window_find_by_class(WC_TITLE_COMMAND_EDITOR) != NULL); + bool commandEditorOpen = (window_find_by_class(WC_TITLE_COMMAND_EDITOR) != nullptr); if (_isSequenceReadOnly) { window_error_open(STR_ERROR_CANT_CHANGE_TITLE_SEQUENCE, STR_NONE); } else if (_isSequencePlaying) { diff --git a/src/openrct2/windows/TitleScenarioSelect.cpp b/src/openrct2/windows/TitleScenarioSelect.cpp index 914d5812a7..2f5c9e6b5b 100644 --- a/src/openrct2/windows/TitleScenarioSelect.cpp +++ b/src/openrct2/windows/TitleScenarioSelect.cpp @@ -51,7 +51,7 @@ typedef struct sc_list_item { }; } sc_list_item; -static sc_list_item *_listItems = NULL; +static sc_list_item *_listItems = nullptr; enum { WIDX_BACKGROUND, @@ -112,29 +112,29 @@ static void window_scenarioselect_scrollpaint(rct_window *w, rct_drawpixelinfo * static rct_window_event_list window_scenarioselect_events = { window_scenarioselect_close, window_scenarioselect_mouseup, - NULL, + nullptr, window_scenarioselect_mousedown, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_scenarioselect_scrollgetsize, window_scenarioselect_scrollmousedown, - NULL, + nullptr, window_scenarioselect_scrollmouseover, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_scenarioselect_invalidate, window_scenarioselect_paint, window_scenarioselect_scrollpaint @@ -160,7 +160,7 @@ static void _window_scenarioselect_open(scenarioselect_callback callback) _callback = callback; - if (window_bring_to_front_by_class(WC_SCENARIO_SELECT) != NULL) + if (window_bring_to_front_by_class(WC_SCENARIO_SELECT) != nullptr) return; // Load scenario list @@ -190,7 +190,7 @@ static void _window_scenarioselect_open(scenarioselect_callback callback) window_init_scroll_widgets(window); window->viewport_focus_coordinates.var_480 = -1; - window->highlighted_scenario = NULL; + window->highlighted_scenario = nullptr; } /** @@ -250,7 +250,7 @@ static void window_scenarioselect_mousedown(rct_window *w, rct_widgetindex widge { if (widgetIndex >= WIDX_TAB1 && widgetIndex <= WIDX_TAB8) { w->selected_tab = widgetIndex - 4; - w->highlighted_scenario = NULL; + w->highlighted_scenario = nullptr; initialise_list_items(w); window_invalidate(w); window_event_resize_call(w); @@ -309,7 +309,7 @@ static void window_scenarioselect_scrollmouseover(rct_window *w, sint32 scrollIn { bool originalShowLockedInformation = _showLockedInformation; _showLockedInformation = false; - const scenario_index_entry *selected = NULL; + const scenario_index_entry *selected = nullptr; for (sc_list_item *listItem = _listItems; listItem->type != LIST_ITEM_TYPE_END; listItem++) { switch (listItem->type) { case LIST_ITEM_TYPE_HEADING: @@ -391,14 +391,14 @@ static void window_scenarioselect_paint(rct_window *w, rct_drawpixelinfo *dpi) // Return if no scenario highlighted scenario = w->highlighted_scenario; - if (scenario == NULL) { + if (scenario == nullptr) { if (_showLockedInformation) { // Show locked information sint32 x = w->x + window_scenarioselect_widgets[WIDX_SCENARIOLIST].right + 4; sint32 y = w->y + window_scenarioselect_widgets[WIDX_TABCONTENT].top + 5; - gfx_draw_string_centred_clipped(dpi, STR_SCENARIO_LOCKED, NULL, COLOUR_BLACK, x + 85, y, 170); + gfx_draw_string_centred_clipped(dpi, STR_SCENARIO_LOCKED, nullptr, COLOUR_BLACK, x + 85, y, 170); y += 15; - y += gfx_draw_string_left_wrapped(dpi, NULL, x, y, 170, STR_SCENARIO_LOCKED_DESC, COLOUR_BLACK) + 5; + y += gfx_draw_string_left_wrapped(dpi, nullptr, x, y, 170, STR_SCENARIO_LOCKED_DESC, COLOUR_BLACK) + 5; } return; } @@ -435,7 +435,7 @@ static void window_scenarioselect_paint(rct_window *w, rct_drawpixelinfo *dpi) y += gfx_draw_string_left_wrapped(dpi, gCommonFormatArgs, x, y, 170, STR_OBJECTIVE, COLOUR_BLACK) + 5; // Scenario score - if (scenario->highscore != NULL) { + if (scenario->highscore != nullptr) { // TODO: Should probably be translatable const utf8 *completedByName = "???"; if (!str_is_null_or_empty(scenario->highscore->name)) { @@ -486,7 +486,7 @@ static void window_scenarioselect_scrollpaint(rct_window *w, rct_drawpixelinfo * gfx_filter_rect(dpi, 0, y, w->width, y + 23, PALETTE_DARKEN_1); } - bool isCompleted = scenario->highscore != NULL; + bool isCompleted = scenario->highscore != nullptr; bool isDisabled = listItem->scenario.is_locked; // Draw scenario name @@ -533,11 +533,11 @@ static void draw_category_heading(rct_window *w, rct_drawpixelinfo *dpi, sint32 // Draw string sint32 centreX = (left + right) / 2; - gfx_draw_string_centred(dpi, stringId, centreX, y, baseColour, NULL); + gfx_draw_string_centred(dpi, stringId, centreX, y, baseColour, nullptr); // Get string dimensions utf8 *buffer = gCommonStringFormatBuffer; - format_string(buffer, 256, stringId, NULL); + format_string(buffer, 256, stringId, nullptr); sint32 categoryStringHalfWidth = (gfx_get_string_width(buffer) / 2) + 4; sint32 strLeft = centreX - categoryStringHalfWidth; sint32 strRight = centreX + categoryStringHalfWidth; @@ -626,7 +626,7 @@ static void initialise_list_items(rct_window *w) listItem->scenario.scenario = scenario; if (is_locking_enabled(w)) { listItem->scenario.is_locked = numUnlocks <= 0; - if (scenario->highscore == NULL) { + if (scenario->highscore == nullptr) { numUnlocks--; } else { // Mark RCT1 scenario as completed diff --git a/src/openrct2/windows/Tooltip.cpp b/src/openrct2/windows/Tooltip.cpp index e8c16ea243..17c2cc626b 100644 --- a/src/openrct2/windows/Tooltip.cpp +++ b/src/openrct2/windows/Tooltip.cpp @@ -38,34 +38,34 @@ static void window_tooltip_update(rct_window *w); static void window_tooltip_paint(rct_window *w, rct_drawpixelinfo *dpi); static rct_window_event_list window_tooltip_events = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_tooltip_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_tooltip_paint, - NULL + nullptr }; static utf8 _tooltipText[sizeof(gCommonStringFormatBuffer)]; @@ -87,7 +87,7 @@ static void _window_tooltip_show(rct_string_id id, sint32 x, sint32 y) sint32 width, height; w = window_find_by_class(WC_ERROR); - if (w != NULL) + if (w != nullptr) return; char* buffer = gCommonStringFormatBuffer; @@ -150,7 +150,7 @@ static void _window_tooltip_open(rct_window *widgetWindow, rct_widgetindex widge { rct_widget *widget; - if (widgetWindow == NULL || widgetIndex == -1) + if (widgetWindow == nullptr || widgetIndex == -1) return; widget = &widgetWindow->widgets[widgetIndex]; diff --git a/src/openrct2/windows/TopToolbar.cpp b/src/openrct2/windows/TopToolbar.cpp index 38f861308d..f5bcf1cd67 100644 --- a/src/openrct2/windows/TopToolbar.cpp +++ b/src/openrct2/windows/TopToolbar.cpp @@ -233,34 +233,34 @@ static void window_top_toolbar_invalidate(rct_window *w); static void window_top_toolbar_paint(rct_window *w, rct_drawpixelinfo *dpi); static rct_window_event_list window_top_toolbar_events = { - NULL, + nullptr, window_top_toolbar_mouseup, - NULL, + nullptr, window_top_toolbar_mousedown, window_top_toolbar_dropdown, - NULL, - NULL, - NULL, - NULL, // check if editor versions are significantly different... + nullptr, + nullptr, + nullptr, + nullptr, // check if editor versions are significantly different... window_top_toolbar_tool_update, // editor: 0x0066fB0E window_top_toolbar_tool_down, // editor: 0x0066fB5C window_top_toolbar_tool_drag, // editor: 0x0066fB37 window_top_toolbar_tool_up, // editor: 0x0066fC44 (Exactly the same) window_top_toolbar_tool_abort, // editor: 0x0066fA74 (Exactly the same) - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_top_toolbar_invalidate, window_top_toolbar_paint, - NULL + nullptr }; static void top_toolbar_init_view_menu(rct_window *window, rct_widget *widget); @@ -320,11 +320,11 @@ static void window_top_toolbar_mouseup(rct_window *w, rct_widgetindex widgetInde } break; case WIDX_ZOOM_OUT: - if ((mainWindow = window_get_main()) != NULL) + if ((mainWindow = window_get_main()) != nullptr) window_zoom_out(mainWindow, false); break; case WIDX_ZOOM_IN: - if ((mainWindow = window_get_main()) != NULL) + if ((mainWindow = window_get_main()) != nullptr) window_zoom_in(mainWindow, false); break; case WIDX_CLEAR_SCENERY: @@ -427,7 +427,7 @@ static void window_top_toolbar_mousedown(rct_window *w, rct_widgetindex widgetIn numItems = 12; #ifndef DISABLE_TWITCH - if (gConfigTwitch.channel != NULL && gConfigTwitch.channel[0] != 0) { + if (gConfigTwitch.channel != nullptr && gConfigTwitch.channel[0] != 0) { _menuDropdownIncludesTwitch = true; gDropdownItemsFormat[12] = STR_EMPTY; gDropdownItemsFormat[DDIDX_ENABLE_TWITCH] = STR_TOGGLE_OPTION; @@ -787,7 +787,7 @@ static void window_top_toolbar_invalidate(rct_window *w) } // Footpath button pressed down - if (window_find_by_class(WC_FOOTPATH) == NULL) + if (window_find_by_class(WC_FOOTPATH) == nullptr) w->pressed_widgets &= ~(1 << WIDX_PATH); else w->pressed_widgets |= (1 << WIDX_PATH); @@ -1042,7 +1042,7 @@ static void scenery_eyedropper_tool_down(sint16 x, sint16 y, rct_widgetindex wid { sint32 entryIndex = mapElement->properties.scenery.type; rct_scenery_entry * sceneryEntry = get_small_scenery_entry(entryIndex); - if (sceneryEntry != NULL && sceneryEntry != (rct_scenery_entry *)-1) { + if (sceneryEntry != nullptr && sceneryEntry != (rct_scenery_entry *)-1) { sint32 sceneryId = get_scenery_id_from_entry_index(OBJECT_TYPE_SMALL_SCENERY, entryIndex); if (sceneryId != -1 && window_scenery_set_selected_item(sceneryId)) { gWindowSceneryRotation = (get_current_rotation() + map_element_get_direction(mapElement)) & 3; @@ -1057,7 +1057,7 @@ static void scenery_eyedropper_tool_down(sint16 x, sint16 y, rct_widgetindex wid { sint32 entryIndex = mapElement->properties.wall.type; rct_scenery_entry * sceneryEntry = get_wall_entry(entryIndex); - if (sceneryEntry != NULL && sceneryEntry != (rct_scenery_entry *)-1) { + if (sceneryEntry != nullptr && sceneryEntry != (rct_scenery_entry *)-1) { sint32 sceneryId = get_scenery_id_from_entry_index(OBJECT_TYPE_WALLS, entryIndex); if (sceneryId != -1 && window_scenery_set_selected_item(sceneryId)) { gWindowSceneryPrimaryColour = mapElement->properties.wall.colour_1 & 0x1F; @@ -1072,7 +1072,7 @@ static void scenery_eyedropper_tool_down(sint16 x, sint16 y, rct_widgetindex wid { sint32 entryIndex = mapElement->properties.scenerymultiple.type & MAP_ELEMENT_LARGE_TYPE_MASK; rct_scenery_entry * sceneryEntry = get_large_scenery_entry(entryIndex); - if (sceneryEntry != NULL && sceneryEntry != (rct_scenery_entry *)-1) { + if (sceneryEntry != nullptr && sceneryEntry != (rct_scenery_entry *)-1) { sint32 sceneryId = get_scenery_id_from_entry_index(OBJECT_TYPE_LARGE_SCENERY, entryIndex); if (sceneryId != -1 && window_scenery_set_selected_item(sceneryId)) { gWindowSceneryRotation = (get_current_rotation() + map_element_get_direction(mapElement)) & 3; @@ -1088,7 +1088,7 @@ static void scenery_eyedropper_tool_down(sint16 x, sint16 y, rct_widgetindex wid sint32 bannerIndex = mapElement->properties.banner.index; rct_banner *banner = &gBanners[bannerIndex]; rct_scenery_entry * sceneryEntry = get_banner_entry(banner->type); - if (sceneryEntry != NULL && sceneryEntry != (rct_scenery_entry *)-1) { + if (sceneryEntry != nullptr && sceneryEntry != (rct_scenery_entry *)-1) { sint32 sceneryId = get_scenery_id_from_entry_index(OBJECT_TYPE_BANNERS, banner->type); if (sceneryId != -1 && window_scenery_set_selected_item(sceneryId)) { gWindowSceneryEyedropperEnabled = false; @@ -1100,7 +1100,7 @@ static void scenery_eyedropper_tool_down(sint16 x, sint16 y, rct_widgetindex wid { sint32 entryIndex = footpath_element_get_path_scenery_index(mapElement); rct_scenery_entry * sceneryEntry = get_footpath_item_entry(entryIndex); - if (sceneryEntry != NULL && sceneryEntry != (rct_scenery_entry *)-1) { + if (sceneryEntry != nullptr && sceneryEntry != (rct_scenery_entry *)-1) { sint32 sceneryId = get_scenery_id_from_entry_index(OBJECT_TYPE_PATH_BITS, entryIndex); if (sceneryId != -1 && window_scenery_set_selected_item(sceneryId)) { gWindowSceneryEyedropperEnabled = false; @@ -1124,7 +1124,7 @@ static void scenery_eyedropper_tool_down(sint16 x, sint16 y, rct_widgetindex wid static void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid_x, sint16* grid_y, uint32* parameter_1, uint32* parameter_2, uint32* parameter_3){ rct_window* w = window_find_by_class(WC_SCENERY); - if (w == NULL) { + if (w == nullptr) { *grid_x = MAP_LOCATION_NULL; return; } @@ -1160,7 +1160,7 @@ static void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid VIEWPORT_INTERACTION_MASK_WALL & VIEWPORT_INTERACTION_MASK_LARGE_SCENERY; sint32 interaction_type; - get_map_coordinates_from_pos(x, y, flags, NULL, NULL, &interaction_type, &map_element, NULL); + get_map_coordinates_from_pos(x, y, flags, nullptr, nullptr, &interaction_type, &map_element, nullptr); if (interaction_type != VIEWPORT_INTERACTION_ITEM_NONE) { gSceneryCtrlPressed = true; @@ -1220,7 +1220,7 @@ static void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid if (gSceneryShiftPressed) { rct_map_element* map_element = map_get_surface_element_at(*grid_x / 32, *grid_y / 32); - if (map_element == NULL) { + if (map_element == nullptr) { *grid_x = MAP_LOCATION_NULL; return; } @@ -1275,7 +1275,7 @@ static void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid sint32 interaction_type = 0; rct_map_element* map_element; - get_map_coordinates_from_pos(x, y, flags, grid_x, grid_y, &interaction_type, &map_element, NULL); + get_map_coordinates_from_pos(x, y, flags, grid_x, grid_y, &interaction_type, &map_element, nullptr); if (interaction_type == VIEWPORT_INTERACTION_ITEM_NONE) { *grid_x = MAP_LOCATION_NULL; @@ -1292,7 +1292,7 @@ static void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid if (gSceneryShiftPressed) { map_element = map_get_surface_element_at(*grid_x / 32, *grid_y / 32); - if (map_element == NULL) { + if (map_element == nullptr) { *grid_x = MAP_LOCATION_NULL; return; } @@ -1348,7 +1348,7 @@ static void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid sint32 interaction_type = 0; rct_map_element* map_element; - get_map_coordinates_from_pos(x, y, flags, grid_x, grid_y, &interaction_type, &map_element, NULL); + get_map_coordinates_from_pos(x, y, flags, grid_x, grid_y, &interaction_type, &map_element, nullptr); if (interaction_type == VIEWPORT_INTERACTION_ITEM_NONE) { *grid_x = MAP_LOCATION_NULL; @@ -1380,7 +1380,7 @@ static void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid if (gSceneryShiftPressed) { rct_map_element* map_element = map_get_surface_element_at(*grid_x / 32, *grid_y / 32); - if (map_element == NULL) { + if (map_element == nullptr) { *grid_x = MAP_LOCATION_NULL; return; } @@ -1422,7 +1422,7 @@ static void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid // Large scenery // If CTRL not pressed if (!gSceneryCtrlPressed) { - sub_68A15E(x, y, grid_x, grid_y, NULL, NULL); + sub_68A15E(x, y, grid_x, grid_y, nullptr, nullptr); if (*grid_x == MAP_LOCATION_NULL) return; @@ -1433,7 +1433,7 @@ static void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid if (gSceneryShiftPressed) { rct_map_element* map_element = map_get_surface_element_at(*grid_x / 32, *grid_y / 32); - if (map_element == NULL) { + if (map_element == nullptr) { *grid_x = MAP_LOCATION_NULL; return; } @@ -1484,7 +1484,7 @@ static void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid sint32 interaction_type = 0; rct_map_element* map_element; - get_map_coordinates_from_pos(x, y, flags, grid_x, grid_y, &interaction_type, &map_element, NULL); + get_map_coordinates_from_pos(x, y, flags, grid_x, grid_y, &interaction_type, &map_element, nullptr); if (interaction_type == VIEWPORT_INTERACTION_ITEM_NONE) { *grid_x = MAP_LOCATION_NULL; @@ -1745,7 +1745,7 @@ static void top_toolbar_tool_update_scenery_clear(sint16 x, sint16 y){ gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; rct_xy16 mapTile = { 0 }; - screen_get_map_xy(x, y, &mapTile.x, &mapTile.y, NULL); + screen_get_map_xy(x, y, &mapTile.x, &mapTile.y, nullptr); if (mapTile.x == MAP_LOCATION_NULL) { if (gClearSceneryCost != MONEY32_UNDEFINED) { @@ -1822,7 +1822,7 @@ static void top_toolbar_tool_update_land_paint(sint16 x, sint16 y){ gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; rct_xy16 mapTile = { 0 }; - screen_get_map_xy(x, y, &mapTile.x, &mapTile.y, NULL); + screen_get_map_xy(x, y, &mapTile.x, &mapTile.y, nullptr); if (mapTile.x == MAP_LOCATION_NULL) { if (gClearSceneryCost != MONEY32_UNDEFINED) { @@ -1974,7 +1974,7 @@ static void top_toolbar_tool_update_land(sint16 x, sint16 y){ return; } - screen_get_map_xy(x, y, &mapTile.x, &mapTile.y, NULL); + screen_get_map_xy(x, y, &mapTile.x, &mapTile.y, nullptr); if (mapTile.x == MAP_LOCATION_NULL) { money32 lower_cost = MONEY32_UNDEFINED; @@ -2095,8 +2095,8 @@ static void top_toolbar_tool_update_water(sint16 x, sint16 y){ &mapTile.x, &mapTile.y, &interaction_type, - NULL, - NULL); + nullptr, + nullptr); if (interaction_type == VIEWPORT_INTERACTION_ITEM_NONE){ if (gWaterToolRaiseCost != MONEY32_UNDEFINED || gWaterToolLowerCost != MONEY32_UNDEFINED) { @@ -2844,7 +2844,7 @@ static void window_top_toolbar_tool_drag(rct_window* w, rct_widgetindex widgetIn { switch (widgetIndex){ case WIDX_CLEAR_SCENERY: - if (window_find_by_class(WC_ERROR) != NULL) + if (window_find_by_class(WC_ERROR) != nullptr) break; if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) @@ -3057,7 +3057,7 @@ void top_toolbar_init_debug_menu(rct_window* w, rct_widget* widget) dropdown_set_disabled(DDIDX_INVENTIONS_LIST, true); } - dropdown_set_checked(DDIDX_DEBUG_PAINT, window_find_by_class(WC_DEBUG_PAINT) != NULL); + dropdown_set_checked(DDIDX_DEBUG_PAINT, window_find_by_class(WC_DEBUG_PAINT) != nullptr); gDropdownDefaultIndex = DDIDX_CONSOLE; } @@ -3099,7 +3099,7 @@ void top_toolbar_debug_menu_dropdown(sint16 dropdownIndex) context_open_window(WC_EDITOR_SCENARIO_OPTIONS); break; case DDIDX_DEBUG_PAINT: - if (window_find_by_class(WC_DEBUG_PAINT) == NULL) { + if (window_find_by_class(WC_DEBUG_PAINT) == nullptr) { context_open_window(WC_DEBUG_PAINT); } else { window_close_by_class(WC_DEBUG_PAINT); @@ -3257,7 +3257,7 @@ void top_toolbar_view_menu_dropdown(sint16 dropdownIndex) */ void toggle_footpath_window() { - if (window_find_by_class(WC_FOOTPATH) == NULL) { + if (window_find_by_class(WC_FOOTPATH) == nullptr) { context_open_window(WC_FOOTPATH); } else { tool_cancel(); diff --git a/src/openrct2/windows/TrackList.cpp b/src/openrct2/windows/TrackList.cpp index 6e5dbf59ee..0b2843af3d 100644 --- a/src/openrct2/windows/TrackList.cpp +++ b/src/openrct2/windows/TrackList.cpp @@ -71,29 +71,29 @@ static void window_track_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, static rct_window_event_list window_track_list_events = { window_track_list_close, window_track_list_mouseup, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_track_list_update, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_track_list_scrollgetsize, window_track_list_scrollmousedown, - NULL, + nullptr, window_track_list_scrollmouseover, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, window_track_list_tooltip, - NULL, - NULL, + nullptr, + nullptr, window_track_list_invalidate, window_track_list_paint, window_track_list_scrollpaint @@ -103,7 +103,7 @@ static rct_window_event_list window_track_list_events = { ride_list_item _window_track_list_item; -static track_design_file_ref *_trackDesigns = NULL; +static track_design_file_ref *_trackDesigns = nullptr; static size_t _trackDesignsCount = 0; static uint16 _loadedTrackDesignIndex; static rct_track_td6 *_loadedTrackDesign; @@ -157,7 +157,7 @@ static void _window_track_list_open(ride_list_item item) _trackDesignPreviewPixels = Memory::AllocateArray(4 * TRACK_PREVIEW_IMAGE_SIZE); - _loadedTrackDesign = NULL; + _loadedTrackDesign = nullptr; _loadedTrackDesignIndex = TRACK_DESIGN_INDEX_UNLOADED; } @@ -169,7 +169,7 @@ static void window_track_list_close(rct_window *w) { // Dispose track design and preview track_design_dispose(_loadedTrackDesign); - _loadedTrackDesign = NULL; + _loadedTrackDesign = nullptr; SafeFree(_trackDesignPreviewPixels); // Dispose track list @@ -201,7 +201,7 @@ static void window_track_list_select(rct_window *w, sint32 index) w->track_list.var_480 = index; // Displays a message if the ride can't load, fix #4080 - if (_loadedTrackDesign == NULL) { + if (_loadedTrackDesign == nullptr) { window_error_open(STR_CANT_BUILD_PARK_ENTRANCE_HERE, STR_TRACK_LOAD_FAILED_ERROR); return; } @@ -217,7 +217,7 @@ static void window_track_list_select(rct_window *w, sint32 index) } rct_track_td6 *td6 = _loadedTrackDesign; - if (td6 != NULL && (td6->track_flags & TRACK_DESIGN_FLAG_SCENERY_UNAVAILABLE)) { + if (td6 != nullptr && (td6->track_flags & TRACK_DESIGN_FLAG_SCENERY_UNAVAILABLE)) { gTrackDesignSceneryToggle = true; } @@ -348,7 +348,7 @@ static void window_track_list_invalidate(rct_window *w) rct_string_id stringId = STR_NONE; rct_ride_entry *entry = get_ride_entry(_window_track_list_item.entry_index); - if (entry != NULL && entry != (rct_ride_entry*)-1) { + if (entry != nullptr && entry != (rct_ride_entry*)-1) { rct_ride_name rideName = get_ride_naming(_window_track_list_item.type, entry); stringId = rideName.name; } @@ -416,7 +416,7 @@ static void window_track_list_paint(rct_window *w, rct_drawpixelinfo *dpi) } rct_track_td6 *td6 = _loadedTrackDesign; - if (td6 == NULL) { + if (td6 == nullptr) { return; } @@ -437,14 +437,14 @@ static void window_track_list_paint(rct_window *w, rct_drawpixelinfo *dpi) // Warnings if ((td6->track_flags & TRACK_DESIGN_FLAG_VEHICLE_UNAVAILABLE) && !(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) { // Vehicle design not available - gfx_draw_string_centred_clipped(dpi, STR_VEHICLE_DESIGN_UNAVAILABLE, NULL, COLOUR_BLACK, x, y, 368); + gfx_draw_string_centred_clipped(dpi, STR_VEHICLE_DESIGN_UNAVAILABLE, nullptr, COLOUR_BLACK, x, y, 368); y -= 10; } if (td6->track_flags & TRACK_DESIGN_FLAG_SCENERY_UNAVAILABLE) { if (!gTrackDesignSceneryToggle) { // Scenery not available - gfx_draw_string_centred_clipped(dpi, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, NULL, COLOUR_BLACK, x, y, 368); + gfx_draw_string_centred_clipped(dpi, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, nullptr, COLOUR_BLACK, x, y, 368); y -= 10; } } @@ -572,7 +572,7 @@ static void window_track_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) { if (_trackDesignsCount == 0) { // No track designs - gfx_draw_string_left(dpi, STR_NO_TRACK_DESIGNS_OF_THIS_TYPE, NULL, COLOUR_BLACK, x, y - 1); + gfx_draw_string_left(dpi, STR_NO_TRACK_DESIGNS_OF_THIS_TYPE, nullptr, COLOUR_BLACK, x, y - 1); return; } } else { @@ -616,7 +616,7 @@ static void track_list_load_designs(ride_list_item item) { if (!ride_type_has_ride_groups(item.type)) { char entry[9]; - const char *entryPtr = NULL; + const char *entryPtr = nullptr; if (item.type < 0x80) { rct_ride_entry *rideEntry = get_ride_entry(item.entry_index); if ((rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) && !rideTypeShouldLoseSeparateFlag(rideEntry)) { @@ -636,10 +636,10 @@ static bool track_list_load_design_for_preview(utf8 *path) { // Dispose currently loaded track track_design_dispose(_loadedTrackDesign); - _loadedTrackDesign = NULL; + _loadedTrackDesign = nullptr; _loadedTrackDesign = track_design_open(path); - if (_loadedTrackDesign != NULL && drawing_engine_get_type() != DRAWING_ENGINE_OPENGL) { + if (_loadedTrackDesign != nullptr && drawing_engine_get_type() != DRAWING_ENGINE_OPENGL) { track_design_draw_preview(_loadedTrackDesign, _trackDesignPreviewPixels); return true; } diff --git a/src/openrct2/windows/TrackManage.cpp b/src/openrct2/windows/TrackManage.cpp index 7624172d90..05a4d01cad 100644 --- a/src/openrct2/windows/TrackManage.cpp +++ b/src/openrct2/windows/TrackManage.cpp @@ -73,64 +73,64 @@ static void window_track_delete_prompt_paint(rct_window *w, rct_drawpixelinfo *d static rct_window_event_list window_track_manage_events = { window_track_manage_close, window_track_manage_mouseup, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_track_manage_textinput, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_track_manage_paint, - NULL + nullptr }; // 0x0099415C static rct_window_event_list window_track_delete_prompt_events = { - NULL, + nullptr, window_track_delete_prompt_mouseup, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_track_delete_prompt_paint, - NULL + nullptr }; #pragma endregion @@ -163,7 +163,7 @@ static void _window_track_manage_open(track_design_file_ref *tdFileRef) window_init_scroll_widgets(w); rct_window *trackDesignListWindow = window_find_by_class(WC_TRACK_DESIGN_LIST); - if (trackDesignListWindow != NULL) { + if (trackDesignListWindow != nullptr) { trackDesignListWindow->track_list.var_484 |= 1; } @@ -177,7 +177,7 @@ static void _window_track_manage_open(track_design_file_ref *tdFileRef) static void window_track_manage_close(rct_window *w) { rct_window *trackDesignListWindow = window_find_by_class(WC_TRACK_DESIGN_LIST); - if (trackDesignListWindow != NULL) { + if (trackDesignListWindow != nullptr) { trackDesignListWindow->track_list.var_484 &= ~1; } } @@ -320,7 +320,7 @@ static void window_track_delete_prompt_paint(rct_window *w, rct_drawpixelinfo *d static void window_track_design_list_reload_tracks() { rct_window * trackListWindow = window_find_by_class(WC_TRACK_DESIGN_LIST); - if (trackListWindow != NULL) { + if (trackListWindow != nullptr) { trackListWindow->track_list.reload_track_designs = true; } } diff --git a/src/openrct2/windows/TrackPlace.cpp b/src/openrct2/windows/TrackPlace.cpp index 29c0234ff2..6f3be210e7 100644 --- a/src/openrct2/windows/TrackPlace.cpp +++ b/src/openrct2/windows/TrackPlace.cpp @@ -76,32 +76,32 @@ static void window_track_place_paint(rct_window *w, rct_drawpixelinfo *dpi); static rct_window_event_list window_track_place_events = { window_track_place_close, window_track_place_mouseup, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_track_place_update, - NULL, - NULL, + nullptr, + nullptr, window_track_place_toolupdate, window_track_place_tooldown, - NULL, - NULL, + nullptr, + nullptr, window_track_place_toolabort, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, window_track_place_unknown14, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, window_track_place_invalidate, window_track_place_paint, - NULL + nullptr }; static uint8 *_window_track_place_mini_preview; @@ -147,7 +147,7 @@ static void window_track_place_clear_mini_preview() static void _window_track_place_open(const track_design_file_ref *tdFileRef) { rct_track_td6 *td6 = track_design_open(tdFileRef->path); - if (td6 == NULL) { + if (td6 == nullptr) { return; } @@ -198,7 +198,7 @@ static void window_track_place_close(rct_window *w) hide_gridlines(); SafeFree(_window_track_place_mini_preview); track_design_dispose(_trackDesign); - _trackDesign = NULL; + _trackDesign = nullptr; } /** @@ -257,7 +257,7 @@ static void window_track_place_toolupdate(rct_window* w, rct_widgetindex widgetI gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; // Get the tool map position - sub_68A15E(x, y, &mapX, &mapY, NULL, NULL); + sub_68A15E(x, y, &mapX, &mapY, nullptr, nullptr); if (mapX == MAP_LOCATION_NULL) { window_track_place_clear_provisional(); return; @@ -319,7 +319,7 @@ static void window_track_place_tooldown(rct_window* w, rct_widgetindex widgetInd gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - sub_68A15E(x, y, &mapX, &mapY, NULL, NULL); + sub_68A15E(x, y, &mapX, &mapY, nullptr, nullptr); if (mapX == MAP_LOCATION_NULL) return; @@ -441,10 +441,10 @@ static void window_track_place_attempt_placement(rct_track_td6 *td6, sint32 x, s gActiveTrackDesign = _trackDesign; result = game_do_command_p(GAME_COMMAND_PLACE_TRACK_DESIGN, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp); - gActiveTrackDesign = NULL; + gActiveTrackDesign = nullptr; - if (cost != NULL) *cost = result; - if (rideIndex != NULL) *rideIndex = edi & 0xFF; + if (cost != nullptr) *cost = result; + if (rideIndex != nullptr) *rideIndex = edi & 0xFF; } /** diff --git a/src/openrct2/world/Entrance.cpp b/src/openrct2/world/Entrance.cpp index 36c34acd00..e6250e73c4 100644 --- a/src/openrct2/world/Entrance.cpp +++ b/src/openrct2/world/Entrance.cpp @@ -112,7 +112,7 @@ static money32 ParkEntrancePlace(sint32 flags, sint16 x, sint16 y, uint8 z, uint // Check that entrance element does not already exist at this location rct_map_element* entranceElement = map_get_park_entrance_element_at(x, y, zLow, false); - if (entranceElement != NULL) + if (entranceElement != nullptr) { return MONEY32_UNDEFINED; } @@ -129,7 +129,7 @@ static money32 ParkEntrancePlace(sint32 flags, sint16 x, sint16 y, uint8 z, uint } rct_map_element* newElement = map_element_insert(x / 32, y / 32, zLow, 0xF); - assert(newElement != NULL); + assert(newElement != nullptr); newElement->clearance_height = zHigh; if (flags & GAME_COMMAND_FLAG_GHOST) @@ -165,7 +165,7 @@ static void ParkEntranceRemoveSegment(sint32 x, sint32 y, sint32 z) rct_map_element *mapElement; mapElement = map_get_park_entrance_element_at(x, y, z, true); - if (mapElement == NULL) + if (mapElement == nullptr) { return; } @@ -407,7 +407,7 @@ static money32 RideEntranceExitPlace(sint16 x, network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord); rct_map_element* mapElement = map_element_insert(x / 32, y / 32, z / 8, 0xF); - assert(mapElement != NULL); + assert(mapElement != nullptr); mapElement->clearance_height = clear_z; mapElement->properties.entrance.type = isExit; mapElement->properties.entrance.index = stationNum << 4; @@ -498,7 +498,7 @@ static money32 RideEntranceExitRemove(sint16 x, sint16 y, uint8 rideIndex, uint8 bool found = false; rct_map_element* mapElement = map_get_first_element_at(x / 32, y / 32); - if (mapElement == NULL) + if (mapElement == nullptr) { log_warning("Invalid coordinates for entrance/exit removal x = %d, y = %d", x, y); return MONEY32_UNDEFINED; diff --git a/src/openrct2/world/SmallScenery.cpp b/src/openrct2/world/SmallScenery.cpp index f27e6b60e1..c6cf8ae213 100644 --- a/src/openrct2/world/SmallScenery.cpp +++ b/src/openrct2/world/SmallScenery.cpp @@ -137,7 +137,7 @@ static money32 SmallScenerySetColour(sint16 x, sint16 y, uint8 baseHeight, uint8 rct_map_element *mapElement = map_get_small_scenery_element_at(x, y, baseHeight, sceneryType, quadrant); - if (mapElement == NULL) + if (mapElement == nullptr) { return 0; } @@ -211,7 +211,7 @@ static money32 SmallSceneryPlace(sint16 x, } rct_scenery_entry* sceneryEntry = get_small_scenery_entry(sceneryType); - if (sceneryEntry == NULL) + if (sceneryEntry == nullptr) { return MONEY32_UNDEFINED; } @@ -274,7 +274,7 @@ static money32 SmallSceneryPlace(sint16 x, rct_map_element* surfaceElement = map_get_surface_element_at(x / 32, y / 32); - if (surfaceElement != NULL && !gCheatsDisableClearanceChecks && map_get_water_height(surfaceElement) > 0) + if (surfaceElement != nullptr && !gCheatsDisableClearanceChecks && map_get_water_height(surfaceElement) > 0) { sint32 water_height = (map_get_water_height(surfaceElement) * 16) - 1; if (water_height > targetHeight) @@ -292,7 +292,7 @@ static money32 SmallSceneryPlace(sint16 x, return MONEY32_UNDEFINED; } - if (surfaceElement != NULL && map_get_water_height(surfaceElement) > 0) + if (surfaceElement != nullptr && map_get_water_height(surfaceElement) > 0) { if ((map_get_water_height(surfaceElement) * 16) > targetHeight) { @@ -306,7 +306,7 @@ static money32 SmallSceneryPlace(sint16 x, (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_REQUIRE_FLAT_SURFACE) && !supportsRequired && !isOnWater && - surfaceElement != NULL && + surfaceElement != nullptr && (surfaceElement->properties.surface.slope & 0x1F)) { @@ -321,7 +321,7 @@ static money32 SmallSceneryPlace(sint16 x, if (!isOnWater) { - if (surfaceElement != NULL) + if (surfaceElement != nullptr) { if (map_get_water_height(surfaceElement) || (surfaceElement->base_height * 8) != targetHeight) @@ -409,7 +409,7 @@ static money32 SmallSceneryPlace(sint16 x, } rct_map_element* newElement = map_element_insert(x / 32, y / 32, zLow, collisionQuadrants); - assert(newElement != NULL); + assert(newElement != nullptr); gSceneryMapElement = newElement; uint8 type = quadrant << 6; type |= MAP_ELEMENT_TYPE_SCENERY;