1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 19:13:07 +01:00

Convert integers acting as bools to bools (#6177)

Also fixes MSVC2015 according to AppVeyor
This commit is contained in:
Michał Janiszewski
2017-08-15 10:03:10 +02:00
committed by Richard Jenkins
parent 88d2805fd0
commit 44c8c84b7c
6 changed files with 37 additions and 37 deletions

View File

@@ -1336,7 +1336,7 @@ static void window_options_dropdown(rct_window *w, rct_widgetindex widgetIndex,
switch (widgetIndex) {
case WIDX_CONSTRUCTION_MARKER_DROPDOWN:
if (dropdownIndex != (gConfigGeneral.construction_marker_colour ? 1 : 0)) {
gConfigGeneral.construction_marker_colour = (uint8)dropdownIndex;
gConfigGeneral.construction_marker_colour = dropdownIndex != 0;
config_save_default();
gfx_invalidate_screen();
}

View File

@@ -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;
}
/**

View File

@@ -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);

View File

@@ -897,8 +897,8 @@ void window_editor_object_selection_mousedown(rct_window *w, rct_widgetindex wid
}
if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) {
dropdown_set_checked(DDIX_FILTER_SELECTED, _FILTER_SELECTED);
dropdown_set_checked(DDIX_FILTER_NONSELECTED, _FILTER_NONSELECTED);
dropdown_set_checked(DDIX_FILTER_SELECTED, _FILTER_SELECTED != 0);
dropdown_set_checked(DDIX_FILTER_NONSELECTED, _FILTER_NONSELECTED != 0);
}
break;

View File

@@ -515,7 +515,7 @@ static const rct_string_id RideConstructionSeatAngleRotationStrings[] = {
static bool is_track_enabled(sint32 trackFlagIndex)
{
return _enabledRidePieces & (1ULL << trackFlagIndex);
return (_enabledRidePieces & (1ULL << trackFlagIndex)) != 0;
}
static sint32 ride_get_alternative_type(rct_ride *ride)
@@ -2509,7 +2509,7 @@ static bool sub_6CA2DF_get_track_element(uint8 *trackElement) {
return false;
}
bool startsDiagonal = _currentTrackPieceDirection & (1 << 2);
bool startsDiagonal = (_currentTrackPieceDirection & (1 << 2)) != 0;
if (curve == TRACK_CURVE_LEFT_LARGE || curve == TRACK_CURVE_RIGHT_LARGE) {
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_BACK) {
startsDiagonal = !startsDiagonal;

View File

@@ -1531,10 +1531,10 @@ static void window_tile_inspector_invalidate(rct_window *w)
w->widgets[WIDX_SCENERY_CHECK_COLLISION_S].bottom = w->widgets[WIDX_SCENERY_CHECK_COLLISION_S].top + 13;
w->widgets[WIDX_SCENERY_CHECK_COLLISION_W].top = GBBT(propertiesAnchor, 2) + 5 + 7 * 1;
w->widgets[WIDX_SCENERY_CHECK_COLLISION_W].bottom = w->widgets[WIDX_SCENERY_CHECK_COLLISION_W].top + 13;
N = mapElement->flags & (1 << ((2 - get_current_rotation()) & 3));
E = mapElement->flags & (1 << ((3 - get_current_rotation()) & 3));
S = mapElement->flags & (1 << ((0 - get_current_rotation()) & 3));
W = mapElement->flags & (1 << ((1 - get_current_rotation()) & 3));
N = (mapElement->flags & (1 << ((2 - get_current_rotation()) & 3))) != 0;
E = (mapElement->flags & (1 << ((3 - get_current_rotation()) & 3))) != 0;
S = (mapElement->flags & (1 << ((0 - get_current_rotation()) & 3))) != 0;
W = (mapElement->flags & (1 << ((1 - get_current_rotation()) & 3))) != 0;
widget_set_checkbox_value(w, WIDX_SCENERY_CHECK_COLLISION_N, N);
widget_set_checkbox_value(w, WIDX_SCENERY_CHECK_COLLISION_E, E);
widget_set_checkbox_value(w, WIDX_SCENERY_CHECK_COLLISION_S, S);