summaryrefslogtreecommitdiff
path: root/src/depot_gui.cpp
diff options
context:
space:
mode:
authormaedhros <maedhros@openttd.org>2007-03-31 08:24:05 +0000
committermaedhros <maedhros@openttd.org>2007-03-31 08:24:05 +0000
commit3ac05f25dbdaf27ef0a9f20513036e898614cd34 (patch)
tree9fd091a327f406390130d1c6883e93051fe71d40 /src/depot_gui.cpp
parent377fbf9eb7f879375da364d9c8ad4ab2dd1eeeb4 (diff)
downloadopenttd-3ac05f25dbdaf27ef0a9f20513036e898614cd34.tar.xz
(svn r9531) -Fix (r8661) [FS#692]: The scroll settings were wrong for trains as only a part
of the window should be horizontally scrollable, not all of it. This lead to wagons without an engine overflowing the window and not being able to scroll to the end of a train if there was an engine attached.
Diffstat (limited to 'src/depot_gui.cpp')
-rw-r--r--src/depot_gui.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index 8976da0b1..55f04ecee 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -176,7 +176,7 @@ static void DrawVehicleInDepot(Window *w, const Vehicle *v, int x, int y)
switch (v->type) {
case VEH_TRAIN:
- DrawTrainImage(v, x + 21, sprite_y, w->widget[DEPOT_WIDGET_MATRIX].right - 32, w->hscroll.pos, WP(w,depot_d).sel);
+ DrawTrainImage(v, x + 21, sprite_y, w->hscroll.cap + 4, w->hscroll.pos, WP(w,depot_d).sel);
/* Number of wagons relative to a standard length wagon (rounded up) */
SetDParam(0, (v->u.rail.cached_total_length + 7) / 8);
@@ -638,7 +638,7 @@ uint _block_sizes[4][2];
/* Array to hold the default resize capacities
* First part is the vehicle type, while the last is 0 = x, 1 = y */
const uint _resize_cap[][2] = {
-/* VEH_TRAIN */ {6, 10 * 29 + 36}, ///< flags, unitnumber and unit count uses a total of 36 pixels and we set default to 10 units
+/* VEH_TRAIN */ {6, 10 * 29},
/* VEH_ROAD */ {5, 5},
/* VEH_SHIP */ {3, 3},
/* VEH_AIRCRAFT */ {3, 4},
@@ -719,8 +719,9 @@ static void CreateDepotListWindow(Window *w, byte type)
_block_sizes[type][1] * w->vscroll.cap);
if (type == VEH_TRAIN) {
- /* The train depot has a horizontal scroller so we should make room for it */
- ResizeWindow(w, 0, 12);
+ /* Make space for the horizontal scrollbar vertically, and the unit
+ * number, flag, and length counter horizontally. */
+ ResizeWindow(w, 36, 12);
/* substract the newly added space from the matrix since it was meant for the scrollbar */
w->widget[DEPOT_WIDGET_MATRIX].bottom -= 12;
}