src/window.cpp
changeset 7855 e82c1fca64ee
parent 7759 eb8f1b5b2883
child 7918 970e7c5005e5
equal deleted inserted replaced
7854:8232d650df92 7855:e82c1fca64ee
  1464 
  1464 
  1465 	if (!_scrolling_viewport) return true;
  1465 	if (!_scrolling_viewport) return true;
  1466 
  1466 
  1467 	w = FindWindowFromPt(_cursor.pos.x, _cursor.pos.y);
  1467 	w = FindWindowFromPt(_cursor.pos.x, _cursor.pos.y);
  1468 
  1468 
       
  1469 	if (!(_right_button_down || scrollwheel_scrolling) || w == NULL) {
       
  1470 		_cursor.fix_at = false;
       
  1471 		_scrolling_viewport = false;
       
  1472 		return true;
       
  1473 	}
       
  1474 
  1469 	if (WP(w, vp_d).follow_vehicle != INVALID_VEHICLE && w == FindWindowById(WC_MAIN_WINDOW, 0)) {
  1475 	if (WP(w, vp_d).follow_vehicle != INVALID_VEHICLE && w == FindWindowById(WC_MAIN_WINDOW, 0)) {
  1470 		/* If the main window is following a vehicle, then first let go of it! */
  1476 		/* If the main window is following a vehicle, then first let go of it! */
  1471 		const Vehicle *veh = GetVehicle(WP(w, vp_d).follow_vehicle);
  1477 		const Vehicle *veh = GetVehicle(WP(w, vp_d).follow_vehicle);
  1472 		ScrollMainWindowTo(veh->x_pos, veh->y_pos, true); /* This also resets follow_vehicle */
  1478 		ScrollMainWindowTo(veh->x_pos, veh->y_pos, true); /* This also resets follow_vehicle */
  1473 		return true;
       
  1474 	}
       
  1475 
       
  1476 	if (!(_right_button_down || scrollwheel_scrolling) || w == NULL) {
       
  1477 		_cursor.fix_at = false;
       
  1478 		_scrolling_viewport = false;
       
  1479 		return true;
  1479 		return true;
  1480 	}
  1480 	}
  1481 
  1481 
  1482 	if (_patches.reverse_scroll) {
  1482 	if (_patches.reverse_scroll) {
  1483 		e.we.scroll.delta.x = -_cursor.delta.x;
  1483 		e.we.scroll.delta.x = -_cursor.delta.x;