summaryrefslogtreecommitdiff
path: root/src/depot_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/depot_gui.cpp
parent56ae855dc20b27593c9a454d5a09d8f892a6c71f (diff)
downloadopenttd-a690936ed75e96627be0e2ecafee2360a71e8d3c.tar.xz
Codechange: Replace SmallVector::Length() with std::vector::size()
Diffstat (limited to 'src/depot_gui.cpp')
-rw-r--r--src/depot_gui.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index f2da7330e..2b5879116 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -398,7 +398,7 @@ struct DepotWindow : Window {
uint16 rows_in_display = wid->current_y / wid->resize_y;
uint16 num = this->vscroll->GetPosition() * this->num_columns;
- int maxval = min(this->vehicle_list.Length(), num + (rows_in_display * this->num_columns));
+ int maxval = min(this->vehicle_list.size(), num + (rows_in_display * this->num_columns));
int y;
for (y = r.top + 1; num < maxval; y += this->resize.step_height) { // Draw the rows
for (byte i = 0; i < this->num_columns && num < maxval; i++, num++) {
@@ -413,11 +413,11 @@ struct DepotWindow : Window {
}
}
- maxval = min(this->vehicle_list.Length() + this->wagon_list.Length(), (this->vscroll->GetPosition() * this->num_columns) + (rows_in_display * this->num_columns));
+ maxval = min(this->vehicle_list.size() + this->wagon_list.size(), (this->vscroll->GetPosition() * this->num_columns) + (rows_in_display * this->num_columns));
/* Draw the train wagons without an engine in front. */
for (; num < maxval; num++, y += this->resize.step_height) {
- const Vehicle *v = this->wagon_list[num - this->vehicle_list.Length()];
+ const Vehicle *v = this->wagon_list[num - this->vehicle_list.size()];
this->DrawVehicleInDepot(v, r.left, r.right, y);
}
}
@@ -465,7 +465,7 @@ struct DepotWindow : Window {
uint pos = ((row + this->vscroll->GetPosition()) * this->num_columns) + xt;
- if (this->vehicle_list.Length() + this->wagon_list.Length() <= pos) {
+ if (this->vehicle_list.size() + this->wagon_list.size() <= pos) {
/* Clicking on 'line' / 'block' without a vehicle */
if (this->type == VEH_TRAIN) {
/* End the dragging */
@@ -478,12 +478,12 @@ struct DepotWindow : Window {
}
bool wagon = false;
- if (this->vehicle_list.Length() > pos) {
+ if (this->vehicle_list.size() > pos) {
*veh = this->vehicle_list[pos];
/* Skip vehicles that are scrolled off the list */
if (this->type == VEH_TRAIN) x += this->hscroll->GetPosition();
} else {
- pos -= this->vehicle_list.Length();
+ pos -= this->vehicle_list.size();
*veh = this->wagon_list[pos];
/* free wagons don't have an initial loco. */
x -= ScaleGUITrad(VEHICLEINFO_FULL_VEHICLE_WIDTH);
@@ -726,7 +726,7 @@ struct DepotWindow : Window {
/* determine amount of items for scroller */
if (this->type == VEH_TRAIN) {
uint max_width = ScaleGUITrad(VEHICLEINFO_FULL_VEHICLE_WIDTH);
- for (uint num = 0; num < this->vehicle_list.Length(); num++) {
+ for (uint num = 0; num < this->vehicle_list.size(); num++) {
uint width = 0;
for (const Train *v = Train::From(this->vehicle_list[num]); v != NULL; v = v->Next()) {
width += v->GetDisplayImageWidth();
@@ -734,11 +734,11 @@ struct DepotWindow : Window {
max_width = max(max_width, width);
}
/* Always have 1 empty row, so people can change the setting of the train */
- this->vscroll->SetCount(this->vehicle_list.Length() + this->wagon_list.Length() + 1);
+ this->vscroll->SetCount(this->vehicle_list.size() + this->wagon_list.size() + 1);
/* Always make it longer than the longest train, so you can attach vehicles at the end, and also see the next vertical tile separator line */
this->hscroll->SetCount(max_width + ScaleGUITrad(2 * VEHICLEINFO_FULL_VEHICLE_WIDTH + 1));
} else {
- this->vscroll->SetCount(CeilDiv(this->vehicle_list.Length(), this->num_columns));
+ this->vscroll->SetCount(CeilDiv(this->vehicle_list.size(), this->num_columns));
}
/* Setup disabled buttons. */
@@ -811,7 +811,7 @@ struct DepotWindow : Window {
case WID_D_SELL_ALL:
/* Only open the confirmation window if there are anything to sell */
- if (this->vehicle_list.Length() != 0 || this->wagon_list.Length() != 0) {
+ if (this->vehicle_list.size() != 0 || this->wagon_list.size() != 0) {
TileIndex tile = this->window_number;
byte vehtype = this->type;