diff options
author | peter1138 <peter1138@openttd.org> | 2011-11-24 12:38:48 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2011-11-24 12:38:48 +0000 |
commit | 81598273e9b6bb2ee20ebdd82f3d4646a02999ba (patch) | |
tree | 2d13cc93dc84f2d99cff6fc2bb02214d4453f033 /src/vehicle_gui.cpp | |
parent | 15d0a22aac6b90a2055e68d019cab4350376a8fd (diff) | |
download | openttd-81598273e9b6bb2ee20ebdd82f3d4646a02999ba.tar.xz |
(svn r23316) -Feature: Add ability to zoom in to 2x and 4x level.
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r-- | src/vehicle_gui.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index cbf6e1c08..519f39c19 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -39,6 +39,7 @@ #include "engine_func.h" #include "station_base.h" #include "tilehighlight_func.h" +#include "zoom_func.h" #include "table/strings.h" @@ -2014,7 +2015,7 @@ struct VehicleDetailsWindow : Window { case VLD_WIDGET_MIDDLE_DETAILS: { /* For other vehicles, at the place of the matrix. */ bool rtl = _current_text_dir == TD_RTL; - uint sprite_width = max<uint>(GetSprite(v->GetImage(rtl ? DIR_E : DIR_W, EIT_IN_DETAILS), ST_NORMAL)->width, 70U) + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; + uint sprite_width = max<uint>(UnScaleByZoom(GetSprite(v->GetImage(rtl ? DIR_E : DIR_W, EIT_IN_DETAILS), ST_NORMAL)->width, ZOOM_LVL_GUI), 70U) + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; uint text_left = r.left + (rtl ? 0 : sprite_width); uint text_right = r.right - (rtl ? sprite_width : 0); @@ -2551,7 +2552,7 @@ public: 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) { + if (_ctrl_pressed && mainwindow->viewport->zoom <= ZOOM_LVL_OUT_4X) { mainwindow->viewport->follow_vehicle = v->index; } else { ScrollMainWindowTo(v->x_pos, v->y_pos, v->z_pos); @@ -2725,7 +2726,7 @@ int GetVehicleWidth(Vehicle *v, EngineImageType image_type) bool rtl = _current_text_dir == TD_RTL; SpriteID sprite = v->GetImage(rtl ? DIR_E : DIR_W, image_type); const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL); - vehicle_width = real_sprite->width; + vehicle_width = UnScaleByZoom(real_sprite->width, ZOOM_LVL_GUI); break; } |