MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / HandleKeyScrolling

Function HandleKeyScrolling

src/window.cpp:2839–2856  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2837};
2838
2839static void HandleKeyScrolling()
2840{
2841 /*
2842 * Check that any of the dirkeys is pressed and that the focused window
2843 * doesn't have an edit-box as focused widget.
2844 */
2845 if (_dirkeys && !EditBoxInGlobalFocus()) {
2846 int factor = _shift_pressed ? 50 : 10;
2847
2848 if (_game_mode != GM_MENU && _game_mode != GM_BOOTSTRAP) {
2849 /* Key scrolling stops following a vehicle. */
2850 Window *main_window = GetMainWindow();
2851 main_window->viewport->CancelFollow(*main_window);
2852 }
2853
2854 ScrollMainViewport(scrollamt[_dirkeys][0] * factor, scrollamt[_dirkeys][1] * factor);
2855 }
2856}
2857
2858static void MouseLoop(MouseClick click, int mousewheel)
2859{

Callers 1

window.cppFile · 0.85

Calls 4

EditBoxInGlobalFocusFunction · 0.85
GetMainWindowFunction · 0.85
ScrollMainViewportFunction · 0.85
CancelFollowMethod · 0.80

Tested by

no test coverage detected