Changeset - r22715:e4c3ea780fe1
[Not reviewed]
master
0 1 0
frosch - 7 years ago 2017-12-10 13:45:53
frosch@openttd.org
(svn r27936) -Fix: When moving wagons in the depot, the drag highlight did not exactly match the length of the dragged wagon chain.
1 file changed with 4 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/train_gui.cpp
Show inline comments
 
@@ -64,14 +64,14 @@ static int HighlightDragPosition(int px,
 
	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,
0 comments (0 inline, 0 general)