mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-02 09:40:35 +00:00
Codechange: Replaced SmallVector::Compact() with std::vector::shrink_to_fit()
This commit is contained in:
parent
bfd79e59dc
commit
9cba6f7193
@ -1345,7 +1345,7 @@ struct BuildVehicleWindow : Window {
|
||||
default: NOT_REACHED();
|
||||
case VEH_TRAIN:
|
||||
this->GenerateBuildTrainList();
|
||||
this->eng_list.Compact();
|
||||
this->eng_list.shrink_to_fit();
|
||||
this->eng_list.RebuildDone();
|
||||
return; // trains should not reach the last sorting
|
||||
case VEH_ROAD:
|
||||
@ -1364,7 +1364,7 @@ struct BuildVehicleWindow : Window {
|
||||
_engine_sort_direction = this->descending_sort_order;
|
||||
EngList_Sort(&this->eng_list, _engine_sort_functions[this->vehicle_type][this->sort_criteria]);
|
||||
|
||||
this->eng_list.Compact();
|
||||
this->eng_list.shrink_to_fit();
|
||||
this->eng_list.RebuildDone();
|
||||
}
|
||||
|
||||
|
@ -672,7 +672,7 @@ private:
|
||||
AddChildren(&list, INVALID_GROUP, 0);
|
||||
}
|
||||
|
||||
this->groups.Compact();
|
||||
this->groups.shrink_to_fit();
|
||||
this->groups.RebuildDone();
|
||||
}
|
||||
|
||||
|
@ -86,14 +86,6 @@ public:
|
||||
std::vector<T>::shrink_to_fit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Compact the list down to the smallest block size boundary.
|
||||
*/
|
||||
inline void Compact()
|
||||
{
|
||||
std::vector<T>::shrink_to_fit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Append an item and return it.
|
||||
* @param to_add the number of items to append
|
||||
|
@ -191,7 +191,7 @@ public:
|
||||
/** Compact the list down to the smallest block size boundary. */
|
||||
inline void Compact()
|
||||
{
|
||||
this->files.Compact();
|
||||
this->files.shrink_to_fit();
|
||||
}
|
||||
|
||||
void BuildFileList(AbstractFileType abstract_filetype, SaveLoadOperation fop);
|
||||
|
@ -1143,7 +1143,7 @@ private:
|
||||
*this->companies.Append() = c;
|
||||
}
|
||||
|
||||
this->companies.Compact();
|
||||
this->companies.shrink_to_fit();
|
||||
this->companies.RebuildDone();
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ private:
|
||||
|
||||
AddChildren(&list, INVALID_GROUP, 0);
|
||||
|
||||
this->groups.Compact();
|
||||
this->groups.shrink_to_fit();
|
||||
this->groups.RebuildDone();
|
||||
}
|
||||
|
||||
|
@ -1209,7 +1209,7 @@ protected:
|
||||
*this->industries.Append() = i;
|
||||
}
|
||||
|
||||
this->industries.Compact();
|
||||
this->industries.shrink_to_fit();
|
||||
this->industries.RebuildDone();
|
||||
this->vscroll->SetCount(this->industries.Length()); // Update scrollbar as well.
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ class NetworkContentListWindow : public Window, ContentCallback {
|
||||
this->SetWidgetDisabledState(WID_NCL_SEARCH_EXTERNAL, this->auto_select && all_available);
|
||||
|
||||
this->FilterContentList();
|
||||
this->content.Compact();
|
||||
this->content.shrink_to_fit();
|
||||
this->content.RebuildDone();
|
||||
this->SortContentList();
|
||||
|
||||
|
@ -267,7 +267,7 @@ protected:
|
||||
this->servers.SetFilterState(false);
|
||||
}
|
||||
|
||||
this->servers.Compact();
|
||||
this->servers.shrink_to_fit();
|
||||
this->servers.RebuildDone();
|
||||
this->vscroll->SetCount(this->servers.Length());
|
||||
|
||||
|
@ -1481,7 +1481,7 @@ private:
|
||||
}
|
||||
|
||||
this->avails.Filter(this->string_filter);
|
||||
this->avails.Compact();
|
||||
this->avails.shrink_to_fit();
|
||||
this->avails.RebuildDone();
|
||||
this->avails.Sort();
|
||||
|
||||
|
@ -67,7 +67,7 @@ struct SignList {
|
||||
|
||||
this->signs.SetFilterState(true);
|
||||
this->FilterSignList();
|
||||
this->signs.Compact();
|
||||
this->signs.shrink_to_fit();
|
||||
this->signs.RebuildDone();
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
this->stations.Compact();
|
||||
this->stations.shrink_to_fit();
|
||||
this->stations.RebuildDone();
|
||||
|
||||
this->vscroll->SetCount(this->stations.Length()); // Update the scrollbar
|
||||
|
@ -61,7 +61,7 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
this->story_pages.Compact();
|
||||
this->story_pages.shrink_to_fit();
|
||||
this->story_pages.RebuildDone();
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
this->story_page_elements.Compact();
|
||||
this->story_page_elements.shrink_to_fit();
|
||||
this->story_page_elements.RebuildDone();
|
||||
}
|
||||
|
||||
|
@ -657,7 +657,7 @@ private:
|
||||
*this->towns.Append() = t;
|
||||
}
|
||||
|
||||
this->towns.Compact();
|
||||
this->towns.shrink_to_fit();
|
||||
this->towns.RebuildDone();
|
||||
this->vscroll->SetCount(this->towns.Length()); // Update scrollbar as well.
|
||||
}
|
||||
|
@ -103,8 +103,8 @@ void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engine
|
||||
|
||||
/* Ensure the lists are not wasting too much space. If the lists are fresh
|
||||
* (i.e. built within a command) then this will actually do nothing. */
|
||||
engines->Compact();
|
||||
if (wagons != NULL && wagons != engines) wagons->Compact();
|
||||
engines->shrink_to_fit();
|
||||
if (wagons != NULL && wagons != engines) wagons->shrink_to_fit();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -184,6 +184,6 @@ bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &vli
|
||||
default: return false;
|
||||
}
|
||||
|
||||
list->Compact();
|
||||
list->shrink_to_fit();
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user