--- a/src/vehicle_gui.cpp Fri Oct 19 22:46:55 2007 +0000
+++ b/src/vehicle_gui.cpp Sat Oct 20 00:09:39 2007 +0000
@@ -2086,9 +2086,16 @@
DoCommandP(v->tile, v->index, 0, NULL,
_vehicle_command_translation_table[VCT_CMD_START_STOP][v->type]);
break;
- case VVW_WIDGET_CENTER_MAIN_VIEH: /* center main view */
- ScrollMainWindowTo(v->x_pos, v->y_pos);
- break;
+ case VVW_WIDGET_CENTER_MAIN_VIEH: {/* center main view */
+ const Window *mainwindow = FindWindowById(WC_MAIN_WINDOW, 0);
+ /* code to allow the main window to 'follow' the vehicle if the ctrl key is pressed */
+ if (_ctrl_pressed && mainwindow->viewport->zoom == ZOOM_LVL_NORMAL) {
+ WP(mainwindow, vp_d).follow_vehicle = v->index;
+ } else {
+ ScrollMainWindowTo(v->x_pos, v->y_pos);
+ }
+ } break;
+
case VVW_WIDGET_GOTO_DEPOT: /* goto hangar */
DoCommandP(v->tile, v->index, _ctrl_pressed ? DEPOT_SERVICE : 0, NULL,
_vehicle_command_translation_table[VCT_CMD_GOTO_DEPOT][v->type]);