Codechange: Remove min/max functions in favour of STL variants (#8502)

This commit is contained in:
Charles Pigott
2021-01-08 10:16:18 +00:00
committed by GitHub
parent c1fddb9a6a
commit 9b800a96ed
181 changed files with 900 additions and 954 deletions

View File

@@ -224,7 +224,7 @@ void LinkGraphOverlay::AddLinks(const Station *from, const Station *to)
{
/* multiply the numbers by 32 in order to avoid comparing to 0 too often. */
if (cargo.capacity == 0 ||
max(cargo.usage, cargo.planned) * 32 / (cargo.capacity + 1) < max(new_usg, new_plan) * 32 / (new_cap + 1)) {
std::max(cargo.usage, cargo.planned) * 32 / (cargo.capacity + 1) < std::max(new_usg, new_plan) * 32 / (new_cap + 1)) {
cargo.capacity = new_cap;
cargo.usage = new_usg;
cargo.planned = new_plan;
@@ -272,7 +272,7 @@ void LinkGraphOverlay::DrawLinks(const DrawPixelInfo *dpi) const
*/
void LinkGraphOverlay::DrawContent(Point pta, Point ptb, const LinkProperties &cargo) const
{
uint usage_or_plan = min(cargo.capacity * 2 + 1, max(cargo.usage, cargo.planned));
uint usage_or_plan = std::min(cargo.capacity * 2 + 1, std::max(cargo.usage, cargo.planned));
int colour = LinkGraphOverlay::LINK_COLOURS[usage_or_plan * lengthof(LinkGraphOverlay::LINK_COLOURS) / (cargo.capacity * 2 + 2)];
int dash = cargo.shared ? this->scale * 4 : 0;
@@ -302,7 +302,7 @@ void LinkGraphOverlay::DrawStationDots(const DrawPixelInfo *dpi) const
Point pt = this->GetStationMiddle(st);
if (!this->IsPointVisible(pt, dpi, 3 * this->scale)) continue;
uint r = this->scale * 2 + this->scale * 2 * min(200, i->second) / 200;
uint r = this->scale * 2 + this->scale * 2 * std::min(200U, i->second) / 200;
LinkGraphOverlay::DrawVertex(pt.x, pt.y, r,
_colour_gradient[st->owner != OWNER_NONE ?