Codechange: Replace SmallVector::Length() with std::vector::size()
This commit is contained in:
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user