(svn r14329) -Fix (r14306): selections in the group GUI weren't shown anymore.
authorrubidium
Mon, 15 Sep 2008 10:02:39 +0000
changeset 10143 38ea4e64508a
parent 10142 3381ba0bd3ca
child 10144 82cc68c43654
(svn r14329) -Fix (r14306): selections in the group GUI weren't shown anymore.
src/group_gui.cpp
src/vehicle_gui.cpp
src/vehicle_gui_base.h
--- a/src/group_gui.cpp	Mon Sep 15 08:37:40 2008 +0000
+++ b/src/group_gui.cpp	Mon Sep 15 10:02:39 2008 +0000
@@ -440,7 +440,7 @@
 
 		this->DrawSortButtonState(GRP_WIDGET_SORT_BY_ORDER, this->vehicles.IsDescSortOrder() ? SBS_DOWN : SBS_UP);
 
-		this->DrawVehicleListItems(x);
+		this->DrawVehicleListItems(x, this->vehicle_sel);
 	}
 
 	virtual void OnClick(Point pt, int widget)
--- a/src/vehicle_gui.cpp	Mon Sep 15 08:37:40 2008 +0000
+++ b/src/vehicle_gui.cpp	Mon Sep 15 10:02:39 2008 +0000
@@ -741,8 +741,9 @@
 /**
  * Draw all the vehicle list items.
  * @param x the position from where to draw the items.
+ * @param selected_vehicle the vehicle that is to be selected
  */
-void BaseVehicleListWindow::DrawVehicleListItems(int x)
+void BaseVehicleListWindow::DrawVehicleListItems(int x, VehicleID selected_vehicle)
 {
 	int y = PLY_WND_PRC__OFFSET_TOP_WIDGET;
 	uint max = min(this->vscroll.pos + this->vscroll.cap, this->vehicles.Length());
@@ -753,7 +754,7 @@
 		SetDParam(0, v->GetDisplayProfitThisYear());
 		SetDParam(1, v->GetDisplayProfitLastYear());
 
-		DrawVehicleImage(v, x + 19, y + 6, INVALID_VEHICLE, this->widget[VLW_WIDGET_LIST].right - this->widget[VLW_WIDGET_LIST].left - 20, 0);
+		DrawVehicleImage(v, x + 19, y + 6, selected_vehicle, this->widget[VLW_WIDGET_LIST].right - this->widget[VLW_WIDGET_LIST].left - 20, 0);
 		DrawString(x + 19, y + this->resize.step_height - 8, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, TC_FROMSTRING);
 
 		if (v->name != NULL) {
@@ -992,7 +993,7 @@
 		/* draw arrow pointing up/down for ascending/descending sorting */
 		this->DrawSortButtonState(VLW_WIDGET_SORT_ORDER, this->vehicles.IsDescSortOrder() ? SBS_DOWN : SBS_UP);
 
-		this->DrawVehicleListItems(x);
+		this->DrawVehicleListItems(x,  INVALID_VEHICLE);
 	}
 
 	virtual void OnClick(Point pt, int widget)
--- a/src/vehicle_gui_base.h	Mon Sep 15 08:37:40 2008 +0000
+++ b/src/vehicle_gui_base.h	Mon Sep 15 10:02:39 2008 +0000
@@ -30,7 +30,7 @@
 		this->vehicles.SetSortFuncs(this->vehicle_sorter_funcs);
 	}
 
-	void DrawVehicleListItems(int x);
+	void DrawVehicleListItems(int x, VehicleID selected_vehicle);
 	void SortVehicleList();
 	void BuildVehicleList(PlayerID owner, uint16 index, uint16 window_type);
 };