diff options
author | Charles Pigott <charlespigott@googlemail.com> | 2021-01-08 10:16:18 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-08 11:16:18 +0100 |
commit | 9b800a96ed32720ff60b74e498a0e0a6351004f9 (patch) | |
tree | 3f287d339e15c4902ee415556475fd9b2918d33c /src/linkgraph/linkgraph.cpp | |
parent | c1fddb9a6ae5c3af6865461a7295788a341011a2 (diff) | |
download | openttd-9b800a96ed32720ff60b74e498a0e0a6351004f9.tar.xz |
Codechange: Remove min/max functions in favour of STL variants (#8502)
Diffstat (limited to 'src/linkgraph/linkgraph.cpp')
-rw-r--r-- | src/linkgraph/linkgraph.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/linkgraph/linkgraph.cpp b/src/linkgraph/linkgraph.cpp index 5185d07b7..93af907fc 100644 --- a/src/linkgraph/linkgraph.cpp +++ b/src/linkgraph/linkgraph.cpp @@ -71,7 +71,7 @@ void LinkGraph::Compress() for (NodeID node2 = 0; node2 < this->Size(); ++node2) { BaseEdge &edge = this->edges[node1][node2]; if (edge.capacity > 0) { - edge.capacity = max(1U, edge.capacity / 2); + edge.capacity = std::max(1U, edge.capacity / 2); edge.usage /= 2; } } @@ -163,8 +163,7 @@ NodeID LinkGraph::AddNode(const Station *st) this->nodes.emplace_back(); /* Avoid reducing the height of the matrix as that is expensive and we * most likely will increase it again later which is again expensive. */ - this->edges.Resize(new_node + 1U, - max(new_node + 1U, this->edges.Height())); + this->edges.Resize(new_node + 1U, std::max(new_node + 1U, this->edges.Height())); this->nodes[new_node].Init(st->xy, st->index, HasBit(good.status, GoodsEntry::GES_ACCEPTANCE)); @@ -266,8 +265,8 @@ void LinkGraph::Edge::Update(uint capacity, uint usage, EdgeUpdateMode mode) this->edge.capacity += capacity; this->edge.usage += usage; } else if (mode & EUM_REFRESH) { - this->edge.capacity = max(this->edge.capacity, capacity); - this->edge.usage = max(this->edge.usage, usage); + this->edge.capacity = std::max(this->edge.capacity, capacity); + this->edge.usage = std::max(this->edge.usage, usage); } if (mode & EUM_UNRESTRICTED) this->edge.last_unrestricted_update = _date; if (mode & EUM_RESTRICTED) this->edge.last_restricted_update = _date; |