summaryrefslogtreecommitdiff
path: root/src/widgets
diff options
context:
space:
mode:
authorHenry Wilson <m3henry@googlemail.com>2019-02-17 11:20:52 +0000
committerPeterN <peter@fuzzle.org>2019-03-26 20:15:57 +0000
commitab711e6942757d775c08c31a6c32d488feba1dba (patch)
treed102dc6d0e6b9c33e7205b63e3360ebd720a3ebb /src/widgets
parent297fd3dda3abe353ebe2fe77c67b011e24d403bc (diff)
downloadopenttd-ab711e6942757d775c08c31a6c32d488feba1dba.tar.xz
Codechange: Replaced SmallVector::[Begin|End]() with std alternatives
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dropdown.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp
index 33d59effc..7c59cca7a 100644
--- a/src/widgets/dropdown.cpp
+++ b/src/widgets/dropdown.cpp
@@ -174,8 +174,7 @@ struct DropdownWindow : Window {
/* Total length of list */
int list_height = 0;
- for (const DropDownListItem * const *it = list->Begin(); it != list->End(); ++it) {
- const DropDownListItem *item = *it;
+ for (const DropDownListItem *item : *list) {
list_height += item->Height(items_width);
}
@@ -230,13 +229,10 @@ struct DropdownWindow : Window {
int width = nwi->current_x - 4;
int pos = this->vscroll->GetPosition();
- const DropDownList *list = this->list;
-
- for (const DropDownListItem * const *it = list->Begin(); it != list->End(); ++it) {
+ for (const DropDownListItem *item : *this->list) {
/* Skip items that are scrolled up */
if (--pos >= 0) continue;
- const DropDownListItem *item = *it;
int item_height = item->Height(width);
if (y < item_height) {
@@ -259,8 +255,7 @@ struct DropdownWindow : Window {
int y = r.top + 2;
int pos = this->vscroll->GetPosition();
- for (const DropDownListItem * const *it = this->list->Begin(); it != this->list->End(); ++it) {
- const DropDownListItem *item = *it;
+ for (const DropDownListItem *item : *this->list) {
int item_height = item->Height(r.right - r.left + 1);
/* Skip items that are scrolled up */
@@ -389,8 +384,7 @@ void ShowDropDownListAt(Window *w, const DropDownList *list, int selected, int b
/* Total height of list */
uint height = 0;
- for (const DropDownListItem * const *it = list->Begin(); it != list->End(); ++it) {
- const DropDownListItem *item = *it;
+ for (const DropDownListItem *item : *list) {
height += item->Height(width);
if (auto_width) max_item_width = max(max_item_width, item->Width() + 5);
}