summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-06-23 14:32:34 +0000
committerfrosch <frosch@openttd.org>2012-06-23 14:32:34 +0000
commit9208059e3e3cc168e356eadddf93584849c1edcc (patch)
tree45537c422ab2b766f9545effbef86c744fdedf90
parent90b539818fc08e802b719fc9785e2eecf6bccfe9 (diff)
downloadopenttd-9208059e3e3cc168e356eadddf93584849c1edcc.tar.xz
(svn r24352) -Fix: When highlighting the drop position for vehicles in depots, make space for all articulated parts.
-rw-r--r--src/train_gui.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/train_gui.cpp b/src/train_gui.cpp
index 5d5fe3ab7..7888b0d65 100644
--- a/src/train_gui.cpp
+++ b/src/train_gui.cpp
@@ -61,8 +61,10 @@ static int HighlightDragPosition(int px, int max_width, VehicleID selection)
bool rtl = _current_text_dir == TD_RTL;
assert(selection != INVALID_VEHICLE);
- Point offset;
- int dragged_width = Train::Get(selection)->GetDisplayImageWidth(&offset) + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
+ int dragged_width = WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
+ for (Train *t = Train::Get(selection); t != NULL; t = 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);