summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/train_gui.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/train_gui.cpp b/src/train_gui.cpp
index 4724fb98a..51e772b52 100644
--- a/src/train_gui.cpp
+++ b/src/train_gui.cpp
@@ -64,14 +64,14 @@ static int HighlightDragPosition(int px, int max_width, VehicleID selection, boo
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,