src/bridge_gui.cpp
branchNewGRF_ports
changeset 10994 cd9968b6f96b
parent 10731 67db0d431d5e
equal deleted inserted replaced
10991:d8811e327d12 10994:cd9968b6f96b
   117 		type(br_type),
   117 		type(br_type),
   118 		bridges(bl)
   118 		bridges(bl)
   119 	{
   119 	{
   120 		this->bridges->SetListing(this->last_sorting);
   120 		this->bridges->SetListing(this->last_sorting);
   121 		this->bridges->SetSortFuncs(this->sorter_funcs);
   121 		this->bridges->SetSortFuncs(this->sorter_funcs);
       
   122 		this->bridges->NeedResort();
   122 		this->SortBridgeList();
   123 		this->SortBridgeList();
   123 
   124 
   124 		/* Change the data, or the caption of the gui. Set it to road or rail, accordingly */
   125 		/* Change the data, or the caption of the gui. Set it to road or rail, accordingly */
   125 		this->widget[BBSW_CAPTION].data = (GB(this->type, 15, 2) == TRANSPORT_ROAD) ? STR_1803_SELECT_ROAD_BRIDGE : STR_100D_SELECT_RAIL_BRIDGE;
   126 		this->widget[BBSW_CAPTION].data = (GB(this->type, 15, 2) == TRANSPORT_ROAD) ? STR_1803_SELECT_ROAD_BRIDGE : STR_100D_SELECT_RAIL_BRIDGE;
   126 
   127 
   148 
   149 
   149 	virtual void OnPaint()
   150 	virtual void OnPaint()
   150 	{
   151 	{
   151 		this->DrawWidgets();
   152 		this->DrawWidgets();
   152 
   153 
   153 		this->DrawSortButtonState(BBSW_DROPDOWN_ORDER, (this->bridges->flags & VL_DESC) ? SBS_DOWN : SBS_UP);
   154 		this->DrawSortButtonState(BBSW_DROPDOWN_ORDER, this->bridges->IsDescSortOrder() ? SBS_DOWN : SBS_UP);
   154 
   155 
   155 		uint y = this->widget[BBSW_BRIDGE_LIST].top + 2;
   156 		uint y = this->widget[BBSW_BRIDGE_LIST].top + 2;
   156 
   157 
   157 		for (int i = this->vscroll.pos; (i < (this->vscroll.cap + this->vscroll.pos)) && (i < (int)this->bridges->Length()); i++) {
   158 		for (int i = this->vscroll.pos; (i < (this->vscroll.cap + this->vscroll.pos)) && (i < (int)this->bridges->Length()); i++) {
   158 			const BridgeSpec *b = this->bridges->Get(i)->spec;
   159 			const BridgeSpec *b = this->bridges->Get(i)->spec;