Cleanup: Remove old FiosList helper methods. (#9139)

(cherry-picked from commit f018471b36)
This commit is contained in:
PeterN
2021-04-29 22:46:42 +01:00
committed by Jonathan G Rennison
parent 050b95e351
commit 9d72eb02f5
5 changed files with 30 additions and 117 deletions

View File

@@ -252,8 +252,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;
@@ -261,7 +261,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);
}
void SaveGameConfirmationCallback(Window *w, bool confirmed);
@@ -442,14 +442,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);
@@ -667,7 +667,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) {
@@ -750,7 +750,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;
@@ -834,7 +834,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();
@@ -874,10 +874,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;