diff --git a/src/openrct2/Imaging.cpp b/src/openrct2/Imaging.cpp index d8302914f1..7bc9220663 100644 --- a/src/openrct2/Imaging.cpp +++ b/src/openrct2/Imaging.cpp @@ -36,7 +36,6 @@ namespace Imaging { png_structp png_ptr; png_infop info_ptr; - unsigned int sig_read = 0; // Setup PNG structures png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); @@ -55,6 +54,7 @@ namespace Imaging // Open PNG file try { + unsigned int sig_read = 0; auto fs = FileStream(path, FILE_MODE_OPEN); // Set error handling diff --git a/src/openrct2/ParkImporter.cpp b/src/openrct2/ParkImporter.cpp index 72d5bbd41a..dea4b859cb 100644 --- a/src/openrct2/ParkImporter.cpp +++ b/src/openrct2/ParkImporter.cpp @@ -64,7 +64,6 @@ extern "C" IStream * stream = (IStream *)stream_c; std::string hintPath = String::ToStd(hintPath_c); - std::string extension = Path::GetExtension(hintPath); bool isScenario = ParkImporter::ExtensionIsScenario(hintPath); auto parkImporter = std::unique_ptr(ParkImporter::Create(hintPath)); diff --git a/src/openrct2/drawing/rect.c b/src/openrct2/drawing/rect.c index c6d2d583ad..0d1c2efd62 100644 --- a/src/openrct2/drawing/rect.c +++ b/src/openrct2/drawing/rect.c @@ -33,8 +33,6 @@ */ void gfx_fill_rect_inset(rct_drawpixelinfo* dpi, sint16 left, sint16 top, sint16 right, sint16 bottom, sint32 colour, uint8 flags) { - uint8 shadow, fill, hilight; - if (colour & (COLOUR_FLAG_TRANSLUCENT | COLOUR_FLAG_8)) { translucent_window_palette palette; if (colour & COLOUR_FLAG_8) { @@ -70,6 +68,7 @@ void gfx_fill_rect_inset(rct_drawpixelinfo* dpi, sint16 left, sint16 top, sint16 } } } else { + uint8 shadow, fill, hilight; if (flags & INSET_RECT_FLAG_FILL_MID_LIGHT) { shadow = ColourMapA[colour].dark; fill = ColourMapA[colour].mid_light; diff --git a/src/openrct2/input.c b/src/openrct2/input.c index 1897749437..c521ad4181 100644 --- a/src/openrct2/input.c +++ b/src/openrct2/input.c @@ -442,7 +442,7 @@ static void input_window_position_continue(rct_window *w, sint32 wdx, sint32 wdy { sint32 snapProximity; - snapProximity = w->flags & WF_NO_SNAPPING ? 0 : gConfigGeneral.window_snap_proximity; + snapProximity = (w->flags & WF_NO_SNAPPING) ? 0 : gConfigGeneral.window_snap_proximity; window_move_and_snap(w, x - wdx, y - wdy, snapProximity); } @@ -468,9 +468,8 @@ static void input_window_resize_begin(rct_window *w, sint32 widgetIndex, sint32 static void input_window_resize_continue(rct_window *w, sint32 x, sint32 y) { - sint32 dx, dy, targetWidth, targetHeight; - if (y < (sint32)gScreenHeight - 2) { + sint32 dx, dy, targetWidth, targetHeight; dx = x - gInputDragLastX; dy = y - gInputDragLastY; targetWidth = _originalWindowWidth + dx; @@ -708,9 +707,9 @@ static void input_scroll_end() static void input_scroll_part_update_hthumb(rct_window *w, sint32 widgetIndex, sint32 x, sint32 scroll_id) { rct_widget *widget = &w->widgets[widgetIndex]; - sint32 newLeft; if (window_find_by_number(w->classification, w->number)) { + sint32 newLeft; newLeft = w->scrolls[scroll_id].h_right; newLeft *= x; x = widget->right - widget->left - 21; @@ -746,9 +745,9 @@ static void input_scroll_part_update_vthumb(rct_window *w, sint32 widgetIndex, s { assert(w != NULL); rct_widget *widget = &w->widgets[widgetIndex]; - sint32 newTop; if (window_find_by_number(w->classification, w->number)) { + sint32 newTop; newTop = w->scrolls[scroll_id].v_bottom; newTop *= y; y = widget->bottom - widget->top - 21; @@ -1040,18 +1039,17 @@ static void input_widget_left(sint32 x, sint32 y, rct_window *w, sint32 widgetIn void process_mouse_over(sint32 x, sint32 y) { rct_window* window; - rct_window* subWindow; - sint32 widgetId; sint32 cursorId; - sint32 ebx, edi; cursorId = CURSOR_ARROW; set_map_tooltip_format_arg(0, rct_string_id, STR_NONE); window = window_find_from_point(x, y); if (window != NULL) { - widgetId = window_find_widget_from_point(window, x, y); + sint32 ebx, edi; + rct_window* subWindow; + sint32 widgetId = window_find_widget_from_point(window, x, y); if (widgetId != -1) { switch (window->widgets[widgetId].type){ diff --git a/src/openrct2/windows/ride.c b/src/openrct2/windows/ride.c index ba0a509a1b..23cd90cd5b 100644 --- a/src/openrct2/windows/ride.c +++ b/src/openrct2/windows/ride.c @@ -2195,7 +2195,7 @@ static void window_ride_main_mousedown(sint32 widgetIndex, rct_window *w, rct_wi widget_invalidate(w, WIDX_RIDE_TYPE); break; case WIDX_RIDE_TYPE_APPLY: - if (_rideType >= 0 && _rideType <= 90) { + if (_rideType <= 90) { set_operating_setting(w->number, RIDE_SETTING_RIDE_TYPE, _rideType); } window_invalidate_all(); @@ -3747,6 +3747,7 @@ static void window_ride_maintenance_mousedown(sint32 widgetIndex, rct_window *w, gDropdownItemsFormat[0] = STR_DROPDOWN_MENU_LABEL; gDropdownItemsArgs[0] = STR_DEBUG_FIX_RIDE; for (sint32 i = 0; i < 8; i++) { + assert(j < countof(ride_type->ride_type)); if (RideAvailableBreakdowns[ride_type->ride_type[j]] & (uint8)(1 << i)) { if (i == BREAKDOWN_BRAKES_FAILURE && (ride->mode == RIDE_MODE_CONTINUOUS_CIRCUIT_BLOCK_SECTIONED || ride->mode == RIDE_MODE_POWERED_LAUNCH_BLOCK_SECTIONED)) { if (ride->num_vehicles != 1) @@ -3867,6 +3868,7 @@ static void window_ride_maintenance_dropdown(rct_window *w, sint32 widgetIndex, sint32 i; sint32 num_items = 1; for (i = 0; i < 8; i++) { + assert(j < countof(ride_type->ride_type)); if (RideAvailableBreakdowns[ride_type->ride_type[j]] & (uint8)(1 << i)) { if (i == BREAKDOWN_BRAKES_FAILURE && (ride->mode == RIDE_MODE_CONTINUOUS_CIRCUIT_BLOCK_SECTIONED || ride->mode == RIDE_MODE_POWERED_LAUNCH_BLOCK_SECTIONED)) { if (ride->num_vehicles != 1)