diff options
author | Henry Wilson <m3henry@googlemail.com> | 2018-09-23 17:36:45 +0100 |
---|---|---|
committer | PeterN <peter@fuzzle.org> | 2019-03-26 20:15:57 +0000 |
commit | 81315939b909a95277ffbab51709714779089656 (patch) | |
tree | 9ee8bf1dc8e63cc0a44795ae6d23194d03bf6628 /src/train_gui.cpp | |
parent | f3938fdb838685e76bba78974bb6e90e9afc6e22 (diff) | |
download | openttd-81315939b909a95277ffbab51709714779089656.tar.xz |
Codechange: Replaced SmallVector::Find() non-const with std::find()
Diffstat (limited to 'src/train_gui.cpp')
-rw-r--r-- | src/train_gui.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/train_gui.cpp b/src/train_gui.cpp index 3c394ef19..eab6a33e3 100644 --- a/src/train_gui.cpp +++ b/src/train_gui.cpp @@ -174,6 +174,12 @@ struct CargoSummaryItem { { return this->cargo != other.cargo || this->subtype != other.subtype; } + + /** Used by std::find() and similar functions */ + inline bool operator == (const CargoSummaryItem &other) const + { + return !(this->cargo != other.cargo); + } }; static const uint TRAIN_DETAILS_MIN_INDENT = 32; ///< Minimum indent level in the train details window @@ -272,7 +278,7 @@ static void GetCargoSummaryOfArticulatedVehicle(const Train *v, CargoSummary *su new_item.subtype = GetCargoSubtypeText(v); if (new_item.cargo == INVALID_CARGO && new_item.subtype == STR_EMPTY) continue; - CargoSummaryItem *item = summary->Find(new_item); + CargoSummaryItem *item = &*std::find(summary->begin(), summary->end(), new_item); if (item == summary->End()) { item = summary->Append(); item->cargo = new_item.cargo; |