summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2009-11-16 21:10:23 +0000
committerpeter1138 <peter1138@openttd.org>2009-11-16 21:10:23 +0000
commitd499aa0187940a980891c095d843a2e5c358fb0d (patch)
tree02f8bf2ca9c4f1d9556d85e1606fd79e4691ed8f /src
parentef11ce84ee8fc81def8bcdef6e2307869f9637f1 (diff)
downloadopenttd-d499aa0187940a980891c095d843a2e5c358fb0d.tar.xz
(svn r18129) -Codechange: Fix up train details window for correct offsets and line spacing.
Diffstat (limited to 'src')
-rw-r--r--src/train_gui.cpp16
-rw-r--r--src/vehicle_gui.cpp12
2 files changed, 15 insertions, 13 deletions
diff --git a/src/train_gui.cpp b/src/train_gui.cpp
index b939584c2..dd7852736 100644
--- a/src/train_gui.cpp
+++ b/src/train_gui.cpp
@@ -239,13 +239,13 @@ void DrawTrainDetails(const Train *v, int left, int right, int y, int vscroll_po
Point offset;
int width = u->GetDisplayImageWidth(&offset);
SpriteID pal = (u->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(u);
- DrawSprite(u->GetImage(DIR_W), pal, px + offset.x, y + 6 + offset.y);
+ DrawSprite(u->GetImage(DIR_W), pal, px + offset.x, y + 4 + offset.y);
px += width;
u = u->Next();
} while (u != NULL && u->IsArticulatedPart() && u->cargo_cap == 0);
px += 2;
- int py = y + 2;
+ int py = y;
switch (det_tab) {
default: NOT_REACHED();
@@ -264,7 +264,7 @@ void DrawTrainDetails(const Train *v, int left, int right, int y, int vscroll_po
TrainDetailsCapacityTab(v, px, right, py);
break;
}
- y += 14;
+ y += WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM;
v = u;
} else {
@@ -287,19 +287,21 @@ void DrawTrainDetails(const Train *v, int left, int right, int y, int vscroll_po
}
/* draw total cargo tab */
- DrawString(left, right, y + 2, STR_VEHICLE_DETAILS_TRAIN_TOTAL_CAPACITY_TEXT);
+ DrawString(left, right, y, STR_VEHICLE_DETAILS_TRAIN_TOTAL_CAPACITY_TEXT);
+ y += WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM;
+
for (CargoID i = 0; i < NUM_CARGO; i++) {
if (max_cargo[i] > 0 && --vscroll_pos < 0 && vscroll_pos > -vscroll_cap) {
- y += 14;
SetDParam(0, i); // {CARGO} #1
SetDParam(1, act_cargo[i]); // {CARGO} #2
SetDParam(2, i); // {SHORTCARGO} #1
SetDParam(3, max_cargo[i]); // {SHORTCARGO} #2
SetDParam(4, _settings_game.vehicle.freight_trains);
- DrawString(left, right, y + 2, FreightWagonMult(i) > 1 ? STR_VEHICLE_DETAILS_TRAIN_TOTAL_CAPACITY_MULT : STR_VEHICLE_DETAILS_TRAIN_TOTAL_CAPACITY);
+ 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;
}
}
SetDParam(0, feeder_share);
- DrawString(left, right, y + 15, STR_VEHICLE_INFO_FEEDER_CARGO_VALUE);
+ DrawString(left, right, y, STR_VEHICLE_INFO_FEEDER_CARGO_VALUE);
}
}
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 627d85871..58a02d3a9 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -1258,7 +1258,7 @@ static const NWidgetPart _nested_train_vehicle_details_widgets[] = {
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, VLD_WIDGET_TOP_DETAILS), SetResize(1, 0), SetMinimalSize(405, 42), EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_MATRIX, COLOUR_GREY, VLD_WIDGET_MATRIX), SetResize(1, 1), SetMinimalSize(393, 45), SetDataTip(0x701, STR_NULL),
+ NWidget(WWT_MATRIX, COLOUR_GREY, VLD_WIDGET_MATRIX), SetResize(1, 1), SetMinimalSize(393, 45), SetDataTip(0x701, STR_NULL), SetFill(true, false),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, VLD_WIDGET_SCROLLBAR),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, VLD_WIDGET_BOTTOM_RIGHT),
@@ -1272,11 +1272,11 @@ static const NWidgetPart _nested_train_vehicle_details_widgets[] = {
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, VLD_WIDGET_DETAILS_CARGO_CARRIED), SetMinimalSize(96, 12),
- SetDataTip(STR_VEHICLE_DETAIL_TAB_CARGO, STR_VEHICLE_DETAILS_TRAIN_CARGO_TOOLTIP),
+ SetDataTip(STR_VEHICLE_DETAIL_TAB_CARGO, STR_VEHICLE_DETAILS_TRAIN_CARGO_TOOLTIP), SetResize(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, VLD_WIDGET_DETAILS_TRAIN_VEHICLES), SetMinimalSize(99, 12),
- SetDataTip(STR_VEHICLE_DETAIL_TAB_INFORMATION, STR_VEHICLE_DETAILS_TRAIN_INFORMATION_TOOLTIP),
+ SetDataTip(STR_VEHICLE_DETAIL_TAB_INFORMATION, STR_VEHICLE_DETAILS_TRAIN_INFORMATION_TOOLTIP), SetResize(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, VLD_WIDGET_DETAILS_CAPACITY_OF_EACH), SetMinimalSize(99, 12),
- SetDataTip(STR_VEHICLE_DETAIL_TAB_CAPACITIES, STR_VEHICLE_DETAILS_TRAIN_CAPACITIES_TOOLTIP),
+ SetDataTip(STR_VEHICLE_DETAIL_TAB_CAPACITIES, STR_VEHICLE_DETAILS_TRAIN_CAPACITIES_TOOLTIP), SetResize(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, VLD_WIDGET_DETAILS_TOTAL_CARGO), SetMinimalSize(99, 12),
SetDataTip(STR_VEHICLE_DETAIL_TAB_TOTAL_CARGO, STR_VEHICLE_DETAILS_TRAIN_TOTAL_CARGO_TOOLTIP), SetResize(1, 0),
NWidget(WWT_RESIZEBOX, COLOUR_GREY, VLD_WIDGET_RESIZE),
@@ -1345,7 +1345,7 @@ struct VehicleDetailsWindow : Window {
}
case VLD_WIDGET_MATRIX:
- resize->height = 14;
+ resize->height = WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM;
size->height = 4 * resize->height;
break;
@@ -1448,7 +1448,7 @@ struct VehicleDetailsWindow : Window {
case VLD_WIDGET_MATRIX:
/* For trains only. */
- DrawVehicleDetails(v, r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, this->vscroll.GetPosition(), this->vscroll.GetCapacity(), this->tab);
+ DrawVehicleDetails(v, r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_RIGHT, r.top + WD_MATRIX_TOP, this->vscroll.GetPosition(), this->vscroll.GetCapacity(), this->tab);
break;
case VLD_WIDGET_MIDDLE_DETAILS: