summaryrefslogtreecommitdiff
path: root/src/build_vehicle_gui.cpp
diff options
context:
space:
mode:
authorHenry Wilson <m3henry@googlemail.com>2018-09-23 12:23:54 +0100
committerPeterN <peter@fuzzle.org>2019-03-26 20:15:57 +0000
commita690936ed75e96627be0e2ecafee2360a71e8d3c (patch)
tree1221c131b8fe3a51cf43a6bd7d89a51c431c559d /src/build_vehicle_gui.cpp
parent56ae855dc20b27593c9a454d5a09d8f892a6c71f (diff)
downloadopenttd-a690936ed75e96627be0e2ecafee2360a71e8d3c.tar.xz
Codechange: Replace SmallVector::Length() with std::vector::size()
Diffstat (limited to 'src/build_vehicle_gui.cpp')
-rw-r--r--src/build_vehicle_gui.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index f580ba7a9..ce3ebeff4 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -940,7 +940,7 @@ void DrawEngineList(VehicleType type, int l, int r, int y, const GUIEngineList *
static const int sprite_y_offsets[] = { -1, -1, -2, -2 };
/* Obligatory sanity checks! */
- assert(max <= eng_list->Length());
+ assert(max <= eng_list->size());
bool rtl = _current_text_dir == TD_RTL;
int step_size = GetEngineListHeight(type);
@@ -1110,7 +1110,7 @@ struct BuildVehicleWindow : Window {
this->eng_list.ForceRebuild();
this->GenerateBuildList(); // generate the list, since we need it in the next line
/* Select the first engine in the list as default when opening the window */
- if (this->eng_list.Length() > 0) {
+ if (this->eng_list.size() > 0) {
this->SelectEngine(this->eng_list[0]);
} else {
this->SelectEngine(INVALID_ENGINE);
@@ -1205,7 +1205,7 @@ struct BuildVehicleWindow : Window {
void FilterEngineList()
{
this->eng_list.Filter(this->cargo_filter[this->cargo_filter_criteria]);
- if (0 == this->eng_list.Length()) { // no engine passed through the filter, invalidate the previously selected engine
+ if (0 == this->eng_list.size()) { // no engine passed through the filter, invalidate the previously selected engine
this->SelectEngine(INVALID_ENGINE);
} else if (!this->eng_list.Contains(this->sel_engine)) { // previously selected engine didn't pass the filter, select the first engine of the list
this->SelectEngine(this->eng_list[0]);
@@ -1388,7 +1388,7 @@ struct BuildVehicleWindow : Window {
case WID_BV_LIST: {
uint i = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_BV_LIST);
- size_t num_items = this->eng_list.Length();
+ size_t num_items = this->eng_list.size();
this->SelectEngine((i < num_items) ? this->eng_list[i] : INVALID_ENGINE);
this->SetDirty();
if (_ctrl_pressed) {
@@ -1529,7 +1529,7 @@ struct BuildVehicleWindow : Window {
{
switch (widget) {
case WID_BV_LIST:
- DrawEngineList(this->vehicle_type, r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, &this->eng_list, this->vscroll->GetPosition(), min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->eng_list.Length()), this->sel_engine, false, DEFAULT_GROUP);
+ DrawEngineList(this->vehicle_type, r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, &this->eng_list, this->vscroll->GetPosition(), min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->eng_list.size()), this->sel_engine, false, DEFAULT_GROUP);
break;
case WID_BV_SORT_ASCENDING_DESCENDING:
@@ -1541,7 +1541,7 @@ struct BuildVehicleWindow : Window {
void OnPaint() override
{
this->GenerateBuildList();
- this->vscroll->SetCount(this->eng_list.Length());
+ this->vscroll->SetCount(this->eng_list.size());
this->SetWidgetsDisabledState(this->sel_engine == INVALID_ENGINE, WID_BV_SHOW_HIDE, WID_BV_BUILD, WID_BV_RENAME, WIDGET_LIST_END);