summaryrefslogtreecommitdiff
path: root/src/fios_gui.cpp
diff options
context:
space:
mode:
authorPeterN <peter1138@openttd.org>2021-04-29 22:46:42 +0100
committerGitHub <noreply@github.com>2021-04-29 22:46:42 +0100
commitf018471b36fe1ffaedf98430b4156ad369e26c66 (patch)
treee3636601a3463b81c6b14dc56dd344bb51d242fb /src/fios_gui.cpp
parent9a8756d7ed6fdde20bad9be8c8b8bc8fda0170f9 (diff)
downloadopenttd-f018471b36fe1ffaedf98430b4156ad369e26c66.tar.xz
Cleanup: Remove old FiosList helper methods. (#9139)
Diffstat (limited to 'src/fios_gui.cpp')
-rw-r--r--src/fios_gui.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp
index e1133dd3c..8de6235d6 100644
--- a/src/fios_gui.cpp
+++ b/src/fios_gui.cpp
@@ -249,8 +249,8 @@ static void SortSaveGameList(FileList &file_list)
* Drives (A:\ (windows only) are always under the files (FIOS_TYPE_DRIVE)
* Only sort savegames/scenarios, not directories
*/
- for (const FiosItem *item = file_list.Begin(); item != file_list.End(); item++) {
- switch (item->type) {
+ for (const auto &item : file_list) {
+ switch (item.type) {
case FIOS_TYPE_DIR: sort_start++; break;
case FIOS_TYPE_PARENT: sort_start++; break;
case FIOS_TYPE_DRIVE: sort_end++; break;
@@ -258,7 +258,7 @@ static void SortSaveGameList(FileList &file_list)
}
}
- std::sort(file_list.files.begin() + sort_start, file_list.files.end() - sort_end);
+ std::sort(file_list.begin() + sort_start, file_list.end() - sort_end);
}
struct SaveLoadWindow : public Window {
@@ -437,14 +437,14 @@ public:
uint y = r.top + WD_FRAMERECT_TOP;
uint scroll_pos = this->vscroll->GetPosition();
- for (uint row = 0; row < this->fios_items.Length(); row++) {
+ for (uint row = 0; row < this->fios_items.size(); row++) {
if (!this->fios_items_shown[row]) {
/* The current item is filtered out : we do not show it */
scroll_pos++;
continue;
}
if (row < scroll_pos) continue;
- const FiosItem *item = this->fios_items.Get(row);
+ const FiosItem *item = &this->fios_items[row];
if (item == this->selected) {
GfxFillRect(r.left + 1, y, r.right, y + this->resize.step_height, PC_DARK_BLUE);
@@ -651,7 +651,7 @@ public:
if (!this->fios_items_shown[i]) y++;
i++;
}
- const FiosItem *file = this->fios_items.Get(y);
+ const FiosItem *file = &this->fios_items[y];
const char *name = FiosBrowseTo(file);
if (name == nullptr) {
@@ -734,7 +734,7 @@ public:
if (!this->fios_items_shown[i]) y++;
i++;
}
- const FiosItem *file = this->fios_items.Get(y);
+ const FiosItem *file = &this->fios_items[y];
if (file != this->highlighted) {
this->highlighted = file;
@@ -812,7 +812,7 @@ public:
_fios_path_changed = true;
this->fios_items.BuildFileList(this->abstract_filetype, this->fop);
- this->vscroll->SetCount((uint)this->fios_items.Length());
+ this->vscroll->SetCount((uint)this->fios_items.size());
this->selected = nullptr;
_load_check_data.Clear();
@@ -852,10 +852,10 @@ public:
case SLIWD_FILTER_CHANGES:
/* Filter changes */
- this->fios_items_shown.resize(this->fios_items.Length());
+ this->fios_items_shown.resize(this->fios_items.size());
uint items_shown_count = 0; ///< The number of items shown in the list
/* We pass through every fios item */
- for (uint i = 0; i < this->fios_items.Length(); i++) {
+ for (uint i = 0; i < this->fios_items.size(); i++) {
if (this->string_filter.IsEmpty()) {
/* We don't filter anything out if the filter editbox is empty */
this->fios_items_shown[i] = true;