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/cargopacket.cpp | |
parent | c1fddb9a6ae5c3af6865461a7295788a341011a2 (diff) | |
download | openttd-9b800a96ed32720ff60b74e498a0e0a6351004f9.tar.xz |
Codechange: Remove min/max functions in favour of STL variants (#8502)
Diffstat (limited to 'src/cargopacket.cpp')
-rw-r--r-- | src/cargopacket.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/cargopacket.cpp b/src/cargopacket.cpp index eafab6880..86bba0261 100644 --- a/src/cargopacket.cpp +++ b/src/cargopacket.cpp @@ -558,7 +558,7 @@ uint VehicleCargoList::Reassign(uint max_move, TileOrStationID) { static_assert(Tfrom != MTA_TRANSFER && Tto != MTA_TRANSFER); static_assert(Tfrom - Tto == 1 || Tto - Tfrom == 1); - max_move = min(this->action_counts[Tfrom], max_move); + max_move = std::min(this->action_counts[Tfrom], max_move); this->action_counts[Tfrom] -= max_move; this->action_counts[Tto] += max_move; return max_move; @@ -574,7 +574,7 @@ uint VehicleCargoList::Reassign(uint max_move, TileOrStationID) template<> uint VehicleCargoList::Reassign<VehicleCargoList::MTA_DELIVER, VehicleCargoList::MTA_TRANSFER>(uint max_move, TileOrStationID next_station) { - max_move = min(this->action_counts[MTA_DELIVER], max_move); + max_move = std::min(this->action_counts[MTA_DELIVER], max_move); uint sum = 0; for (Iterator it(this->packets.begin()); sum < this->action_counts[MTA_TRANSFER] + max_move;) { @@ -603,7 +603,7 @@ uint VehicleCargoList::Reassign<VehicleCargoList::MTA_DELIVER, VehicleCargoList: */ uint VehicleCargoList::Return(uint max_move, StationCargoList *dest, StationID next) { - max_move = min(this->action_counts[MTA_LOAD], max_move); + max_move = std::min(this->action_counts[MTA_LOAD], max_move); this->PopCargo(CargoReturn(this, dest, max_move, next)); return max_move; } @@ -616,7 +616,7 @@ uint VehicleCargoList::Return(uint max_move, StationCargoList *dest, StationID n */ uint VehicleCargoList::Shift(uint max_move, VehicleCargoList *dest) { - max_move = min(this->count, max_move); + max_move = std::min(this->count, max_move); this->PopCargo(CargoShift(this, dest, max_move)); return max_move; } @@ -633,12 +633,12 @@ uint VehicleCargoList::Unload(uint max_move, StationCargoList *dest, CargoPaymen { uint moved = 0; if (this->action_counts[MTA_TRANSFER] > 0) { - uint move = min(this->action_counts[MTA_TRANSFER], max_move); + uint move = std::min(this->action_counts[MTA_TRANSFER], max_move); this->ShiftCargo(CargoTransfer(this, dest, move)); moved += move; } if (this->action_counts[MTA_TRANSFER] == 0 && this->action_counts[MTA_DELIVER] > 0 && moved < max_move) { - uint move = min(this->action_counts[MTA_DELIVER], max_move - moved); + uint move = std::min(this->action_counts[MTA_DELIVER], max_move - moved); this->ShiftCargo(CargoDelivery(this, move, payment)); moved += move; } @@ -653,7 +653,7 @@ uint VehicleCargoList::Unload(uint max_move, StationCargoList *dest, CargoPaymen */ uint VehicleCargoList::Truncate(uint max_move) { - max_move = min(this->count, max_move); + max_move = std::min(this->count, max_move); this->PopCargo(CargoRemoval<VehicleCargoList>(this, max_move)); return max_move; } @@ -668,7 +668,7 @@ uint VehicleCargoList::Truncate(uint max_move) */ uint VehicleCargoList::Reroute(uint max_move, VehicleCargoList *dest, StationID avoid, StationID avoid2, const GoodsEntry *ge) { - max_move = min(this->action_counts[MTA_TRANSFER], max_move); + max_move = std::min(this->action_counts[MTA_TRANSFER], max_move); this->ShiftCargo(VehicleCargoReroute(this, dest, max_move, avoid, avoid2, ge)); return max_move; } @@ -768,7 +768,7 @@ uint StationCargoList::ShiftCargo(Taction action, StationIDStack next, bool incl */ uint StationCargoList::Truncate(uint max_move, StationCargoAmountMap *cargo_per_source) { - max_move = min(max_move, this->count); + max_move = std::min(max_move, this->count); uint prev_count = this->count; uint moved = 0; uint loop = 0; @@ -839,7 +839,7 @@ uint StationCargoList::Reserve(uint max_move, VehicleCargoList *dest, TileIndex */ uint StationCargoList::Load(uint max_move, VehicleCargoList *dest, TileIndex load_place, StationIDStack next_station) { - uint move = min(dest->ActionCount(VehicleCargoList::MTA_LOAD), max_move); + uint move = std::min(dest->ActionCount(VehicleCargoList::MTA_LOAD), max_move); if (move > 0) { this->reserved_count -= move; dest->Reassign<VehicleCargoList::MTA_LOAD, VehicleCargoList::MTA_KEEP>(move); |