Mercurial > hg > openttd
comparison src/vehicle_gui.cpp @ 10143:a2e7b550afee draft
(svn r14329) -Fix (r14306): selections in the group GUI weren't shown anymore.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Mon, 15 Sep 2008 10:02:39 +0000 |
parents | dff578338ffb |
children | dbe302da93a8 |
comparison
equal
deleted
inserted
replaced
10142:9bef593b6319 | 10143:a2e7b550afee |
---|---|
739 } | 739 } |
740 | 740 |
741 /** | 741 /** |
742 * Draw all the vehicle list items. | 742 * Draw all the vehicle list items. |
743 * @param x the position from where to draw the items. | 743 * @param x the position from where to draw the items. |
744 * @param selected_vehicle the vehicle that is to be selected | |
744 */ | 745 */ |
745 void BaseVehicleListWindow::DrawVehicleListItems(int x) | 746 void BaseVehicleListWindow::DrawVehicleListItems(int x, VehicleID selected_vehicle) |
746 { | 747 { |
747 int y = PLY_WND_PRC__OFFSET_TOP_WIDGET; | 748 int y = PLY_WND_PRC__OFFSET_TOP_WIDGET; |
748 uint max = min(this->vscroll.pos + this->vscroll.cap, this->vehicles.Length()); | 749 uint max = min(this->vscroll.pos + this->vscroll.cap, this->vehicles.Length()); |
749 for (uint i = this->vscroll.pos; i < max; ++i) { | 750 for (uint i = this->vscroll.pos; i < max; ++i) { |
750 const Vehicle *v = this->vehicles[i]; | 751 const Vehicle *v = this->vehicles[i]; |
751 StringID str; | 752 StringID str; |
752 | 753 |
753 SetDParam(0, v->GetDisplayProfitThisYear()); | 754 SetDParam(0, v->GetDisplayProfitThisYear()); |
754 SetDParam(1, v->GetDisplayProfitLastYear()); | 755 SetDParam(1, v->GetDisplayProfitLastYear()); |
755 | 756 |
756 DrawVehicleImage(v, x + 19, y + 6, INVALID_VEHICLE, this->widget[VLW_WIDGET_LIST].right - this->widget[VLW_WIDGET_LIST].left - 20, 0); | 757 DrawVehicleImage(v, x + 19, y + 6, selected_vehicle, this->widget[VLW_WIDGET_LIST].right - this->widget[VLW_WIDGET_LIST].left - 20, 0); |
757 DrawString(x + 19, y + this->resize.step_height - 8, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, TC_FROMSTRING); | 758 DrawString(x + 19, y + this->resize.step_height - 8, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, TC_FROMSTRING); |
758 | 759 |
759 if (v->name != NULL) { | 760 if (v->name != NULL) { |
760 /* The vehicle got a name so we will print it */ | 761 /* The vehicle got a name so we will print it */ |
761 SetDParam(0, v->index); | 762 SetDParam(0, v->index); |
990 /* draw sorting criteria string */ | 991 /* draw sorting criteria string */ |
991 DrawString(85, 15, this->vehicle_sorter_names[this->vehicles.SortType()], TC_BLACK); | 992 DrawString(85, 15, this->vehicle_sorter_names[this->vehicles.SortType()], TC_BLACK); |
992 /* draw arrow pointing up/down for ascending/descending sorting */ | 993 /* draw arrow pointing up/down for ascending/descending sorting */ |
993 this->DrawSortButtonState(VLW_WIDGET_SORT_ORDER, this->vehicles.IsDescSortOrder() ? SBS_DOWN : SBS_UP); | 994 this->DrawSortButtonState(VLW_WIDGET_SORT_ORDER, this->vehicles.IsDescSortOrder() ? SBS_DOWN : SBS_UP); |
994 | 995 |
995 this->DrawVehicleListItems(x); | 996 this->DrawVehicleListItems(x, INVALID_VEHICLE); |
996 } | 997 } |
997 | 998 |
998 virtual void OnClick(Point pt, int widget) | 999 virtual void OnClick(Point pt, int widget) |
999 { | 1000 { |
1000 switch (widget) { | 1001 switch (widget) { |