mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-23 14:39:08 +00:00
Codechange: Use iterator erase pattern.
This commit is contained in:
@@ -2138,12 +2138,12 @@ static bool AddNearbyStation(TileIndex tile, void *user_data)
|
|||||||
TileArea *ctx = (TileArea *)user_data;
|
TileArea *ctx = (TileArea *)user_data;
|
||||||
|
|
||||||
/* First check if there were deleted stations here */
|
/* First check if there were deleted stations here */
|
||||||
for (uint i = 0; i < _deleted_stations_nearby.size(); i++) {
|
for (auto it = _deleted_stations_nearby.begin(); it != _deleted_stations_nearby.end(); /* nothing */) {
|
||||||
auto ts = _deleted_stations_nearby.begin() + i;
|
if (it->tile == tile) {
|
||||||
if (ts->tile == tile) {
|
_stations_nearby_list.push_back(it->station);
|
||||||
_stations_nearby_list.push_back(_deleted_stations_nearby[i].station);
|
it = _deleted_stations_nearby.erase(it);
|
||||||
_deleted_stations_nearby.erase(ts);
|
} else {
|
||||||
i--;
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user