Index: src/depot_gui.cpp
===================================================================
--- src/depot_gui.cpp (revision 27935)
+++ src/depot_gui.cpp (working copy)
@@ -383,12 +383,13 @@
int col = _colour_gradient[wid->colour][4];
int image_left = rtl ? r.left + this->count_width : r.left + this->header_width;
int image_right = rtl ? r.right - this->header_width : r.right - this->count_width;
+ int first_line = w + (-this->hscroll->GetPosition()) % w;
if (rtl) {
- for (int x = image_right - w; x > image_left; x -= w) {
+ for (int x = image_right - first_line; x >= image_left; x -= w) {
GfxDrawLine(x, r.top, x, r.bottom, col, 1, 3);
}
} else {
- for (int x = image_left + w; x < image_right; x += w) {
+ for (int x = image_left + first_line; x <= image_right; x += w) {
GfxDrawLine(x, r.top, x, r.bottom, col, 1, 3);
}
}
@@ -734,7 +735,8 @@
}
/* Always have 1 empty row, so people can change the setting of the train */
this->vscroll->SetCount(this->vehicle_list.Length() + this->wagon_list.Length() + 1);
- this->hscroll->SetCount(max_width);
+ /* Always make it longer than the longest train, so you can attach vehicles at the end, and also see the next vertical tile separator line */
+ this->hscroll->SetCount(max_width + ScaleGUITrad(VEHICLEINFO_FULL_VEHICLE_WIDTH + 1));
} else {
this->vscroll->SetCount(CeilDiv(this->vehicle_list.Length(), this->num_columns));
}
Index: src/train_gui.cpp
===================================================================
--- src/train_gui.cpp (revision 27935)
+++ src/train_gui.cpp (working copy)
@@ -64,14 +64,14 @@
bool rtl = _current_text_dir == TD_RTL;
assert(selection != INVALID_VEHICLE);
- int dragged_width = WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
+ int dragged_width = 0;
for (Train *t = Train::Get(selection); t != NULL; t = chain ? t->Next() : (t->HasArticulatedPart() ? t->GetNextArticulatedPart() : NULL)) {
dragged_width += t->GetDisplayImageWidth(NULL);
}
- int drag_hlight_left = rtl ? max(px -dragged_width, 0) : px;
- int drag_hlight_right = rtl ? px : min(px + dragged_width, max_width);
- int drag_hlight_width = max(drag_hlight_right - drag_hlight_left, 0);
+ int drag_hlight_left = rtl ? max(px - dragged_width + 1, 0) : px;
+ int drag_hlight_right = rtl ? px : min(px + dragged_width, max_width) - 1;
+ int drag_hlight_width = max(drag_hlight_right - drag_hlight_left + 1, 0);
if (drag_hlight_width > 0) {
GfxFillRect(drag_hlight_left + WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP + 1,