mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-21 14:02:59 +01:00
Use nullptr where possible
This commit is contained in:
committed by
GitHub
parent
56ab7e9c09
commit
b2bc974fe7
@@ -64,7 +64,7 @@ void keyboard_shortcut_handle_command(sint32 shortcutIndex)
|
||||
if (shortcutIndex >= 0 && static_cast<uint32>(shortcutIndex) < Util::CountOf(shortcut_table))
|
||||
{
|
||||
shortcut_action action = shortcut_table[shortcutIndex];
|
||||
if (action != NULL)
|
||||
if (action != nullptr)
|
||||
{
|
||||
action();
|
||||
}
|
||||
@@ -78,7 +78,7 @@ static void toggle_view_flag(sint32 viewportFlag)
|
||||
rct_window * window;
|
||||
|
||||
window = window_get_main();
|
||||
if (window != NULL)
|
||||
if (window != nullptr)
|
||||
{
|
||||
window->viewport->flags ^= viewportFlag;
|
||||
window_invalidate(window);
|
||||
@@ -104,7 +104,7 @@ static void shortcut_cancel_construction_mode()
|
||||
return;
|
||||
|
||||
rct_window * window = window_find_by_class(WC_ERROR);
|
||||
if (window != NULL)
|
||||
if (window != nullptr)
|
||||
window_close(window);
|
||||
else if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE))
|
||||
tool_cancel();
|
||||
@@ -115,7 +115,7 @@ static void shortcut_pause_game()
|
||||
if (!(gScreenFlags & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_MANAGER)))
|
||||
{
|
||||
rct_window * window = window_find_by_class(WC_TOP_TOOLBAR);
|
||||
if (window != NULL)
|
||||
if (window != nullptr)
|
||||
{
|
||||
window_invalidate(window);
|
||||
window_event_mouse_up_call(window, WC_TOP_TOOLBAR__WIDX_PAUSE);
|
||||
@@ -158,7 +158,7 @@ static void shortcut_rotate_construction_object()
|
||||
|
||||
// Rotate scenery
|
||||
rct_window * w = window_find_by_class(WC_SCENERY);
|
||||
if (w != NULL && !widget_is_disabled(w, WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON) &&
|
||||
if (w != nullptr && !widget_is_disabled(w, WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON) &&
|
||||
w->widgets[WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type != WWT_EMPTY)
|
||||
{
|
||||
window_event_mouse_up_call(w, WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON);
|
||||
@@ -167,7 +167,7 @@ static void shortcut_rotate_construction_object()
|
||||
|
||||
// Rotate construction track piece
|
||||
w = window_find_by_class(WC_RIDE_CONSTRUCTION);
|
||||
if (w != NULL && !widget_is_disabled(w, WC_RIDE_CONSTRUCTION__WIDX_ROTATE) &&
|
||||
if (w != nullptr && !widget_is_disabled(w, WC_RIDE_CONSTRUCTION__WIDX_ROTATE) &&
|
||||
w->widgets[WC_RIDE_CONSTRUCTION__WIDX_ROTATE].type != WWT_EMPTY)
|
||||
{
|
||||
// Check if building a maze...
|
||||
@@ -180,7 +180,7 @@ static void shortcut_rotate_construction_object()
|
||||
|
||||
// Rotate track design preview
|
||||
w = window_find_by_class(WC_TRACK_DESIGN_LIST);
|
||||
if (w != NULL && !widget_is_disabled(w, WC_TRACK_DESIGN_LIST__WIDX_ROTATE) &&
|
||||
if (w != nullptr && !widget_is_disabled(w, WC_TRACK_DESIGN_LIST__WIDX_ROTATE) &&
|
||||
w->widgets[WC_TRACK_DESIGN_LIST__WIDX_ROTATE].type != WWT_EMPTY)
|
||||
{
|
||||
window_event_mouse_up_call(w, WC_TRACK_DESIGN_LIST__WIDX_ROTATE);
|
||||
@@ -189,7 +189,7 @@ static void shortcut_rotate_construction_object()
|
||||
|
||||
// Rotate track design placement
|
||||
w = window_find_by_class(WC_TRACK_DESIGN_PLACE);
|
||||
if (w != NULL && !widget_is_disabled(w, WC_TRACK_DESIGN_PLACE__WIDX_ROTATE) &&
|
||||
if (w != nullptr && !widget_is_disabled(w, WC_TRACK_DESIGN_PLACE__WIDX_ROTATE) &&
|
||||
w->widgets[WC_TRACK_DESIGN_PLACE__WIDX_ROTATE].type != WWT_EMPTY)
|
||||
{
|
||||
window_event_mouse_up_call(w, WC_TRACK_DESIGN_PLACE__WIDX_ROTATE);
|
||||
@@ -198,7 +198,7 @@ static void shortcut_rotate_construction_object()
|
||||
|
||||
// Rotate park entrance
|
||||
w = window_find_by_class(WC_MAP);
|
||||
if (w != NULL && !widget_is_disabled(w, WC_MAP__WIDX_ROTATE_90) && w->widgets[WC_MAP__WIDX_ROTATE_90].type != WWT_EMPTY)
|
||||
if (w != nullptr && !widget_is_disabled(w, WC_MAP__WIDX_ROTATE_90) && w->widgets[WC_MAP__WIDX_ROTATE_90].type != WWT_EMPTY)
|
||||
{
|
||||
window_event_mouse_up_call(w, WC_MAP__WIDX_ROTATE_90);
|
||||
return;
|
||||
@@ -233,7 +233,7 @@ static void shortcut_remove_top_bottom_toolbar_toggle()
|
||||
{
|
||||
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
||||
{
|
||||
if (window_find_by_class(WC_TITLE_LOGO) != NULL)
|
||||
if (window_find_by_class(WC_TITLE_LOGO) != nullptr)
|
||||
{
|
||||
window_close(window_find_by_class(WC_TITLE_LOGO));
|
||||
window_close(window_find_by_class(WC_TITLE_OPTIONS));
|
||||
@@ -248,7 +248,7 @@ static void shortcut_remove_top_bottom_toolbar_toggle()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (window_find_by_class(WC_TOP_TOOLBAR) != NULL)
|
||||
if (window_find_by_class(WC_TOP_TOOLBAR) != nullptr)
|
||||
{
|
||||
window_close(window_find_by_class(WC_DROPDOWN));
|
||||
window_close(window_find_by_class(WC_TOP_TOOLBAR));
|
||||
@@ -353,7 +353,7 @@ static void shortcut_adjust_land()
|
||||
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)))
|
||||
{
|
||||
rct_window * window = window_find_by_class(WC_TOP_TOOLBAR);
|
||||
if (window != NULL)
|
||||
if (window != nullptr)
|
||||
{
|
||||
window_invalidate(window);
|
||||
window_event_mouse_up_call(window, WC_TOP_TOOLBAR__WIDX_LAND);
|
||||
@@ -372,7 +372,7 @@ static void shortcut_adjust_water()
|
||||
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)))
|
||||
{
|
||||
rct_window * window = window_find_by_class(WC_TOP_TOOLBAR);
|
||||
if (window != NULL)
|
||||
if (window != nullptr)
|
||||
{
|
||||
window_invalidate(window);
|
||||
window_event_mouse_up_call(window, WC_TOP_TOOLBAR__WIDX_WATER);
|
||||
@@ -391,7 +391,7 @@ static void shortcut_build_scenery()
|
||||
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)))
|
||||
{
|
||||
rct_window * window = window_find_by_class(WC_TOP_TOOLBAR);
|
||||
if (window != NULL)
|
||||
if (window != nullptr)
|
||||
{
|
||||
window_invalidate(window);
|
||||
window_event_mouse_up_call(window, WC_TOP_TOOLBAR__WIDX_SCENERY);
|
||||
@@ -410,7 +410,7 @@ static void shortcut_build_paths()
|
||||
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)))
|
||||
{
|
||||
rct_window * window = window_find_by_class(WC_TOP_TOOLBAR);
|
||||
if (window != NULL)
|
||||
if (window != nullptr)
|
||||
{
|
||||
window_invalidate(window);
|
||||
window_event_mouse_up_call(window, WC_TOP_TOOLBAR__WIDX_PATH);
|
||||
@@ -547,7 +547,7 @@ static void shortcut_open_cheat_window()
|
||||
|
||||
// Check if window is already open
|
||||
rct_window * window = window_find_by_class(WC_CHEATS);
|
||||
if (window != NULL)
|
||||
if (window != nullptr)
|
||||
{
|
||||
window_close(window);
|
||||
return;
|
||||
@@ -565,7 +565,7 @@ static void shortcut_clear_scenery()
|
||||
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)))
|
||||
{
|
||||
rct_window * window = window_find_by_class(WC_TOP_TOOLBAR);
|
||||
if (window != NULL)
|
||||
if (window != nullptr)
|
||||
{
|
||||
window_invalidate(window);
|
||||
window_event_mouse_up_call(window, WC_TOP_TOOLBAR__WIDX_CLEAR_SCENERY);
|
||||
@@ -631,7 +631,7 @@ static void shortcut_orginal_painting_toggle()
|
||||
static void shortcut_debug_paint_toggle()
|
||||
{
|
||||
rct_window * window = window_find_by_class(WC_DEBUG_PAINT);
|
||||
if (window != NULL)
|
||||
if (window != nullptr)
|
||||
{
|
||||
window_close(window);
|
||||
}
|
||||
@@ -788,10 +788,10 @@ namespace
|
||||
shortcut_increase_game_speed,
|
||||
shortcut_open_cheat_window,
|
||||
shortcut_remove_top_bottom_toolbar_toggle,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
shortcut_open_chat_window,
|
||||
shortcut_quick_save_game,
|
||||
shortcut_show_options,
|
||||
|
||||
Reference in New Issue
Block a user