src/window.cpp
changeset 7759 eb8f1b5b2883
parent 7721 8aaea36c01df
child 7855 e82c1fca64ee
equal deleted inserted replaced
7758:17ad53748c7b 7759:eb8f1b5b2883
  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 (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! */
       
  1471 		const Vehicle *veh = GetVehicle(WP(w, vp_d).follow_vehicle);
       
  1472 		ScrollMainWindowTo(veh->x_pos, veh->y_pos, true); /* This also resets follow_vehicle */
       
  1473 		return true;
       
  1474 	}
       
  1475 
  1469 	if (!(_right_button_down || scrollwheel_scrolling) || w == NULL) {
  1476 	if (!(_right_button_down || scrollwheel_scrolling) || w == NULL) {
  1470 		_cursor.fix_at = false;
  1477 		_cursor.fix_at = false;
  1471 		_scrolling_viewport = false;
  1478 		_scrolling_viewport = false;
  1472 		return true;
  1479 		return true;
  1473 	}
  1480 	}