From 3b36f3167216fdc2eb15ca6ee68fa286f8ac975e Mon Sep 17 00:00:00 2001 From: Henry Wilson Date: Sat, 30 Dec 2017 23:34:41 +0000 Subject: [PATCH 09/31] SmallIndustryList ~> std::vector --- src/economy.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/economy.cpp b/src/economy.cpp index 0106e87e1..30584928f 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -77,7 +77,7 @@ static inline int32 BigMulS(const int32 a, const int32 b, const uint8 shift) return (int32)((int64)a * (int64)b >> shift); } -typedef SmallVector SmallIndustryList; +using SmallIndustryList = std::vector ; /** * Score info, values used for computing the detailed performance rating. @@ -1058,7 +1058,7 @@ static uint DeliverGoodsToIndustry(const Station *st, CargoID cargo_type, uint n if (IndustryTemporarilyRefusesCargo(ind, cargo_type)) continue; /* Insert the industry into _cargo_delivery_destinations, if not yet contained */ - _cargo_delivery_destinations.Include(ind); + Include(_cargo_delivery_destinations, ind); uint amount = min(num_pieces, 0xFFFFU - ind->incoming_cargo_waiting[cargo_index]); ind->incoming_cargo_waiting[cargo_index] += amount; @@ -1931,11 +1931,8 @@ void LoadUnloadStation(Station *st) } /* Call the production machinery of industries */ - const Industry * const *isend = _cargo_delivery_destinations.End(); - for (Industry **iid = _cargo_delivery_destinations.Begin(); iid != isend; iid++) { - TriggerIndustryProduction(*iid); - } - _cargo_delivery_destinations.Clear(); + for (const auto &iid : _cargo_delivery_destinations) TriggerIndustryProduction(iid); + _cargo_delivery_destinations.clear(); } /** -- 2.14.1