OpenTTD Source 15.0-beta2
station_base.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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/>.
6 */
7
10#ifndef STATION_BASE_H
11#define STATION_BASE_H
12
13#include "core/random_func.hpp"
14#include "base_station_base.h"
15#include "newgrf_airport.h"
16#include "cargopacket.h"
17#include "industry_type.h"
19#include "newgrf_storage.h"
20#include "bitmap_type.h"
21
22static const uint8_t INITIAL_STATION_RATING = 175;
23static const uint8_t MAX_STATION_RATING = 255;
24
32class FlowStat {
33public:
34 typedef std::map<uint32_t, StationID> SharesMap;
35
36 static const SharesMap empty_sharesmap;
37
43 inline FlowStat() {NOT_REACHED();}
44
51 inline FlowStat(StationID st, uint flow, bool restricted = false)
52 {
53 assert(flow > 0);
54 this->shares[flow] = st;
55 this->unrestricted = restricted ? 0 : flow;
56 }
57
66 inline void AppendShare(StationID st, uint flow, bool restricted = false)
67 {
68 assert(flow > 0);
69 this->shares[(--this->shares.end())->first + flow] = st;
70 if (!restricted) this->unrestricted += flow;
71 }
72
73 uint GetShare(StationID st) const;
74
75 void ChangeShare(StationID st, int flow);
76
77 void RestrictShare(StationID st);
78
79 void ReleaseShare(StationID st);
80
81 void ScaleToMonthly(uint runtime);
82
88 inline const SharesMap *GetShares() const { return &this->shares; }
89
94 inline uint GetUnrestricted() const { return this->unrestricted; }
95
101 inline void SwapShares(FlowStat &other)
102 {
103 this->shares.swap(other.shares);
104 std::swap(this->unrestricted, other.unrestricted);
105 }
106
115 inline StationID GetViaWithRestricted(bool &is_restricted) const
116 {
117 assert(!this->shares.empty());
118 uint rand = RandomRange((--this->shares.end())->first);
119 is_restricted = rand >= this->unrestricted;
120 return this->shares.upper_bound(rand)->second;
121 }
122
130 inline StationID GetVia() const
131 {
132 assert(!this->shares.empty());
133 return this->unrestricted > 0 ?
134 this->shares.upper_bound(RandomRange(this->unrestricted))->second :
135 StationID::Invalid();
136 }
137
138 StationID GetVia(StationID excluded, StationID excluded2 = StationID::Invalid()) const;
139
140 void Invalidate();
141
142private:
143 SharesMap shares{};
144 uint unrestricted = 0;
145};
146
148class FlowStatMap : public std::map<StationID, FlowStat> {
149public:
150 uint GetFlow() const;
151 uint GetFlowVia(StationID via) const;
152 uint GetFlowFrom(StationID from) const;
153 uint GetFlowFromVia(StationID from, StationID via) const;
154
155 void AddFlow(StationID origin, StationID via, uint amount);
156 void PassOnFlow(StationID origin, StationID via, uint amount);
158 void RestrictFlows(StationID via);
159 void ReleaseFlows(StationID via);
161};
162
168 enum class State : uint8_t {
173 Acceptance = 0,
174
183 Rating = 1,
184
189 EverAccepted = 2,
190
195 LastMonth = 3,
196
201 CurrentMonth = 4,
202
207 AcceptedBigtick = 5,
208 };
209 using States = EnumBitSet<State, uint8_t>;
210
214
215 bool IsEmpty() const
216 {
217 return this->cargo.TotalCount() == 0 && this->flows.empty();
218 }
219 };
220
222 NodeID node = INVALID_NODE;
223 LinkGraphID link_graph = LinkGraphID::Invalid();
224
226
232 uint8_t time_since_pickup = 255;
233
234 uint8_t rating = INITIAL_STATION_RATING;
235
245 uint8_t last_speed = 0;
246
251 uint8_t last_age = 255;
252
253 uint8_t amount_fract = 0;
254
260 bool HasVehicleEverTriedLoading() const { return this->last_speed != 0; }
261
266 inline bool HasRating() const
267 {
269 }
270
276 inline StationID GetVia(StationID source) const
277 {
278 if (!this->HasData()) return StationID::Invalid();
279
280 FlowStatMap::const_iterator flow_it(this->GetData().flows.find(source));
281 return flow_it != this->GetData().flows.end() ? flow_it->second.GetVia() : StationID::Invalid();
282 }
283
292 inline StationID GetVia(StationID source, StationID excluded, StationID excluded2 = StationID::Invalid()) const
293 {
294 if (!this->HasData()) return StationID::Invalid();
295
296 FlowStatMap::const_iterator flow_it(this->GetData().flows.find(source));
297 return flow_it != this->GetData().flows.end() ? flow_it->second.GetVia(excluded, excluded2) : StationID::Invalid();
298 }
299
304 debug_inline bool HasData() const { return this->data != nullptr; }
305
309 void ClearData() { this->data.reset(); }
310
316 debug_inline const GoodsEntryData &GetData() const
317 {
318 assert(this->HasData());
319 return *this->data;
320 }
321
327 debug_inline GoodsEntryData &GetData()
328 {
329 assert(this->HasData());
330 return *this->data;
331 }
332
338 {
339 if (!this->HasData()) this->data = std::make_unique<GoodsEntryData>();
340 return *this->data;
341 }
342
343 uint8_t ConvertState() const;
344
345private:
346 std::unique_ptr<GoodsEntryData> data = nullptr;
347};
348
350struct Airport : public TileArea {
351 Airport() : TileArea(INVALID_TILE, 0, 0) {}
352
354 uint8_t type = 0;
355 uint8_t layout = 0;
357
359
365 const AirportSpec *GetSpec() const
366 {
367 if (this->tile == INVALID_TILE) return &AirportSpec::dummy;
368 return AirportSpec::Get(this->type);
369 }
370
377 const AirportFTAClass *GetFTA() const
378 {
379 return this->GetSpec()->fsm;
380 }
381
383 inline bool HasHangar() const
384 {
385 return !this->GetSpec()->depots.empty();
386 }
387
397 {
398 const AirportSpec *as = this->GetSpec();
399 switch (this->rotation) {
400 case DIR_N: return this->tile + ToTileIndexDiff(tidc);
401
402 case DIR_E: return this->tile + TileDiffXY(tidc.y, as->size_x - 1 - tidc.x);
403
404 case DIR_S: return this->tile + TileDiffXY(as->size_x - 1 - tidc.x, as->size_y - 1 - tidc.y);
405
406 case DIR_W: return this->tile + TileDiffXY(as->size_y - 1 - tidc.y, tidc.x);
407
408 default: NOT_REACHED();
409 }
410 }
411
418 inline TileIndex GetHangarTile(uint hangar_num) const
419 {
420 for (const auto &depot : this->GetSpec()->depots) {
421 if (depot.hangar_num == hangar_num) {
422 return this->GetRotatedTileFromOffset(depot.ti);
423 }
424 }
425 NOT_REACHED();
426 }
427
435 {
436 const AirportSpec *as = this->GetSpec();
438 return ChangeDir(htt->dir, DirDifference(this->rotation, as->layouts[0].rotation));
439 }
440
447 inline uint GetHangarNum(TileIndex tile) const
448 {
450 return htt->hangar_num;
451 }
452
454 inline uint GetNumHangars() const
455 {
456 uint num = 0;
457 uint counted = 0;
458 for (const auto &depot : this->GetSpec()->depots) {
459 if (!HasBit(counted, depot.hangar_num)) {
460 num++;
461 SetBit(counted, depot.hangar_num);
462 }
463 }
464 return num;
465 }
466
467private:
475 {
476 for (const auto &depot : this->GetSpec()->depots) {
477 if (this->GetRotatedTileFromOffset(depot.ti) == tile) {
478 return &depot;
479 }
480 }
481 NOT_REACHED();
482 }
483};
484
486 uint distance = 0;
487 Industry *industry = nullptr;
488
489 bool operator== (const IndustryListEntry &other) const { return this->distance == other.distance && this->industry == other.industry; };
490};
491
493 bool operator() (const IndustryListEntry &lhs, const IndustryListEntry &rhs) const;
494};
495
496typedef std::set<IndustryListEntry, IndustryCompare> IndustryList;
497
499struct Station final : SpecializedStation<Station, false> {
500public:
501 RoadStop *GetPrimaryRoadStop(RoadStopType type) const
502 {
503 return type == RoadStopType::Bus ? bus_stops : truck_stops;
504 }
505
506 RoadStop *GetPrimaryRoadStop(const struct RoadVehicle *v) const;
507
508 RoadStop *bus_stops = nullptr;
512
516
517 IndustryType indtype = IT_INVALID;
518
520
521 StationHadVehicleOfType had_vehicle_of_type{};
522
523 uint8_t time_since_load = 0;
524 uint8_t time_since_unload = 0;
525
526 uint8_t last_vehicle_type = 0;
527 std::list<Vehicle *> loading_vehicles{};
528 std::array<GoodsEntry, NUM_CARGO> goods;
529 CargoTypes always_accepted{};
530
531 IndustryList industries_near{};
532 Industry *industry = nullptr;
533
535 ~Station();
536
537 void AddFacility(StationFacility new_facility_bit, TileIndex facil_xy);
538
539 void MarkTilesDirty(bool cargo_change) const;
540
541 void UpdateVirtCoord() override;
542
543 void MoveSign(TileIndex new_xy) override;
544
545 void AfterStationTileSetChange(bool adding, StationType type);
546
547 uint GetPlatformLength(TileIndex tile, DiagDirection dir) const override;
548 uint GetPlatformLength(TileIndex tile) const override;
549 void RecomputeCatchment(bool no_clear_nearby_lists = false);
550 static void RecomputeCatchmentForAll();
551
552 uint GetCatchmentRadius() const;
553 Rect GetCatchmentRect() const;
554 bool CatchmentCoversTown(TownID t) const;
555 void AddIndustryToDeliver(Industry *ind, TileIndex tile);
558
559 inline bool TileIsInCatchment(TileIndex tile) const
560 {
561 return this->catchment_tiles.HasTile(tile);
562 }
563
564 inline bool TileBelongsToRailStation(TileIndex tile) const override
565 {
566 return IsRailStationTile(tile) && GetStationIndex(tile) == this->index;
567 }
568
569 inline bool TileBelongsToRoadStop(TileIndex tile) const
570 {
571 return IsStationRoadStopTile(tile) && GetStationIndex(tile) == this->index;
572 }
573
574 inline bool TileBelongsToAirport(TileIndex tile) const
575 {
576 return IsAirportTile(tile) && GetStationIndex(tile) == this->index;
577 }
578
579 uint32_t GetNewGRFVariable(const ResolverObject &object, uint8_t variable, uint8_t parameter, bool &available) const override;
580
581 void GetTileArea(TileArea *ta, StationType type) const override;
582};
583
586private:
587 const Station *st = nullptr;
588
589public:
595 {
596 if (!st->TileBelongsToAirport(this->tile)) ++(*this);
597 }
598
599 inline TileIterator& operator ++() override
600 {
601 (*this).OrthogonalTileIterator::operator++();
602 while (this->tile != INVALID_TILE && !st->TileBelongsToAirport(this->tile)) {
603 (*this).OrthogonalTileIterator::operator++();
604 }
605 return *this;
606 }
607
608 std::unique_ptr<TileIterator> Clone() const override
609 {
610 return std::make_unique<AirportTileIterator>(*this);
611 }
612};
613
614void RebuildStationKdtree();
615
623template <typename Func>
624void ForAllStationsAroundTiles(const TileArea &ta, Func func)
625{
626 /* There are no stations, so we will never find anything. */
627 if (Station::GetNumItems() == 0) return;
628
629 /* Not using, or don't have a nearby stations list, so we need to scan. */
630 std::set<StationID> seen_stations;
631
632 /* Scan an area around the building covering the maximum possible station
633 * to find the possible nearby stations. */
635 TileArea ta_ext = TileArea(ta).Expand(max_c);
636 for (TileIndex tile : ta_ext) {
637 if (IsTileType(tile, MP_STATION)) seen_stations.insert(GetStationIndex(tile));
638 }
639
640 for (StationID stationid : seen_stations) {
641 Station *st = Station::GetIfValid(stationid);
642 if (st == nullptr) continue; /* Waypoint */
643
644 /* Check if station is attached to an industry */
645 if (!_settings_game.station.serve_neutral_industries && st->industry != nullptr) continue;
646
647 /* Test if the tile is within the station's catchment */
648 for (TileIndex tile : ta) {
649 if (st->TileIsInCatchment(tile)) {
650 if (func(st, tile)) break;
651 }
652 }
653 }
654}
655
656#endif /* STATION_BASE_H */
Base classes/functions for base stations.
debug_inline constexpr bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
constexpr T SetBit(T &x, const uint8_t y)
Set a bit in a variable.
Base class for cargo packets.
Iterator to iterate over all tiles belonging to an airport.
std::unique_ptr< TileIterator > Clone() const override
Allocate a new iterator that is a copy of this one.
TileIterator & operator++() override
Move ourselves to the next tile in the rectangle on the map.
const Station * st
The station the airport is a part of.
AirportTileIterator(const Station *st)
Construct the iterator.
constexpr bool Test(Tvalue_type value) const
Test if the value-th bit is set.
Represents a tile area containing containing individually set tiles.
Definition bitmap_type.h:18
bool HasTile(TileIndex tile) const
Test if a tile is part of the tile area.
Definition bitmap_type.h:99
Enum-as-bit-set wrapper.
Flow descriptions by origin stations.
uint GetFlow() const
Get the sum of all flows from this FlowStatMap.
void PassOnFlow(StationID origin, StationID via, uint amount)
Pass on some flow, remembering it as invalid, for later subtraction from locally consumed flow.
void AddFlow(StationID origin, StationID via, uint amount)
Add some flow from "origin", going via "via".
uint GetFlowFrom(StationID from) const
Get the sum of flows from a specific station from this FlowStatMap.
void FinalizeLocalConsumption(StationID self)
Subtract invalid flows from locally consumed flow.
void ReleaseFlows(StationID via)
Release all flows at a station for specific cargo and destination.
StationIDStack DeleteFlows(StationID via)
Delete all flows at a station for specific cargo and destination.
uint GetFlowFromVia(StationID from, StationID via) const
Get the flow from a specific station via a specific other station.
uint GetFlowVia(StationID via) const
Get the sum of flows via a specific station from this FlowStatMap.
void RestrictFlows(StationID via)
Restrict all flows at a station for specific cargo and destination.
Flow statistics telling how much flow should be sent along a link.
static const SharesMap empty_sharesmap
Static instance of FlowStat::SharesMap.
void ScaleToMonthly(uint runtime)
Scale all shares from link graph's runtime to monthly values.
void RestrictShare(StationID st)
Restrict a flow by moving it to the end of the map and decreasing the amount of unrestricted flow.
uint GetShare(StationID st) const
Get flow for a station.
void SwapShares(FlowStat &other)
Swap the shares maps, and thus the content of this FlowStat with the other one.
uint GetUnrestricted() const
Return total amount of unrestricted shares.
StationID GetVia() const
Get a station a package can be routed to.
StationID GetViaWithRestricted(bool &is_restricted) const
Get a station a package can be routed to.
const SharesMap * GetShares() const
Get the actual shares as a const pointer so that they can be iterated over.
SharesMap shares
Shares of flow to be sent via specified station (or consumed locally).
void ReleaseShare(StationID st)
Release ("unrestrict") a flow by moving it to the begin of the map and increasing the amount of unres...
void ChangeShare(StationID st, int flow)
Change share for specified station.
void AppendShare(StationID st, uint flow, bool restricted=false)
Add some flow to the end of the shares map.
FlowStat()
Invalid constructor.
void Invalidate()
Reduce all flows to minimum capacity so that they don't get in the way of link usage statistics too m...
uint unrestricted
Limit for unrestricted shares.
FlowStat(StationID st, uint flow, bool restricted=false)
Create a FlowStat with an initial entry.
Iterator to iterate over a tile area (rectangle) of the map.
Minimal stack that uses a pool to avoid pointers.
CargoList that is used for stations.
uint TotalCount() const
Returns total count of cargo at the station, including cargo which is already reserved for loading.
Base class for tile iterators.
TileIndex tile
The current tile we are at.
DirDiff DirDifference(Direction d0, Direction d1)
Calculate the difference between two directions.
Direction ChangeDir(Direction d, DirDiff delta)
Change a direction by a given difference.
Direction
Defines the 8 directions on the map.
@ INVALID_DIR
Flag for an invalid direction.
@ DIR_N
North.
@ DIR_S
South.
@ DIR_W
West.
@ DIR_E
East.
DiagDirection
Enumeration for diagonal directions.
void MarkTilesDirty(bool cargo_change) const
Marks the tiles of the station as dirty.
Definition station.cpp:246
Types related to the industry.
Declaration of link graph types used for cargo distribution.
TileIndexDiff ToTileIndexDiff(TileIndexDiffC tidc)
Return the offset between two tiles from a TileIndexDiffC struct.
Definition map_func.h:439
TileIndexDiff TileDiffXY(int x, int y)
Calculates an offset for the given coordinate(-offset).
Definition map_func.h:388
NewGRF handling of airports.
Functionality related to the temporary and persistent storage arrays for NewGRFs.
Pseudo random number generator.
uint32_t RandomRange(uint32_t limit, const std::source_location location=std::source_location::current())
Pick a random number between 0 and limit - 1, inclusive.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition settings.cpp:59
void ForAllStationsAroundTiles(const TileArea &ta, Func func)
Call a function on all stations that have any part of the requested area within their catchment.
bool IsStationRoadStopTile(Tile t)
Is tile t a road stop station?
bool IsAirportTile(Tile t)
Is this tile a station tile and an airport tile?
bool IsRailStationTile(Tile t)
Is this tile a station tile and a rail station?
StationID GetStationIndex(Tile t)
Get StationID from a tile.
Definition station_map.h:28
RoadStopType
Types of RoadStops.
@ Bus
A standard stop for buses.
StationHadVehicleOfType
The vehicles that may have visited a station.
StationFacility
The facilities a station might be having.
StationType
Station types.
static constexpr uint MAX_CATCHMENT
Maximum catchment for airports with "modified catchment" enabled.
static constexpr uint CA_UNMODIFIED
Catchment for all stations with "modified catchment" disabled.
Finite sTate mAchine (FTA) of an airport.
Definition airport.h:158
Defines the data structure for an airport.
std::vector< AirportTileLayout > layouts
List of layouts composing the airport.
static const AirportSpec dummy
The dummy airport.
const struct AirportFTAClass * fsm
the finite statemachine for the default airports
uint8_t size_y
size of airport in y direction
uint8_t size_x
size of airport in x direction
static const AirportSpec * Get(uint8_t type)
Retrieve airport spec for the given airport.
std::span< const HangarTileTable > depots
Position of the depots on the airports.
All airport-related information.
AirportBlocks blocks
stores which blocks on the airport are taken. was 16 bit earlier on, then 32
TileIndex GetRotatedTileFromOffset(TileIndexDiffC tidc) const
Add the tileoffset to the base tile of this airport but rotate it first.
bool HasHangar() const
Check if this airport has at least one hangar.
uint GetHangarNum(TileIndex tile) const
Get the hangar number of the hangar at a specific tile.
Direction rotation
How this airport is rotated.
uint8_t type
Type of this airport,.
Direction GetHangarExitDirection(TileIndex tile) const
Get the exit direction of the hangar at a specific tile.
PersistentStorage * psa
Persistent storage for NewGRF airports.
uint GetNumHangars() const
Get the number of hangars on this airport.
const AirportFTAClass * GetFTA() const
Get the finite-state machine for this airport or the finite-state machine for the dummy airport in ca...
TileIndex GetHangarTile(uint hangar_num) const
Get the first tile of the given hangar.
const HangarTileTable * GetHangarDataByTile(TileIndex tile) const
Retrieve hangar information of a hangar at a given tile.
const AirportSpec * GetSpec() const
Get the AirportSpec that from the airport type of this airport.
uint8_t layout
Airport layout number.
StationSettings station
settings related to station management
FlowStatMap flows
Planned flows through this station.
StationCargoList cargo
The cargo packets of cargo waiting in this station.
Stores station stats for a single cargo.
uint max_waiting_cargo
Max cargo from this station waiting at any station.
bool HasRating() const
Does this cargo have a rating at this station?
debug_inline GoodsEntryData & GetData()
Get non-const optional cargo packet/flow data.
StationID GetVia(StationID source, StationID excluded, StationID excluded2=StationID::Invalid()) const
Get the best next hop for a cargo packet from station source, optionally excluding one or two station...
void ClearData()
Clear optional cargo packet/flow data.
uint8_t last_speed
Maximum speed (up to 255) of the last vehicle that tried to load this cargo.
uint8_t last_age
Age in years (up to 255) of the last vehicle that tried to load this cargo.
uint8_t time_since_pickup
Number of rating-intervals (up to 255) since the last vehicle tried to load this cargo.
std::unique_ptr< GoodsEntryData > data
Optional cargo packet and flow data.
States status
Status of this cargo, see State.
debug_inline const GoodsEntryData & GetData() const
Get optional cargo packet/flow data.
NodeID node
ID of node in link graph referring to this goods entry.
State
Status of this cargo for the station.
@ LastMonth
Set when cargo was delivered for final delivery last month.
@ Acceptance
Set when the station accepts the cargo currently for final deliveries.
@ EverAccepted
Set when a vehicle ever delivered cargo to the station for final delivery.
@ Rating
This indicates whether a cargo has a rating at the station.
@ AcceptedBigtick
Set when cargo was delivered for final delivery during the current STATION_ACCEPTANCE_TICKS interval.
@ CurrentMonth
Set when cargo was delivered for final delivery this month.
uint8_t amount_fract
Fractional part of the amount in the cargo list.
LinkGraphID link_graph
Link graph this station belongs to.
bool HasVehicleEverTriedLoading() const
Reports whether a vehicle has ever tried to load the cargo at this station.
uint8_t rating
Station rating for this cargo.
GoodsEntryData & GetOrCreateData()
Get optional cargo packet/flow data.
uint8_t ConvertState() const
Convert GoodsEntry status to the form required for NewGRF variables.
debug_inline bool HasData() const
Test if this goods entry has optional cargo packet/flow data.
StationID GetVia(StationID source) const
Get the best next hop for a cargo packet from station source.
A list of all hangar tiles in an airport.
Direction dir
Direction of the exit.
uint8_t hangar_num
The hangar to which this tile belongs.
Defines the internal data of a functional industry.
Definition industry.h:63
Represents the covered area of e.g.
TileIndex tile
The base tile of the area.
OrthogonalTileArea & Expand(int rad)
Expand a tile area by rad tiles in each direction, keeping within map bounds.
Definition tilearea.cpp:123
Class for pooled persistent storage of data.
static size_t GetNumItems()
Returns number of valid items in the pool.
Tindex index
Index of this pool item.
Specification of a rectangle with absolute coordinates of all edges.
Interface for SpriteGroup-s to access the gamestate.
A Stop for a Road Vehicle.
Buses, trucks and trams belong to this class.
Definition roadveh.h:98
Class defining several overloaded accessors so we don't have to cast base stations that often.
static Station * GetIfValid(auto index)
Returns station if the index is a valid index for this station type.
bool modified_catchment
different-size catchment areas
bool serve_neutral_industries
company stations can serve industries with attached neutral stations
Station data structure.
~Station()
Clean up a station by clearing vehicle orders, invalidating windows and removing link stats.
Definition station.cpp:83
uint GetPlatformLength(TileIndex tile, DiagDirection dir) const override
Determines the REMAINING length of a platform, starting at (and including) the given tile.
Definition station.cpp:288
RoadStop * bus_stops
All the road stops.
bool CatchmentCoversTown(TownID t) const
Test if the given town ID is covered by our catchment area.
Definition station.cpp:451
TileArea ship_station
Tile area the ship 'station' part covers.
IndustryType indtype
Industry type to get the name from.
IndustryList industries_near
Cached list of industries near the station that can accept cargo,.
TileArea docking_station
Tile area the docking tiles cover.
CargoTypes always_accepted
Bitmask of always accepted cargo types (by houses, HQs, industry tiles when industry doesn't accept c...
Rect GetCatchmentRect() const
Determines catchment rectangle of this station.
Definition station.cpp:365
void GetTileArea(TileArea *ta, StationType type) const override
Get the tile area for a given station type.
Industry * industry
NOSAVE: Associated industry for neutral stations. (Rebuilt on load from Industry->st)
void MoveSign(TileIndex new_xy) override
Move the station main coordinate somewhere else.
static void RecomputeCatchmentForAll()
Recomputes catchment of all stations.
Definition station.cpp:533
std::array< GoodsEntry, NUM_CARGO > goods
Goods at this station.
void RemoveFromAllNearbyLists()
Remove this station from the nearby stations lists of nearby towns and industries.
Definition station.cpp:426
TileArea bus_station
Tile area the bus 'station' part covers.
bool TileBelongsToRailStation(TileIndex tile) const override
Check whether a specific tile belongs to this station.
BitmapTileArea catchment_tiles
NOSAVE: Set of individual tiles covered by catchment area.
void RecomputeCatchment(bool no_clear_nearby_lists=false)
Recompute tiles covered in our catchment area.
Definition station.cpp:465
uint GetCatchmentRadius() const
Determines the catchment radius of the station.
Definition station.cpp:342
void AfterStationTileSetChange(bool adding, StationType type)
After adding/removing tiles to station, update some station-related stuff.
Airport airport
Tile area the airport covers.
void UpdateVirtCoord() override
Update the virtual coords needed to draw the station sign.
TileArea truck_station
Tile area the truck 'station' part covers.
void AddIndustryToDeliver(Industry *ind, TileIndex tile)
Add nearby industry to station's industries_near list if it accepts cargo.
Definition station.cpp:388
void RemoveIndustryToDeliver(Industry *ind)
Remove nearby industry from station's industries_near list.
Definition station.cpp:414
RoadStop * truck_stops
All the truck stops.
void AddFacility(StationFacility new_facility_bit, TileIndex facil_xy)
Called when new facility is built on the station.
Definition station.cpp:229
A pair-construct of a TileIndexDiff.
Definition map_type.h:31
int16_t x
The x value of the coordinate.
Definition map_type.h:32
int16_t y
The y value of the coordinate.
Definition map_type.h:33
static debug_inline bool IsTileType(Tile tile, TileType type)
Checks if a tile is a given tiletype.
Definition tile_map.h:150
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
Definition tile_type.h:95
@ MP_STATION
A tile of a station.
Definition tile_type.h:53
OrthogonalTileArea TileArea
Shorthand for the much more common orthogonal tile area.