mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
(svn r15377) -Fix [FS#2607]: filter did resort when unneeded and didn't deselect properly in some cases (Roujin)
This commit is contained in:
parent
e856287029
commit
9f1a20a2be
@ -279,15 +279,18 @@ class NetworkContentListWindow : public QueryStringBaseWindow, ContentCallback {
|
|||||||
{
|
{
|
||||||
if (!this->content.Filter(this->edit_str_buf)) return;
|
if (!this->content.Filter(this->edit_str_buf)) return;
|
||||||
|
|
||||||
this->selected = NULL;
|
/* update list position */
|
||||||
this->list_pos = 0;
|
|
||||||
|
|
||||||
for (ConstContentIterator iter = this->content.Begin(); iter != this->content.End(); iter++) {
|
for (ConstContentIterator iter = this->content.Begin(); iter != this->content.End(); iter++) {
|
||||||
if (*iter == this->selected) {
|
if (*iter == this->selected) {
|
||||||
this->list_pos = iter - this->content.Begin();
|
this->list_pos = iter - this->content.Begin();
|
||||||
break;
|
this->ScrollToSelected();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* previously selected item not in list anymore */
|
||||||
|
this->selected = NULL;
|
||||||
|
this->list_pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Make sure that the currently selected content info is within the visible part of the matrix */
|
/** Make sure that the currently selected content info is within the visible part of the matrix */
|
||||||
|
@ -321,16 +321,18 @@ public:
|
|||||||
/* Do not filter if the filter bit is not set */
|
/* Do not filter if the filter bit is not set */
|
||||||
if (!HASBITS(this->flags, VL_FILTER)) return false;
|
if (!HASBITS(this->flags, VL_FILTER)) return false;
|
||||||
|
|
||||||
|
bool changed = false;
|
||||||
for (uint iter = 0; iter < this->items;) {
|
for (uint iter = 0; iter < this->items;) {
|
||||||
T *item = &this->data[iter];
|
T *item = &this->data[iter];
|
||||||
if (!decide(item, filter_data)) {
|
if (!decide(item, filter_data)) {
|
||||||
this->Erase(item);
|
this->Erase(item);
|
||||||
|
changed = true;
|
||||||
} else {
|
} else {
|
||||||
iter++;
|
iter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user