mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-30 02:05:13 +01:00
Convert integers acting as bools to bools (#6177)
Also fixes MSVC2015 according to AppVeyor
This commit is contained in:
committed by
Richard Jenkins
parent
88d2805fd0
commit
44c8c84b7c
@@ -870,51 +870,51 @@ static void widget_draw_image(rct_drawpixelinfo *dpi, rct_window *w, rct_widgeti
|
||||
}
|
||||
}
|
||||
|
||||
sint32 widget_is_enabled(rct_window *w, rct_widgetindex widgetIndex)
|
||||
bool widget_is_enabled(rct_window *w, rct_widgetindex widgetIndex)
|
||||
{
|
||||
return (w->enabled_widgets & (1LL << widgetIndex)) ? 1 : 0;
|
||||
return (w->enabled_widgets & (1LL << widgetIndex)) != 0;
|
||||
}
|
||||
|
||||
sint32 widget_is_disabled(rct_window *w, rct_widgetindex widgetIndex)
|
||||
bool widget_is_disabled(rct_window *w, rct_widgetindex widgetIndex)
|
||||
{
|
||||
return (w->disabled_widgets & (1LL << widgetIndex)) ? 1 : 0;
|
||||
return (w->disabled_widgets & (1LL << widgetIndex)) != 0;
|
||||
}
|
||||
|
||||
sint32 widget_is_pressed(rct_window *w, rct_widgetindex widgetIndex)
|
||||
bool widget_is_pressed(rct_window *w, rct_widgetindex widgetIndex)
|
||||
{
|
||||
if (w->pressed_widgets & (1LL << widgetIndex)) {
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
if (input_get_state() == INPUT_STATE_WIDGET_PRESSED || input_get_state() == INPUT_STATE_DROPDOWN_ACTIVE) {
|
||||
if (!(input_test_flag(INPUT_FLAG_WIDGET_PRESSED))) return 0;
|
||||
if (gPressedWidget.window_classification != w->classification) return 0;
|
||||
if (gPressedWidget.window_number != w->number) return 0;
|
||||
if (gPressedWidget.widget_index != widgetIndex) return 0;
|
||||
return 1;
|
||||
if (!(input_test_flag(INPUT_FLAG_WIDGET_PRESSED))) return false;
|
||||
if (gPressedWidget.window_classification != w->classification) return false;
|
||||
if (gPressedWidget.window_number != w->number) return false;
|
||||
if (gPressedWidget.widget_index != widgetIndex) return false;
|
||||
return true;
|
||||
}
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
sint32 widget_is_highlighted(rct_window *w, rct_widgetindex widgetIndex)
|
||||
bool widget_is_highlighted(rct_window *w, rct_widgetindex widgetIndex)
|
||||
{
|
||||
if (gHoverWidget.window_classification != w->classification) return 0;
|
||||
if (gHoverWidget.window_number != w->number) return 0;
|
||||
if (gHoverWidget.widget_index != widgetIndex) return 0;
|
||||
return 1;
|
||||
if (gHoverWidget.window_classification != w->classification) return false;
|
||||
if (gHoverWidget.window_number != w->number) return false;
|
||||
if (gHoverWidget.widget_index != widgetIndex) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
sint32 widget_is_active_tool(rct_window *w, rct_widgetindex widgetIndex)
|
||||
bool widget_is_active_tool(rct_window *w, rct_widgetindex widgetIndex)
|
||||
{
|
||||
if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE)))
|
||||
return 0;
|
||||
return false;
|
||||
if (gCurrentToolWidget.window_classification != w->classification)
|
||||
return 0;
|
||||
return false;
|
||||
if (gCurrentToolWidget.window_number != w->number)
|
||||
return 0;
|
||||
return false;
|
||||
if (gCurrentToolWidget.widget_index != widgetIndex)
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -62,11 +62,11 @@ enum {
|
||||
void widget_scroll_update_thumbs(rct_window *w, rct_widgetindex widget_index);
|
||||
void widget_draw(rct_drawpixelinfo *dpi, rct_window *w, rct_widgetindex widgetIndex);
|
||||
|
||||
sint32 widget_is_enabled(rct_window *w, rct_widgetindex widgetIndex);
|
||||
sint32 widget_is_disabled(rct_window *w, rct_widgetindex widgetIndex);
|
||||
sint32 widget_is_pressed(rct_window *w, rct_widgetindex widgetIndex);
|
||||
sint32 widget_is_highlighted(rct_window *w, rct_widgetindex widgetIndex);
|
||||
sint32 widget_is_active_tool(rct_window *w, rct_widgetindex widgetIndex);
|
||||
bool widget_is_enabled(rct_window *w, rct_widgetindex widgetIndex);
|
||||
bool widget_is_disabled(rct_window *w, rct_widgetindex widgetIndex);
|
||||
bool widget_is_pressed(rct_window *w, rct_widgetindex widgetIndex);
|
||||
bool widget_is_highlighted(rct_window *w, rct_widgetindex widgetIndex);
|
||||
bool widget_is_active_tool(rct_window *w, rct_widgetindex widgetIndex);
|
||||
void widget_scroll_get_part(rct_window *w, rct_widget* widget, sint32 x, sint32 y, sint32 *output_x, sint32 *output_y, sint32 *output_scroll_area, sint32 *scroll_id);
|
||||
|
||||
void widget_set_enabled(rct_window *w, rct_widgetindex widgetIndex, bool enabled);
|
||||
|
||||
Reference in New Issue
Block a user