diff options
author | Henry Wilson <m3henry@googlemail.com> | 2019-02-20 19:27:10 +0000 |
---|---|---|
committer | PeterN <peter@fuzzle.org> | 2019-03-26 20:15:57 +0000 |
commit | 2bc2de9034d3b75a253b849cf7a703b1a503e200 (patch) | |
tree | 39f3a8e94a6f993f20dbbf027b6cdd684ab4ce4c /src/network/network_content_gui.cpp | |
parent | e0c58bf5ee0f3f4d0563a04de315c09b37f74c6e (diff) | |
download | openttd-2bc2de9034d3b75a253b849cf7a703b1a503e200.tar.xz |
Codechange: Replaced SmallVector::Find() with std::find()
Diffstat (limited to 'src/network/network_content_gui.cpp')
-rw-r--r-- | src/network/network_content_gui.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index 19c075258..b7237cadd 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -435,12 +435,8 @@ class NetworkContentListWindow : public Window, ContentCallback { { if (!this->content.Sort()) return; - for (ConstContentIterator iter = this->content.Begin(); iter != this->content.End(); iter++) { - if (*iter == this->selected) { - this->list_pos = iter - this->content.Begin(); - break; - } - } + int idx = find_index(this->content, this->selected); + if (idx >= 0) this->list_pos = idx; } /** Filter content by tags/name */ @@ -478,11 +474,10 @@ class NetworkContentListWindow : public Window, ContentCallback { if (!changed) return; /* update list position */ - for (ConstContentIterator iter = this->content.Begin(); iter != this->content.End(); iter++) { - if (*iter == this->selected) { - this->list_pos = iter - this->content.Begin(); - return; - } + int idx = find_index(this->content, this->selected); + if (idx >= 0) { + this->list_pos = idx; + return; } /* previously selected item not in list anymore */ |