mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Use FlatSet when searching tiles around stations.
parent
7679b0bc46
commit
b06273f716
|
@ -8,6 +8,7 @@
|
|||
/** @file station.cpp Implementation of the station base class. */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "core/flatset_type.hpp"
|
||||
#include "company_func.h"
|
||||
#include "company_base.h"
|
||||
#include "roadveh.h"
|
||||
|
@ -425,8 +426,8 @@ void Station::RemoveIndustryToDeliver(Industry *ind)
|
|||
*/
|
||||
void Station::RemoveFromAllNearbyLists()
|
||||
{
|
||||
std::set<TownID> towns;
|
||||
std::set<IndustryID> industries;
|
||||
FlatSet<TownID> towns;
|
||||
FlatSet<IndustryID> industries;
|
||||
|
||||
for (const auto &tile : this->catchment_tiles) {
|
||||
TileType type = GetTileType(tile);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#ifndef STATION_BASE_H
|
||||
#define STATION_BASE_H
|
||||
|
||||
#include "core/flatset_type.hpp"
|
||||
#include "core/random_func.hpp"
|
||||
#include "base_station_base.h"
|
||||
#include "newgrf_airport.h"
|
||||
|
@ -627,14 +628,15 @@ void ForAllStationsAroundTiles(const TileArea &ta, Func func)
|
|||
if (Station::GetNumItems() == 0) return;
|
||||
|
||||
/* Not using, or don't have a nearby stations list, so we need to scan. */
|
||||
std::set<StationID> seen_stations;
|
||||
FlatSet<StationID> seen_stations;
|
||||
|
||||
/* Scan an area around the building covering the maximum possible station
|
||||
* to find the possible nearby stations. */
|
||||
uint max_c = _settings_game.station.modified_catchment ? MAX_CATCHMENT : CA_UNMODIFIED;
|
||||
TileArea ta_ext = TileArea(ta).Expand(max_c);
|
||||
for (TileIndex tile : ta_ext) {
|
||||
if (IsTileType(tile, MP_STATION)) seen_stations.insert(GetStationIndex(tile));
|
||||
if (!IsTileType(tile, MP_STATION)) continue;
|
||||
seen_stations.insert(GetStationIndex(tile));
|
||||
}
|
||||
|
||||
for (StationID stationid : seen_stations) {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
/** @file station_cmd.cpp Handling of station tiles. */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "core/flatset_type.hpp"
|
||||
#include "aircraft.h"
|
||||
#include "bridge_map.h"
|
||||
#include "vehiclelist_func.h"
|
||||
|
@ -543,7 +544,7 @@ static void ShowRejectOrAcceptNews(const Station *st, CargoTypes cargoes, bool r
|
|||
CargoArray GetProductionAroundTiles(TileIndex north_tile, int w, int h, int rad)
|
||||
{
|
||||
CargoArray produced{};
|
||||
std::set<IndustryID> industries;
|
||||
FlatSet<IndustryID> industries;
|
||||
TileArea ta = TileArea(north_tile, w, h).Expand(rad);
|
||||
|
||||
/* Loop over all tiles to get the produced cargo of
|
||||
|
|
Loading…
Reference in New Issue