changeset 19449:0cc21f48ebe7 draft

(svn r24352) -Fix: When highlighting the drop position for vehicles in depots, make space for all articulated parts.
author frosch <frosch@openttd.org>
date Sat, 23 Jun 2012 14:32:34 +0000
parents 842691e2e353
children 9b2b2da544a6
files src/train_gui.cpp
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/train_gui.cpp
+++ b/src/train_gui.cpp
@@ -61,8 +61,10 @@
 	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);