1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-26 16:24:35 +01:00

implement mouse wheel for land tool size, closes #2260

This commit is contained in:
IntelOrca
2016-02-24 21:49:56 +00:00
parent 2e81dfa29e
commit a489fac185

View File

@@ -272,6 +272,39 @@ static void window_viewport_wheel_input(rct_window *w, int wheel)
window_zoom_out(w);
}
static bool window_other_wheel_input(rct_window *w, int widgetIndex, int wheel)
{
// HACK: Until we have a new window system that allows us to add new events like mouse wheel easily,
// this selective approch will have to do.
// Allow mouse wheel scrolling to increment or decrement the land tool size for various windows
int previewWidgetIndex;
switch (w->classification) {
case WC_WATER:
case WC_CLEAR_SCENERY:
case WC_LAND_RIGHTS:
previewWidgetIndex = 3;
break;
case WC_LAND:
previewWidgetIndex = 5;
break;
case WC_MAP:
previewWidgetIndex = 13;
break;
default:
return false;
}
// Preview / Increment / Decrement
if (widgetIndex >= previewWidgetIndex && widgetIndex < previewWidgetIndex + 3) {
int buttonWidgetIndex = wheel < 0 ? previewWidgetIndex + 2 : previewWidgetIndex + 1;
window_event_mouse_up_call(w, buttonWidgetIndex);
return true;
}
return false;
}
/**
*
* rct2: 0x006E7868
@@ -325,6 +358,10 @@ static void window_all_wheel_input()
window_scroll_wheel_input(w, window_get_scroll_index(w, widgetIndex), wheel);
return;
}
} else {
if (window_other_wheel_input(w, widgetIndex, wheel)) {
return;
}
}
// Check other scroll views on window