From a0f36a50e6324f570985f5010eb0543ec0673aeb Mon Sep 17 00:00:00 2001 From: Henry Wilson Date: Mon, 18 Feb 2019 22:39:06 +0000 Subject: Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back() --- src/station_gui.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/station_gui.cpp') diff --git a/src/station_gui.cpp b/src/station_gui.cpp index e1f5daa69..98ac80df4 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -189,14 +189,14 @@ protected: if (st->goods[j].HasRating()) { num_waiting_cargo++; // count number of waiting cargo if (HasBit(this->cargo_filter, j)) { - *this->stations.Append() = st; + this->stations.push_back(st); break; } } } /* stations without waiting cargo */ if (num_waiting_cargo == 0 && this->include_empty) { - *this->stations.Append() = st; + this->stations.push_back(st); } } } @@ -2135,7 +2135,7 @@ static bool AddNearbyStation(TileIndex tile, void *user_data) for (uint i = 0; i < _deleted_stations_nearby.size(); i++) { auto ts = _deleted_stations_nearby.begin() + i; if (ts->tile == tile) { - *_stations_nearby_list.Append() = _deleted_stations_nearby[i].station; + _stations_nearby_list.push_back(_deleted_stations_nearby[i].station); _deleted_stations_nearby.erase(ts); i--; } @@ -2153,7 +2153,7 @@ static bool AddNearbyStation(TileIndex tile, void *user_data) if (st->owner != _local_company || std::find(_stations_nearby_list.begin(), _stations_nearby_list.end(), sid) != _stations_nearby_list.end()) return false; if (st->rect.BeforeAddRect(ctx->tile, ctx->w, ctx->h, StationRect::ADD_TEST).Succeeded()) { - *_stations_nearby_list.Append() = sid; + _stations_nearby_list.push_back(sid); } return false; // We want to include *all* nearby stations @@ -2187,9 +2187,7 @@ static const T *FindStationsNearby(TileArea ta, bool distant_join) if (T::IsExpected(st) && !st->IsInUse() && st->owner == _local_company) { /* Include only within station spread (yes, it is strictly less than) */ if (max(DistanceMax(ta.tile, st->xy), DistanceMax(TILE_ADDXY(ta.tile, ta.w - 1, ta.h - 1), st->xy)) < _settings_game.station.station_spread) { - TileAndStation *ts = _deleted_stations_nearby.Append(); - ts->tile = st->xy; - ts->station = st->index; + _deleted_stations_nearby.push_back({st->xy, st->index}); /* Add the station when it's within where we're going to build */ if (IsInsideBS(TileX(st->xy), TileX(ctx.tile), ctx.w) && -- cgit v1.2.3-54-g00ecf