summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2014-10-04 16:40:23 +0000
committerpeter1138 <peter1138@openttd.org>2014-10-04 16:40:23 +0000
commitce9fab58bc02cda3fde8d3cb42fd88f25889b340 (patch)
tree7b92188f2ac8622c17ee45cd6c54bd16196c064c
parent587ad940cc46ffb573e080320bac51085994b7f7 (diff)
downloadopenttd-ce9fab58bc02cda3fde8d3cb42fd88f25889b340.tar.xz
(svn r26951) -Codechange: Do the GUI-scale dance for vehicle, depot, and purchase lists.
-rw-r--r--src/aircraft_cmd.cpp2
-rw-r--r--src/aircraft_gui.cpp12
-rw-r--r--src/build_vehicle_gui.cpp1
-rw-r--r--src/depot_gui.cpp29
-rw-r--r--src/roadveh_cmd.cpp4
-rw-r--r--src/roadveh_gui.cpp9
-rw-r--r--src/ship_gui.cpp5
-rw-r--r--src/train_cmd.cpp8
-rw-r--r--src/train_gui.cpp43
-rw-r--r--src/vehicle_gui.cpp16
10 files changed, 73 insertions, 56 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index 76e289c0a..ac71254e1 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -207,7 +207,7 @@ void DrawAircraftEngine(int left, int right, int preferred_x, int y, EngineID en
if (!(AircraftVehInfo(engine)->subtype & AIR_CTOL)) {
SpriteID rotor_sprite = GetCustomRotorIcon(engine, image_type);
if (rotor_sprite == 0) rotor_sprite = SPR_ROTOR_STOPPED;
- DrawSprite(rotor_sprite, PAL_NONE, preferred_x, y - 5);
+ DrawSprite(rotor_sprite, PAL_NONE, preferred_x, y - UnScaleByZoom(4 * 5, ZOOM_LVL_GUI));
}
}
diff --git a/src/aircraft_gui.cpp b/src/aircraft_gui.cpp
index 2c58b68c8..77cfd1de7 100644
--- a/src/aircraft_gui.cpp
+++ b/src/aircraft_gui.cpp
@@ -91,17 +91,21 @@ void DrawAircraftImage(const Vehicle *v, int left, int right, int y, VehicleID s
int x = rtl ? right - width - x_offs : left - x_offs;
bool helicopter = v->subtype == AIR_HELICOPTER;
+ int y_offs = UnScaleByZoom(4 * 10, ZOOM_LVL_GUI);
+ int heli_offs = 0;
+
PaletteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
- DrawSprite(sprite, pal, x, y + 10);
+ DrawSprite(sprite, pal, x, y + y_offs);
if (helicopter) {
const Aircraft *a = Aircraft::From(v);
SpriteID rotor_sprite = GetCustomRotorSprite(a, true, image_type);
if (rotor_sprite == 0) rotor_sprite = SPR_ROTOR_STOPPED;
- DrawSprite(rotor_sprite, PAL_NONE, x, y + 5);
+ heli_offs = UnScaleByZoom(4 * 5, ZOOM_LVL_GUI);
+ DrawSprite(rotor_sprite, PAL_NONE, x, y + y_offs - heli_offs);
}
if (v->index == selection) {
x += x_offs;
- y += UnScaleByZoom(real_sprite->y_offs, ZOOM_LVL_GUI) + 10 - (helicopter ? 5 : 0);
- DrawFrameRect(x - 1, y - 1, x + width + 1, y + UnScaleByZoom(real_sprite->height, ZOOM_LVL_GUI) + (helicopter ? 5 : 0) + 1, COLOUR_WHITE, FR_BORDERONLY);
+ y += UnScaleByZoom(real_sprite->y_offs, ZOOM_LVL_GUI) + y_offs - heli_offs;
+ DrawFrameRect(x - 1, y - 1, x + width + 1, y + UnScaleByZoom(real_sprite->height, ZOOM_LVL_GUI) + heli_offs + 1, COLOUR_WHITE, FR_BORDERONLY);
}
}
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index bb5c6d6e3..c71b49f3b 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -1382,6 +1382,7 @@ struct BuildVehicleWindow : Window {
case WID_BV_LIST:
resize->height = GetEngineListHeight(this->vehicle_type);
size->height = 3 * resize->height;
+ size->width = max(size->width, GetVehicleImageCellSize(this->vehicle_type, EIT_PURCHASE).extend_left + GetVehicleImageCellSize(this->vehicle_type, EIT_PURCHASE).extend_right + 165);
break;
case WID_BV_PANEL:
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index 6b44428af..b2018bd2c 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -190,16 +190,19 @@ static void InitBlocksizeForVehicles(VehicleType type, EngineImageType image_typ
if ((int)x + x_offs > max_extend_right) max_extend_right = x + x_offs;
}
+ int min_extend = UnScaleByZoom(16 * 4, ZOOM_LVL_GUI);
+ int max_extend = UnScaleByZoom(98 * 4, ZOOM_LVL_GUI);
+
switch (image_type) {
case EIT_IN_DEPOT:
- _base_block_sizes_depot[type].height = max(GetVehicleHeight(type), max_height);
- _base_block_sizes_depot[type].extend_left = Clamp(max_extend_left, 16, 98);
- _base_block_sizes_depot[type].extend_right = Clamp(max_extend_right, 16, 98);
+ _base_block_sizes_depot[type].height = max<uint>(UnScaleByZoom(4 * GetVehicleHeight(type), ZOOM_LVL_GUI), max_height);
+ _base_block_sizes_depot[type].extend_left = Clamp(max_extend_left, min_extend, max_extend);
+ _base_block_sizes_depot[type].extend_right = Clamp(max_extend_right, min_extend, max_extend);
break;
case EIT_PURCHASE:
- _base_block_sizes_purchase[type].height = max(GetVehicleHeight(type), max_height);
- _base_block_sizes_purchase[type].extend_left = Clamp(max_extend_left, 16, 98);
- _base_block_sizes_purchase[type].extend_right = Clamp(max_extend_right, 16, 98);
+ _base_block_sizes_purchase[type].height = max<uint>(UnScaleByZoom(4 * GetVehicleHeight(type), ZOOM_LVL_GUI), max_height);
+ _base_block_sizes_purchase[type].extend_left = Clamp(max_extend_left, min_extend, max_extend);
+ _base_block_sizes_purchase[type].extend_right = Clamp(max_extend_right, min_extend, max_extend);
break;
default: NOT_REACHED();
@@ -274,7 +277,7 @@ struct DepotWindow : Window {
void DrawVehicleInDepot(const Vehicle *v, int left, int right, int y) const
{
bool free_wagon = false;
- int sprite_y = y + (this->resize.step_height - GetVehicleHeight(v->type)) / 2;
+ int sprite_y = y + (this->resize.step_height - UnScaleByZoom(4 * GetVehicleHeight(v->type), ZOOM_LVL_GUI)) / 2;
bool rtl = _current_text_dir == TD_RTL;
int image_left = rtl ? left + this->count_width : left + this->header_width;
@@ -285,7 +288,7 @@ struct DepotWindow : Window {
const Train *u = Train::From(v);
free_wagon = u->IsFreeWagon();
- uint x_space = free_wagon ? TRAININFO_DEFAULT_VEHICLE_WIDTH : 0;
+ uint x_space = free_wagon ? UnScaleByZoom(4 * TRAININFO_DEFAULT_VEHICLE_WIDTH, ZOOM_LVL_GUI) : 0;
DrawTrainImage(u, image_left + (rtl ? 0 : x_space), image_right - (rtl ? x_space : 0), sprite_y - 1,
this->sel, EIT_IN_DEPOT, free_wagon ? 0 : this->hscroll->GetPosition(), this->vehicle_over);
@@ -298,13 +301,7 @@ struct DepotWindow : Window {
case VEH_ROAD: DrawRoadVehImage( v, image_left, image_right, sprite_y, this->sel, EIT_IN_DEPOT); break;
case VEH_SHIP: DrawShipImage( v, image_left, image_right, sprite_y, this->sel, EIT_IN_DEPOT); break;
- case VEH_AIRCRAFT: {
- const Sprite *spr = GetSprite(v->GetImage(DIR_W, EIT_IN_DEPOT), ST_NORMAL);
- DrawAircraftImage(v, image_left, image_right,
- y + max(UnScaleByZoom(spr->height, ZOOM_LVL_GUI) + UnScaleByZoom(spr->y_offs, ZOOM_LVL_GUI) - 14, 0), // tall sprites needs an y offset
- this->sel, EIT_IN_DEPOT);
- break;
- }
+ case VEH_AIRCRAFT: DrawAircraftImage(v, image_left, image_right, sprite_y, this->sel, EIT_IN_DEPOT); break;
default: NOT_REACHED();
}
@@ -627,7 +624,7 @@ struct DepotWindow : Window {
resize->height = max<uint>(GetVehicleImageCellSize(this->type, EIT_IN_DEPOT).height, min_height);
if (this->type == VEH_TRAIN) {
resize->width = 1;
- size->width = base_width + 2 * 29; // about 2 parts
+ size->width = base_width + 2 * UnScaleByZoom(29 * 4, ZOOM_LVL_GUI); // about 2 parts
size->height = resize->height * 6;
} else {
resize->width = base_width + GetVehicleImageCellSize(this->type, EIT_IN_DEPOT).extend_left + GetVehicleImageCellSize(this->type, EIT_IN_DEPOT).extend_right;
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index d1d5a0c23..3f9d3616f 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -107,10 +107,10 @@ int RoadVehicle::GetDisplayImageWidth(Point *offset) const
int reference_width = ROADVEHINFO_DEFAULT_VEHICLE_WIDTH;
if (offset != NULL) {
- offset->x = reference_width / 2;
+ offset->x = UnScaleByZoom(2 * reference_width, ZOOM_LVL_GUI);
offset->y = 0;
}
- return this->gcache.cached_veh_length * reference_width / VEHICLE_LENGTH;
+ return UnScaleByZoom(4 * this->gcache.cached_veh_length * reference_width / VEHICLE_LENGTH, ZOOM_LVL_GUI);
}
static SpriteID GetRoadVehIcon(EngineID engine, EngineImageType image_type)
diff --git a/src/roadveh_gui.cpp b/src/roadveh_gui.cpp
index 7f3e7bbbc..e00fb2873 100644
--- a/src/roadveh_gui.cpp
+++ b/src/roadveh_gui.cpp
@@ -15,6 +15,7 @@
#include "strings_func.h"
#include "vehicle_func.h"
#include "string_func.h"
+#include "zoom_func.h"
#include "table/strings.h"
@@ -30,7 +31,7 @@
*/
void DrawRoadVehDetails(const Vehicle *v, int left, int right, int y)
{
- uint y_offset = v->HasArticulatedPart() ? 15 : 0; // Draw the first line below the sprite of an articulated RV instead of after it.
+ uint y_offset = v->HasArticulatedPart() ? UnScaleByZoom(4 * 15, ZOOM_LVL_GUI) : 0; // Draw the first line below the sprite of an articulated RV instead of after it.
StringID str;
Money feeder_share = 0;
@@ -136,7 +137,7 @@ void DrawRoadVehImage(const Vehicle *v, int left, int right, int y, VehicleID se
DrawPixelInfo tmp_dpi, *old_dpi;
int max_width = right - left + 1;
- if (!FillDrawPixelInfo(&tmp_dpi, left, y, max_width, 14)) return;
+ if (!FillDrawPixelInfo(&tmp_dpi, left, y, max_width, UnScaleByZoom(4 * 14, ZOOM_LVL_GUI))) return;
old_dpi = _cur_dpi;
_cur_dpi = &tmp_dpi;
@@ -148,14 +149,14 @@ void DrawRoadVehImage(const Vehicle *v, int left, int right, int y, VehicleID se
if (rtl ? px + width > 0 : px - width < max_width) {
PaletteID pal = (u->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(u);
- DrawSprite(u->GetImage(dir, image_type), pal, px + (rtl ? -offset.x : offset.x), 6 + offset.y);
+ DrawSprite(u->GetImage(dir, image_type), pal, px + (rtl ? -offset.x : offset.x), UnScaleByZoom(4 * 6, ZOOM_LVL_GUI) + offset.y);
}
px += rtl ? -width : width;
}
if (v->index == selection) {
- DrawFrameRect((rtl ? px : 0), 0, (rtl ? max_width : px) - 1, 12, COLOUR_WHITE, FR_BORDERONLY);
+ DrawFrameRect((rtl ? px : 0), 0, (rtl ? max_width : px) - 1, UnScaleByZoom(4 * 13, ZOOM_LVL_GUI) - 1, COLOUR_WHITE, FR_BORDERONLY);
}
_cur_dpi = old_dpi;
diff --git a/src/ship_gui.cpp b/src/ship_gui.cpp
index cd04efbef..4db55215c 100644
--- a/src/ship_gui.cpp
+++ b/src/ship_gui.cpp
@@ -42,11 +42,12 @@ void DrawShipImage(const Vehicle *v, int left, int right, int y, VehicleID selec
int x_offs = UnScaleByZoom(real_sprite->x_offs, ZOOM_LVL_GUI);
int x = rtl ? right - width - x_offs : left - x_offs;
- DrawSprite(sprite, GetVehiclePalette(v), x, y + 10);
+ y += UnScaleByZoom(4 * 10, ZOOM_LVL_GUI);
+ DrawSprite(sprite, GetVehiclePalette(v), x, y);
if (v->index == selection) {
x += x_offs;
- y += UnScaleByZoom(real_sprite->y_offs, ZOOM_LVL_GUI) + 10;
+ y += UnScaleByZoom(real_sprite->y_offs, ZOOM_LVL_GUI);
DrawFrameRect(x - 1, y - 1, x + width + 1, y + UnScaleByZoom(real_sprite->height, ZOOM_LVL_GUI) + 1, COLOUR_WHITE, FR_BORDERONLY);
}
}
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 73e26a4b1..a31b9272d 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -464,10 +464,10 @@ int Train::GetDisplayImageWidth(Point *offset) const
}
if (offset != NULL) {
- offset->x = reference_width / 2;
- offset->y = vehicle_pitch;
+ offset->x = UnScaleByZoom(2 * reference_width, ZOOM_LVL_GUI);
+ offset->y = UnScaleByZoom(4 * vehicle_pitch, ZOOM_LVL_GUI);
}
- return this->gcache.cached_veh_length * reference_width / VEHICLE_LENGTH;
+ return UnScaleByZoom(4 * this->gcache.cached_veh_length * reference_width / VEHICLE_LENGTH, ZOOM_LVL_GUI);
}
static SpriteID GetDefaultTrainSprite(uint8 spritenum, Direction direction)
@@ -514,7 +514,7 @@ static SpriteID GetRailIcon(EngineID engine, bool rear_head, int &y, EngineImage
SpriteID sprite = GetCustomVehicleIcon(engine, dir, image_type);
if (sprite != 0) {
if (e->GetGRF() != NULL) {
- y += e->GetGRF()->traininfo_vehicle_pitch;
+ y += UnScaleByZoom(4 * e->GetGRF()->traininfo_vehicle_pitch, ZOOM_LVL_GUI);
}
return sprite;
}
diff --git a/src/train_gui.cpp b/src/train_gui.cpp
index a89ade3cf..6c2d9a9d6 100644
--- a/src/train_gui.cpp
+++ b/src/train_gui.cpp
@@ -15,6 +15,7 @@
#include "train.h"
#include "strings_func.h"
#include "vehicle_func.h"
+#include "zoom_func.h"
#include "table/strings.h"
@@ -73,7 +74,7 @@ static int HighlightDragPosition(int px, int max_width, VehicleID selection)
if (drag_hlight_width > 0) {
GfxFillRect(drag_hlight_left + WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP + 1,
- drag_hlight_right - WD_FRAMERECT_RIGHT, 13 - WD_FRAMERECT_BOTTOM, _colour_gradient[COLOUR_GREY][7]);
+ drag_hlight_right - WD_FRAMERECT_RIGHT, UnScaleByZoom(4 * 13, ZOOM_LVL_GUI) - WD_FRAMERECT_BOTTOM, _colour_gradient[COLOUR_GREY][7]);
}
return drag_hlight_width;
@@ -99,8 +100,9 @@ void DrawTrainImage(const Train *v, int left, int right, int y, VehicleID select
int highlight_l = 0;
int highlight_r = 0;
int max_width = right - left + 1;
+ int height = UnScaleByZoom(4 * 14, ZOOM_LVL_GUI);
- if (!FillDrawPixelInfo(&tmp_dpi, left, y, max_width, 14)) return;
+ if (!FillDrawPixelInfo(&tmp_dpi, left, y, max_width, height)) return;
old_dpi = _cur_dpi;
_cur_dpi = &tmp_dpi;
@@ -121,7 +123,7 @@ void DrawTrainImage(const Train *v, int left, int right, int y, VehicleID select
if (rtl ? px + width > 0 : px - width < max_width) {
PaletteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
- DrawSprite(v->GetImage(dir, image_type), pal, px + (rtl ? -offset.x : offset.x), 7 + offset.y);
+ DrawSprite(v->GetImage(dir, image_type), pal, px + (rtl ? -offset.x : offset.x), height / 2 + offset.y);
}
if (!v->IsArticulatedPart()) sel_articulated = false;
@@ -150,7 +152,7 @@ void DrawTrainImage(const Train *v, int left, int right, int y, VehicleID select
if (highlight_l != highlight_r) {
/* Draw the highlight. Now done after drawing all the engines, as
* the next engine after the highlight could overlap it. */
- DrawFrameRect(highlight_l, 0, highlight_r, 13, COLOUR_WHITE, FR_BORDERONLY);
+ DrawFrameRect(highlight_l, 0, highlight_r, height - 1, COLOUR_WHITE, FR_BORDERONLY);
}
_cur_dpi = old_dpi;
@@ -350,13 +352,19 @@ int GetTrainDetailsWndVScroll(VehicleID veh_id, TrainDetailsWindowTabs det_tab)
*/
void DrawTrainDetails(const Train *v, int left, int right, int y, int vscroll_pos, uint16 vscroll_cap, TrainDetailsWindowTabs det_tab)
{
+ /* get rid of awkward offset */
+ y -= WD_MATRIX_TOP;
+
+ int sprite_height = UnScaleByZoom(4 * GetVehicleHeight(VEH_TRAIN), ZOOM_LVL_GUI);
+ int line_height = max(sprite_height, WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM);
+ int sprite_y_offset = line_height / 2;
+ int text_y_offset = (line_height - FONT_HEIGHT_NORMAL) / 2;
+
/* draw the first 3 details tabs */
if (det_tab != TDW_TAB_TOTALS) {
bool rtl = _current_text_dir == TD_RTL;
Direction dir = rtl ? DIR_E : DIR_W;
int x = rtl ? right : left;
- int sprite_y_offset = 4 + (FONT_HEIGHT_NORMAL - 10) / 2;
- int line_height = WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM;
for (; v != NULL && vscroll_pos > -vscroll_cap; v = v->GetNextVehicle()) {
GetCargoSummaryOfArticulatedVehicle(v, &_cargo_summary);
@@ -368,15 +376,20 @@ void DrawTrainDetails(const Train *v, int left, int right, int y, int vscroll_po
Point offset;
int width = u->GetDisplayImageWidth(&offset);
if (vscroll_pos <= 0 && vscroll_pos > -vscroll_cap) {
+ int pitch = 0;
+ const Engine *e = Engine::Get(v->engine_type);
+ if (e->GetGRF() != NULL) {
+ pitch = UnScaleByZoom(4 * e->GetGRF()->traininfo_vehicle_pitch, ZOOM_LVL_GUI);
+ }
PaletteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
- DrawSprite(u->GetImage(dir, EIT_IN_DETAILS), pal, px + (rtl ? -offset.x : offset.x), y - line_height * vscroll_pos + sprite_y_offset + offset.y);
+ DrawSprite(u->GetImage(dir, EIT_IN_DETAILS), pal, px + (rtl ? -offset.x : offset.x), y - line_height * vscroll_pos + sprite_y_offset + pitch);
}
px += rtl ? -width : width;
dx += width;
u = u->Next();
} while (u != NULL && u->IsArticulatedPart());
- bool separate_sprite_row = (dx > TRAIN_DETAILS_MAX_INDENT);
+ bool separate_sprite_row = (dx > (uint)UnScaleByZoom(4 * TRAIN_DETAILS_MAX_INDENT, ZOOM_LVL_GUI));
if (separate_sprite_row) {
vscroll_pos--;
dx = 0;
@@ -384,11 +397,11 @@ void DrawTrainDetails(const Train *v, int left, int right, int y, int vscroll_po
uint num_lines = max(1u, _cargo_summary.Length());
for (uint i = 0; i < num_lines; i++) {
- int sprite_width = max<int>(dx, TRAIN_DETAILS_MIN_INDENT) + 3;
+ int sprite_width = max<int>(dx, UnScaleByZoom(4 * TRAIN_DETAILS_MIN_INDENT, ZOOM_LVL_GUI)) + 3;
int data_left = left + (rtl ? 0 : sprite_width);
int data_right = right - (rtl ? sprite_width : 0);
if (vscroll_pos <= 0 && vscroll_pos > -vscroll_cap) {
- int py = y - line_height * vscroll_pos;
+ int py = y - line_height * vscroll_pos + text_y_offset;
if (i > 0 || separate_sprite_row) {
if (vscroll_pos != 0) GfxFillRect(left, py - WD_MATRIX_TOP - 1, right, py - WD_MATRIX_TOP, _colour_gradient[COLOUR_GREY][5]);
}
@@ -432,8 +445,8 @@ void DrawTrainDetails(const Train *v, int left, int right, int y, int vscroll_po
}
/* draw total cargo tab */
- DrawString(left, right, y, STR_VEHICLE_DETAILS_TRAIN_TOTAL_CAPACITY_TEXT);
- y += WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM;
+ DrawString(left, right, y + text_y_offset, STR_VEHICLE_DETAILS_TRAIN_TOTAL_CAPACITY_TEXT);
+ y += line_height;
for (CargoID i = 0; i < NUM_CARGO; i++) {
if (max_cargo[i] > 0 && --vscroll_pos < 0 && vscroll_pos > -vscroll_cap) {
@@ -442,11 +455,11 @@ void DrawTrainDetails(const Train *v, int left, int right, int y, int vscroll_po
SetDParam(2, i); // {SHORTCARGO} #1
SetDParam(3, max_cargo[i]); // {SHORTCARGO} #2
SetDParam(4, _settings_game.vehicle.freight_trains);
- DrawString(left, right, y, FreightWagonMult(i) > 1 ? STR_VEHICLE_DETAILS_TRAIN_TOTAL_CAPACITY_MULT : STR_VEHICLE_DETAILS_TRAIN_TOTAL_CAPACITY);
- y += WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM;
+ DrawString(left, right, y + text_y_offset, FreightWagonMult(i) > 1 ? STR_VEHICLE_DETAILS_TRAIN_TOTAL_CAPACITY_MULT : STR_VEHICLE_DETAILS_TRAIN_TOTAL_CAPACITY);
+ y += line_height;
}
}
SetDParam(0, feeder_share);
- DrawString(left, right, y, STR_VEHICLE_INFO_FEEDER_CARGO_VALUE);
+ DrawString(left, right, y + text_y_offset, STR_VEHICLE_INFO_FEEDER_CARGO_VALUE);
}
}
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 16813cea5..3d122ff6a 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -655,7 +655,7 @@ struct RefitWindow : public Window {
break;
case WID_VR_VEHICLE_PANEL_DISPLAY:
- size->height = GetVehicleHeight(Vehicle::Get(this->window_number)->type);
+ size->height = UnScaleByZoom(4 * GetVehicleHeight(Vehicle::Get(this->window_number)->type), ZOOM_LVL_GUI);
break;
case WID_VR_INFO:
@@ -752,7 +752,7 @@ struct RefitWindow : public Window {
}
if (left != right) {
- DrawFrameRect(left, r.top + WD_FRAMERECT_TOP, right, r.top + WD_FRAMERECT_TOP + 13, COLOUR_WHITE, FR_BORDERONLY);
+ DrawFrameRect(left, r.top + WD_FRAMERECT_TOP, right, r.top + WD_FRAMERECT_TOP + UnScaleByZoom(4 * 14, ZOOM_LVL_GUI) - 1, COLOUR_WHITE, FR_BORDERONLY);
}
left = INT32_MIN;
@@ -1330,7 +1330,7 @@ void DrawVehicleImage(const Vehicle *v, int left, int right, int y, VehicleID se
uint GetVehicleListHeight(VehicleType type, uint divisor)
{
/* Name + vehicle + profit */
- uint base = GetVehicleHeight(type) + 2 * FONT_HEIGHT_SMALL;
+ uint base = UnScaleByZoom(4 * GetVehicleHeight(type), ZOOM_LVL_GUI) + 2 * FONT_HEIGHT_SMALL;
/* Drawing of the 4 small orders + profit*/
if (type >= VEH_SHIP) base = max(base, 5U * FONT_HEIGHT_SMALL);
@@ -1354,13 +1354,13 @@ void BaseVehicleListWindow::DrawVehicleListItems(VehicleID selected_vehicle, int
int width = right - left;
bool rtl = _current_text_dir == TD_RTL;
- int text_offset = GetDigitWidth() * this->unitnumber_digits + WD_FRAMERECT_RIGHT;
+ int text_offset = max<int>(GetSpriteSize(SPR_PROFIT_LOT).width, GetDigitWidth() * this->unitnumber_digits) + WD_FRAMERECT_RIGHT;
int text_left = left + (rtl ? 0 : text_offset);
int text_right = right - (rtl ? text_offset : 0);
bool show_orderlist = this->vli.vtype >= VEH_SHIP;
- int orderlist_left = left + (rtl ? 0 : max(100 + text_offset, width / 2));
- int orderlist_right = right - (rtl ? max(100 + text_offset, width / 2) : 0);
+ int orderlist_left = left + (rtl ? 0 : max(UnScaleByZoom(4 * 100, ZOOM_LVL_GUI) + text_offset, width / 2));
+ int orderlist_right = right - (rtl ? max(UnScaleByZoom(4 * 100, ZOOM_LVL_GUI) + text_offset, width / 2) : 0);
int image_left = (rtl && show_orderlist) ? orderlist_right : text_left;
int image_right = (!rtl && show_orderlist) ? orderlist_left : text_right;
@@ -1896,7 +1896,7 @@ struct VehicleDetailsWindow : Window {
uint desired_height;
if (v->HasArticulatedPart()) {
/* An articulated RV has its text drawn under the sprite instead of after it, hence 15 pixels extra. */
- desired_height = WD_FRAMERECT_TOP + 15 + 3 * FONT_HEIGHT_NORMAL + 2 + WD_FRAMERECT_BOTTOM;
+ desired_height = WD_FRAMERECT_TOP + UnScaleByZoom(4 * 15, ZOOM_LVL_GUI) + 3 * FONT_HEIGHT_NORMAL + 2 + WD_FRAMERECT_BOTTOM;
/* Add space for the cargo amount for each part. */
for (const Vehicle *u = v; u != NULL; u = u->Next()) {
if (u->cargo_cap != 0) desired_height += FONT_HEIGHT_NORMAL + 1;
@@ -1953,7 +1953,7 @@ struct VehicleDetailsWindow : Window {
}
case WID_VD_MATRIX:
- resize->height = WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM;
+ resize->height = max(UnScaleByZoom(4 * 14, ZOOM_LVL_GUI), WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM);
size->height = 4 * resize->height;
break;