Update readme and changelog for v1.26.0
[openttd-joker.git] / src / station.cpp
blobb7570198e2243337c886c5dac4d49728e3d400a7
1 /* $Id$ */
3 /*
4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 */
10 /** @file station.cpp Implementation of the station base class. */
12 #include "stdafx.h"
13 #include "company_func.h"
14 #include "company_base.h"
15 #include "roadveh.h"
16 #include "viewport_func.h"
17 #include "date_func.h"
18 #include "command_func.h"
19 #include "news_func.h"
20 #include "aircraft.h"
21 #include "vehiclelist.h"
22 #include "core/pool_func.hpp"
23 #include "station_base.h"
24 #include "roadstop_base.h"
25 #include "dock_base.h"
26 #include "industry.h"
27 #include "core/random_func.hpp"
28 #include "overlay_cmd.h"
29 #include "linkgraph/linkgraph.h"
30 #include "linkgraph/linkgraphschedule.h"
31 #include "tracerestrict.h"
33 #include "table/strings.h"
35 #include "safeguards.h"
37 /** The pool of stations. */
38 StationPool _station_pool("Station");
39 INSTANTIATE_POOL_METHODS(Station)
41 typedef StationIDStack::SmallStackPool StationIDStackPool;
42 template<> StationIDStackPool StationIDStack::_pool = StationIDStackPool();
44 BaseStation::~BaseStation()
46 free(this->name);
47 free(this->speclist);
49 if (CleaningPool()) return;
51 DeleteWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN, this->owner, this->index).Pack());
52 DeleteWindowById(WC_ROADVEH_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_ROAD, this->owner, this->index).Pack());
53 DeleteWindowById(WC_SHIPS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_SHIP, this->owner, this->index).Pack());
54 DeleteWindowById(WC_AIRCRAFT_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_AIRCRAFT, this->owner, this->index).Pack());
55 DeleteWindowById(WC_DEPARTURES_BOARD, this->index);
56 DeleteWindowById(WC_STATION_CARGO, this->index);
58 this->sign.MarkDirty();
61 Station::Station(TileIndex tile) :
62 SpecializedStation<Station, false>(tile),
63 bus_station(INVALID_TILE, 0, 0),
64 truck_station(INVALID_TILE, 0, 0),
65 dock_station(INVALID_TILE, 0, 0),
66 indtype(IT_INVALID),
67 time_since_load(255),
68 time_since_unload(255),
69 last_vehicle_type(VEH_INVALID),
70 station_cargo_history{}
72 /* this->random_bits is set in Station::AddFacility() */
75 /**
76 * Clean up a station by clearing vehicle orders, invalidating windows and
77 * removing link stats.
78 * Aircraft-Hangar orders need special treatment here, as the hangars are
79 * actually part of a station (tiletype is STATION), but the order type
80 * is OT_GOTO_DEPOT.
82 Station::~Station()
84 if (CleaningPool()) {
85 for (CargoID c = 0; c < NUM_CARGO; c++) {
86 this->goods[c].cargo.OnCleanPool();
88 return;
91 while (!this->loading_vehicles.empty()) {
92 this->loading_vehicles.front()->LeaveStation();
95 Aircraft *a;
96 FOR_ALL_AIRCRAFT(a) {
97 if (!a->IsNormalAircraft()) continue;
98 if (a->targetairport == this->index) a->targetairport = INVALID_STATION;
101 for (CargoID c = 0; c < NUM_CARGO; ++c) {
102 LinkGraph *lg = LinkGraph::GetIfValid(this->goods[c].link_graph);
103 if (lg == nullptr) continue;
105 for (NodeID node = 0; node < lg->Size(); ++node) {
106 Station *st = Station::Get((*lg)[node].Station());
107 st->goods[c].flows.erase(this->index);
108 if ((*lg)[node][this->goods[c].node].LastUpdate() != INVALID_DATE) {
109 st->goods[c].flows.DeleteFlows(this->index);
110 RerouteCargo(st, c, this->index, st->index);
113 lg->RemoveNode(this->goods[c].node);
114 if (lg->Size() == 0) {
115 LinkGraphSchedule::instance.Unqueue(lg);
116 delete lg;
120 Vehicle *v;
121 FOR_ALL_VEHICLES(v) {
122 /* Forget about this station if this station is removed */
123 if (v->last_station_visited == this->index) {
124 v->last_station_visited = INVALID_STATION;
126 if (v->last_loading_station == this->index) {
127 v->last_loading_station = INVALID_STATION;
131 /* Clear the persistent storage. */
132 delete this->airport.psa;
134 if (this->owner == OWNER_NONE) {
135 /* Invalidate all in case of oil rigs. */
136 InvalidateWindowClassesData(WC_STATION_LIST, 0);
137 } else {
138 InvalidateWindowData(WC_STATION_LIST, this->owner, 0);
141 if (Overlays::Instance()->HasStation(Station::Get(this->index))) {
142 Overlays::Instance()->ToggleStation(Station::Get(this->index));
145 DeleteWindowById(WC_STATION_VIEW, index);
147 /* Now delete all orders that go to the station */
148 RemoveOrderFromAllVehicles(OT_GOTO_STATION, this->index);
150 TraceRestrictRemoveDestinationID(TROCAF_STATION, this->index);
152 /* Remove all news items */
153 DeleteStationNews(this->index);
155 for (CargoID c = 0; c < NUM_CARGO; c++) {
156 this->goods[c].cargo.Truncate();
159 CargoPacket::InvalidateAllFrom(this->index);
163 * Evaluate if a tile is in station catchment area.
164 * @param ti the tile info
165 * @param type the catchment type of the station
166 * @return true/false if the tile is in catchment
168 bool Station::IsTileInCatchmentArea(const TileInfo* ti, CatchmentType type) const
170 switch (type) {
171 case ACCEPTANCE:
172 return this->rect.PtInExtendedRect(TileX(ti->tile),TileY(ti->tile),this->GetCatchmentRadius());
173 case PRODUCTION:
174 return this->catchment.IsTileInCatchment(ti->tile);
175 case INDUSTRY:
176 return false;
177 default:
178 NOT_REACHED();
184 * Invalidating of the JoinStation window has to be done
185 * after removing item from the pool.
186 * @param index index of deleted item
188 void BaseStation::PostDestructor(size_t index)
190 InvalidateWindowData(WC_SELECT_STATION, 0, 0);
194 * Get the primary road stop (the first road stop) that the given vehicle can load/unload.
195 * @param v the vehicle to get the first road stop for
196 * @return the first roadstop that this vehicle can load at
198 RoadStop *Station::GetPrimaryRoadStop(const RoadVehicle *v) const
200 RoadStop *rs = this->GetPrimaryRoadStop(v->IsBus() ? ROADSTOP_BUS : ROADSTOP_TRUCK);
202 for (; rs != nullptr; rs = rs->next) {
203 /* The vehicle cannot go to this roadstop (different roadtype) */
204 if ((GetRoadTypes(rs->xy) & v->compatible_roadtypes) == ROADTYPES_NONE) continue;
205 /* The vehicle is articulated and can therefore not go to a standard road stop. */
206 if (IsStandardRoadStopTile(rs->xy) && v->HasArticulatedPart()) continue;
208 /* The vehicle can actually go to this road stop. So, return it! */
209 break;
212 return rs;
216 * Called when new facility is built on the station. If it is the first facility
217 * it initializes also 'xy' and 'random_bits' members
219 void Station::AddFacility(StationFacility new_facility_bit, TileIndex facil_xy)
221 if (this->facilities == FACIL_NONE) {
222 this->xy = facil_xy;
223 this->random_bits = Random();
225 this->facilities |= new_facility_bit;
226 this->owner = _current_company;
227 this->build_date = _date;
231 * Marks the tiles of the station as dirty.
233 * @ingroup dirty
235 void Station::MarkTilesDirty(bool cargo_change) const
237 TileIndex tile = this->train_station.tile;
238 int w, h;
240 if (tile == INVALID_TILE) return;
242 /* cargo_change is set if we're refreshing the tiles due to cargo moving
243 * around. */
244 if (cargo_change) {
245 /* Don't waste time updating if there are no custom station graphics
246 * that might change. Even if there are custom graphics, they might
247 * not change. Unfortunately we have no way of telling. */
248 if (this->num_specs == 0) return;
251 for (h = 0; h < train_station.h; h++) {
252 for (w = 0; w < train_station.w; w++) {
253 if (this->TileBelongsToRailStation(tile)) {
254 MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
256 tile += TileDiffXY(1, 0);
258 tile += TileDiffXY(-w, 1);
263 * Marks the acceptance tiles of the station as dirty.
265 * @ingroup dirty
267 void Station::MarkAcceptanceTilesDirty() const
269 Rect rec = this->GetCatchmentRect();
270 TileIndex top_left = TileXY(rec.left, rec.top);
271 int width = rec.right - rec.left + 1;
272 int height = rec.bottom - rec.top + 1;
274 TILE_AREA_LOOP(tile, TileArea(top_left, width, height) ) {
275 MarkTileDirtyByTile(tile);
279 /* virtual */ uint Station::GetPlatformLength(TileIndex tile) const
281 assert(this->TileBelongsToRailStation(tile));
283 TileIndexDiff delta = (GetRailStationAxis(tile) == AXIS_X ? TileDiffXY(1, 0) : TileDiffXY(0, 1));
285 TileIndex t = tile;
286 uint len = 0;
287 do {
288 t -= delta;
289 len++;
290 } while (IsCompatibleTrainStationTile(t, tile));
292 t = tile;
293 do {
294 t += delta;
295 len++;
296 } while (IsCompatibleTrainStationTile(t, tile));
298 return len - 1;
301 /* virtual */ uint Station::GetPlatformLength(TileIndex tile, DiagDirection dir) const
303 TileIndex start_tile = tile;
304 uint length = 0;
305 assert(IsRailStationTile(tile));
306 assert(dir < DIAGDIR_END);
308 do {
309 length++;
310 tile += TileOffsByDiagDir(dir);
311 } while (IsCompatibleTrainStationTile(tile, start_tile));
313 return length;
317 * Determines the catchment radius of the station
318 * @return The radius
320 uint Station::GetCatchmentRadius() const
322 uint ret = CA_NONE;
324 if (_settings_game.station.modified_catchment) {
325 if (this->bus_stops != nullptr) ret = max<uint>(ret, CA_BUS);
326 if (this->truck_stops != nullptr) ret = max<uint>(ret, CA_TRUCK);
327 if (this->train_station.tile != INVALID_TILE) ret = max<uint>(ret, CA_TRAIN);
328 if (this->docks != nullptr) ret = max<uint>(ret, CA_DOCK);
329 if (this->airport.tile != INVALID_TILE) ret = max<uint>(ret, this->airport.GetSpec()->catchment);
330 } else {
331 if (this->bus_stops != nullptr || this->truck_stops != nullptr || this->train_station.tile != INVALID_TILE || this->docks != nullptr || this->airport.tile != INVALID_TILE) {
332 ret = CA_UNMODIFIED;
336 return ret;
340 * Determines catchment rectangle of this station
341 * @return clamped catchment rectangle
343 Rect Station::GetCatchmentRectUsingRadius(uint catchment_radius) const
345 assert(!this->rect.IsEmpty());
347 /* Compute acceptance rectangle */
348 Rect ret = {
349 max<int>(this->rect.left - catchment_radius, 0),
350 max<int>(this->rect.top - catchment_radius, 0),
351 min<int>(this->rect.right + catchment_radius, MapMaxX()),
352 min<int>(this->rect.bottom + catchment_radius, MapMaxY())
355 return ret;
358 bool Station::IsDockingTile(TileIndex tile) const
360 for (const Dock *d = this->docks; d != nullptr; d = d->next) {
361 if (tile == d->GetDockingTile()) return true;
363 return false;
366 /** Rect and pointer to IndustryVector */
367 struct RectAndIndustryVector {
368 Rect rect; ///< The rectangle to search the industries in.
369 IndustryVector *industries_near; ///< The nearby industries.
373 * Callback function for Station::RecomputeIndustriesNear()
374 * Tests whether tile is an industry and possibly adds
375 * the industry to station's industries_near list.
376 * @param ind_tile tile to check
377 * @param user_data pointer to RectAndIndustryVector
378 * @return always false, we want to search all tiles
380 static bool FindIndustryToDeliver(TileIndex ind_tile, void *user_data)
382 /* Only process industry tiles */
383 if (!IsTileType(ind_tile, MP_INDUSTRY)) return false;
385 RectAndIndustryVector *riv = (RectAndIndustryVector *)user_data;
386 Industry *ind = Industry::GetByTile(ind_tile);
388 /* Don't check further if this industry is already in the list */
389 if (riv->industries_near->Contains(ind)) return false;
391 /* Only process tiles in the station acceptance rectangle */
392 int x = TileX(ind_tile);
393 int y = TileY(ind_tile);
394 if (x < riv->rect.left || x > riv->rect.right || y < riv->rect.top || y > riv->rect.bottom) return false;
396 /* Include only industries that can accept cargo */
397 uint cargo_index;
398 for (cargo_index = 0; cargo_index < lengthof(ind->accepts_cargo); cargo_index++) {
399 if (ind->accepts_cargo[cargo_index] != CT_INVALID) break;
401 if (cargo_index >= lengthof(ind->accepts_cargo)) return false;
403 *riv->industries_near->Append() = ind;
405 return false;
409 * Recomputes Station::industries_near, list of industries possibly
410 * accepting cargo in station's catchment radius
412 void Station::RecomputeIndustriesNear()
414 this->industries_near.Clear();
415 if (this->rect.IsEmpty()) return;
417 RectAndIndustryVector riv = {
418 this->GetCatchmentRect(),
419 &this->industries_near
422 /* Compute maximum extent of acceptance rectangle wrt. station sign */
423 TileIndex start_tile = this->xy;
424 uint max_radius = max(
425 max(DistanceManhattan(start_tile, TileXY(riv.rect.left, riv.rect.top)), DistanceManhattan(start_tile, TileXY(riv.rect.left, riv.rect.bottom))),
426 max(DistanceManhattan(start_tile, TileXY(riv.rect.right, riv.rect.top)), DistanceManhattan(start_tile, TileXY(riv.rect.right, riv.rect.bottom)))
429 CircularTileSearch(&start_tile, 2 * max_radius + 1, &FindIndustryToDeliver, &riv);
433 * Recomputes Station::industries_near for all stations
435 /* static */ void Station::RecomputeIndustriesNearForAll()
437 Station *st;
438 FOR_ALL_STATIONS(st) st->RecomputeIndustriesNear();
441 /************************************************************************/
442 /* StationRect implementation */
443 /************************************************************************/
445 StationRect::StationRect()
447 this->MakeEmpty();
450 void StationRect::MakeEmpty()
452 this->left = this->top = this->right = this->bottom = 0;
456 * Determines whether a given point (x, y) is within a certain distance of
457 * the station rectangle.
458 * @note x and y are in Tile coordinates
459 * @param x X coordinate
460 * @param y Y coordinate
461 * @param distance The maximum distance a point may have (L1 norm)
462 * @return true if the point is within distance tiles of the station rectangle
464 bool StationRect::PtInExtendedRect(int x, int y, int distance) const
466 return this->left - distance <= x && x <= this->right + distance &&
467 this->top - distance <= y && y <= this->bottom + distance;
470 bool StationRect::IsEmpty() const
472 return this->left == 0 || this->left > this->right || this->top > this->bottom;
475 CommandCost StationRect::BeforeAddTile(TileIndex tile, StationRectMode mode)
477 int x = TileX(tile);
478 int y = TileY(tile);
479 if (this->IsEmpty()) {
480 /* we are adding the first station tile */
481 if (mode != ADD_TEST) {
482 this->left = this->right = x;
483 this->top = this->bottom = y;
485 } else if (!this->PtInExtendedRect(x, y)) {
486 /* current rect is not empty and new point is outside this rect
487 * make new spread-out rectangle */
488 Rect new_rect = {min(x, this->left), min(y, this->top), max(x, this->right), max(y, this->bottom)};
490 /* check new rect dimensions against preset max */
491 int w = new_rect.right - new_rect.left + 1;
492 int h = new_rect.bottom - new_rect.top + 1;
493 if (mode != ADD_FORCE && (w > _settings_game.station.station_spread || h > _settings_game.station.station_spread)) {
494 assert(mode != ADD_TRY);
495 return CommandError(STR_ERROR_STATION_TOO_SPREAD_OUT);
498 /* spread-out ok, return true */
499 if (mode != ADD_TEST) {
500 /* we should update the station rect */
501 *this = new_rect;
503 } else {
504 ; // new point is inside the rect, we don't need to do anything
506 return CommandCost();
509 CommandCost StationRect::BeforeAddRect(TileIndex tile, int w, int h, StationRectMode mode)
511 if (mode == ADD_FORCE || (w <= _settings_game.station.station_spread && h <= _settings_game.station.station_spread)) {
512 /* Important when the old rect is completely inside the new rect, resp. the old one was empty. */
513 CommandCost ret = this->BeforeAddTile(tile, mode);
514 if (ret.Succeeded()) ret = this->BeforeAddTile(TILE_ADDXY(tile, w - 1, h - 1), mode);
515 return ret;
517 return CommandCost();
521 * Check whether station tiles of the given station id exist in the given rectangle
522 * @param st_id Station ID to look for in the rectangle
523 * @param left_a Minimal tile X edge of the rectangle
524 * @param top_a Minimal tile Y edge of the rectangle
525 * @param right_a Maximal tile X edge of the rectangle (inclusive)
526 * @param bottom_a Maximal tile Y edge of the rectangle (inclusive)
527 * @return \c true if a station tile with the given \a st_id exists in the rectangle, \c false otherwise
529 /* static */ bool StationRect::ScanForStationTiles(StationID st_id, int left_a, int top_a, int right_a, int bottom_a)
531 TileArea ta(TileXY(left_a, top_a), TileXY(right_a, bottom_a));
532 TILE_AREA_LOOP(tile, ta) {
533 if (IsTileType(tile, MP_STATION) && GetStationIndex(tile) == st_id) return true;
536 return false;
539 bool StationRect::AfterRemoveTile(BaseStation *st, TileIndex tile)
541 int x = TileX(tile);
542 int y = TileY(tile);
544 /* look if removed tile was on the bounding rect edge
545 * and try to reduce the rect by this edge
546 * do it until we have empty rect or nothing to do */
547 for (;;) {
548 /* check if removed tile is on rect edge */
549 bool left_edge = (x == this->left);
550 bool right_edge = (x == this->right);
551 bool top_edge = (y == this->top);
552 bool bottom_edge = (y == this->bottom);
554 /* can we reduce the rect in either direction? */
555 bool reduce_x = ((left_edge || right_edge) && !ScanForStationTiles(st->index, x, this->top, x, this->bottom));
556 bool reduce_y = ((top_edge || bottom_edge) && !ScanForStationTiles(st->index, this->left, y, this->right, y));
557 if (!(reduce_x || reduce_y)) break; // nothing to do (can't reduce)
559 if (reduce_x) {
560 /* reduce horizontally */
561 if (left_edge) {
562 /* move left edge right */
563 this->left = x = x + 1;
564 } else {
565 /* move right edge left */
566 this->right = x = x - 1;
569 if (reduce_y) {
570 /* reduce vertically */
571 if (top_edge) {
572 /* move top edge down */
573 this->top = y = y + 1;
574 } else {
575 /* move bottom edge up */
576 this->bottom = y = y - 1;
580 if (left > right || top > bottom) {
581 /* can't continue, if the remaining rectangle is empty */
582 this->MakeEmpty();
583 return true; // empty remaining rect
586 return false; // non-empty remaining rect
589 bool StationRect::AfterRemoveRect(BaseStation *st, TileArea ta)
591 assert(this->PtInExtendedRect(TileX(ta.tile), TileY(ta.tile)));
592 assert(this->PtInExtendedRect(TileX(ta.tile) + ta.w - 1, TileY(ta.tile) + ta.h - 1));
594 bool empty = this->AfterRemoveTile(st, ta.tile);
595 if (ta.w != 1 || ta.h != 1) empty = empty || this->AfterRemoveTile(st, TILE_ADDXY(ta.tile, ta.w - 1, ta.h - 1));
596 return empty;
599 StationRect& StationRect::operator = (const Rect &src)
601 this->left = src.left;
602 this->top = src.top;
603 this->right = src.right;
604 this->bottom = src.bottom;
605 return *this;
609 * Calculates the maintenance cost of all airports of a company.
610 * @param owner Company.
611 * @return Total cost.
613 Money AirportMaintenanceCost(Owner owner)
615 Money total_cost = 0;
617 const Station *st;
618 FOR_ALL_STATIONS(st) {
619 if (st->owner == owner && (st->facilities & FACIL_AIRPORT)) {
620 total_cost += _price[PR_INFRASTRUCTURE_AIRPORT] * st->airport.GetSpec()->maintenance_cost;
623 /* 3 bits fraction for the maintenance cost factor. */
624 return total_cost >> 3;
627 /************************************************************************/
628 /* StationCatchment implementation */
629 /************************************************************************/
631 StationCatchment::StationCatchment()
636 * Determines whether a given point (x, y) is within the station catchment area
637 * @param tile TileIndex to test
638 * @return true if the point is within the station catchment area
640 bool StationCatchment::IsTileInCatchment(TileIndex tile) const
642 return this->catchmentTiles.find(tile) != this->catchmentTiles.end();
645 bool StationCatchment::IsEmpty() const
647 return this->catchmentTiles.empty();
650 void StationCatchment::BeforeAddTile(TileIndex tile, uint catchmentRadius)
652 int x = TileX(tile);
653 int y = TileY(tile);
654 TileIndex top_left = TileXY(max<int>(x - catchmentRadius,0),max<int>(y - catchmentRadius, 0));
655 int w = min<int>(x + catchmentRadius, MapMaxX()) - TileX(top_left) + 1;
656 int h = min<int>(y + catchmentRadius, MapMaxY()) - TileY(top_left) + 1;
657 if (IsEmpty()) {
658 /* we are adding the first station tile */
659 TILE_AREA_LOOP(t, TileArea(top_left, w, h) ) {
660 std::set<TileIndex> fromSet;
661 fromSet.insert(tile);
662 this->catchmentTiles[t] = fromSet;
664 } else {
665 TILE_AREA_LOOP(t, TileArea(top_left, w, h) ) {
666 std::map<TileIndex, std::set<TileIndex> >::iterator found = this->catchmentTiles.find(t);
667 if ( found == this->catchmentTiles.end()) {
668 std::set<TileIndex> fromSet;
669 fromSet.insert(tile);
670 this->catchmentTiles[t] = fromSet;
671 } else if ((*found).second.find(tile) == (*found).second.end()) {
672 (*found).second.insert(tile);
678 void StationCatchment::BeforeAddRect(TileIndex tile, int w, int h, uint catchmentRadius)
680 TILE_AREA_LOOP(t, TileArea(tile, w, h) ) {
681 this->BeforeAddTile(t, catchmentRadius);
685 void StationCatchment::AfterRemoveTile(TileIndex tile, uint catchmentRadius)
687 int x = TileX(tile);
688 int y = TileY(tile);
689 TileIndex top_left = TileXY(max<int>(x - catchmentRadius,0),max<int>(y - catchmentRadius, 0));
690 int w = min<int>(x + catchmentRadius, MapMaxX()) - TileX(top_left) + 1;
691 int h = min<int>(y + catchmentRadius, MapMaxY()) - TileY(top_left) + 1;
692 TILE_AREA_LOOP(t, TileArea(top_left, w, h)) {
693 std::map<TileIndex, std::set<TileIndex> >::iterator found = this->catchmentTiles.find(t);
694 assert(found != this->catchmentTiles.end());
695 std::set<TileIndex>::iterator stTileIter = (*found).second.find(tile);
696 assert(stTileIter != (*found).second.end());
697 (*found).second.erase(stTileIter);
698 if ((*found).second.empty()) {
699 // tile t is no longer in StationCatchment
700 this->catchmentTiles.erase(found);
705 void StationCatchment::AfterRemoveRect(TileIndex tile, int w, int h, uint catchmentRadius)
707 TILE_AREA_LOOP(t, TileArea(tile, w, h)) {
708 this->AfterRemoveTile(t, catchmentRadius);