Merge branch upstream/master

This commit is contained in:
Sergii Pylypenko
2021-11-28 03:16:36 +02:00
326 changed files with 9186 additions and 8099 deletions

View File

@@ -256,8 +256,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;
@@ -265,7 +265,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 {
@@ -445,14 +445,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);
@@ -659,7 +659,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) {
@@ -762,7 +762,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;
@@ -840,7 +840,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();
@@ -880,10 +880,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;