1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-23 12:14:11 +01:00

Codechange: Use default operator<=> to compare Linkgraph Hop. (#13944)

This commit is contained in:
Peter Nelson
2025-04-02 23:00:06 +01:00
committed by GitHub
parent 2f36e3e3a1
commit 33a8c1c6fc
2 changed files with 2 additions and 21 deletions

View File

@@ -38,26 +38,6 @@
refresher.RefreshLinks(first, first, v->last_loading_station != StationID::Invalid() ? RefreshFlags{RefreshFlag::HasCargo} : RefreshFlags{});
}
/**
* Comparison operator to allow hops to be used in a std::set.
* @param other Other hop to be compared with.
* @return If this hop is "smaller" than the other (defined by from, to and cargo in this order).
*/
bool LinkRefresher::Hop::operator<(const Hop &other) const
{
if (this->from < other.from) {
return true;
} else if (this->from > other.from) {
return false;
}
if (this->to < other.to) {
return true;
} else if (this->to > other.to) {
return false;
}
return this->cargo < other.cargo;
}
/**
* Constructor for link refreshing algorithm.
* @param vehicle Vehicle to refresh links for.