(svn r20777) -Codechange: make VehicleListIdentifier a variable of BaseVehicleList and use that instead of "dereferencing" the window number and storing some information twice

This commit is contained in:
rubidium
2010-09-09 14:40:39 +00:00
parent 7d00b403c2
commit 713165fba9
3 changed files with 88 additions and 112 deletions

View File

@@ -22,9 +22,9 @@ typedef GUIList<const Vehicle*> GUIVehicleList;
struct BaseVehicleListWindow : public Window {
GUIVehicleList vehicles; ///< The list of vehicles
Listing *sorting; ///< Pointer to the vehicle type related sorting.
VehicleType vehicle_type; ///< The vehicle type that is sorted
byte unitnumber_digits; ///< The number of digits of the highest unit number
Scrollbar *vscroll;
VehicleListIdentifier vli; ///< Identifier of the vehicle list we want to currently show.
enum ActionDropdownItem {
ADI_REPLACE,
@@ -38,14 +38,14 @@ struct BaseVehicleListWindow : public Window {
static const StringID vehicle_sorter_names[];
static GUIVehicleList::SortFunction * const vehicle_sorter_funcs[];
BaseVehicleListWindow() : Window()
BaseVehicleListWindow(WindowNumber wno) : Window(), vli(wno)
{
this->vehicles.SetSortFuncs(this->vehicle_sorter_funcs);
}
void DrawVehicleListItems(VehicleID selected_vehicle, int line_height, const Rect &r) const;
void SortVehicleList();
void BuildVehicleList(const VehicleListIdentifier &identifier);
void BuildVehicleList();
Dimension GetActionDropdownSize(bool show_autoreplace, bool show_group);
DropDownList *BuildActionDropdownList(bool show_autoreplace, bool show_group);
};