From f373bbba5669e469deb0e2987740f9c77cf778b0 Mon Sep 17 00:00:00 2001 From: Henry Wilson Date: Sat, 30 Dec 2017 21:43:27 +0000 Subject: [PATCH 04/31] GetBestFittingSubType()::subtypes ~> std::vector --- src/vehicle_gui.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 264d30a62..205b8561a 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -233,17 +233,17 @@ byte GetBestFittingSubType(Vehicle *v_from, Vehicle *v_for, CargoID dest_cargo_t v_for = v_for->GetFirstEnginePart(); /* Create a list of subtypes used by the various parts of v_for */ - static SmallVector subtypes; - subtypes.Clear(); + static std::vector subtypes; + subtypes.clear(); for (; v_from != NULL; v_from = v_from->HasArticulatedPart() ? v_from->GetNextArticulatedPart() : NULL) { const Engine *e_from = v_from->GetEngine(); if (!e_from->CanCarryCargo() || !HasBit(e_from->info.callback_mask, CBM_VEHICLE_CARGO_SUFFIX)) continue; - subtypes.Include(GetCargoSubtypeText(v_from)); + Include(subtypes, GetCargoSubtypeText(v_from)); } byte ret_refit_cyc = 0; bool success = false; - if (subtypes.Length() > 0) { + if (not subtypes.empty()) { /* Check whether any articulated part is refittable to 'dest_cargo_type' with a subtype listed in 'subtypes' */ for (Vehicle *v = v_for; v != NULL; v = v->HasArticulatedPart() ? v->GetNextArticulatedPart() : NULL) { const Engine *e = v->GetEngine(); @@ -267,7 +267,7 @@ byte GetBestFittingSubType(Vehicle *v_from, Vehicle *v_for, CargoID dest_cargo_t StringID subtype = GetCargoSubtypeText(v); if (subtype == STR_EMPTY) break; - if (!subtypes.Contains(subtype)) continue; + if (not Contains(subtypes, subtype)) continue; /* We found something matching. */ ret_refit_cyc = refit_cyc; -- 2.14.1