|
OpenTTD Source 20251116-master-g21329071df
|
Functions related to stations. More...
#include "sprite.h"#include "rail_type.h"#include "road_type.h"#include "vehicle_type.h"#include "economy_func.h"#include "rail.h"#include "road.h"#include "linkgraph/linkgraph_type.h"#include "industry_type.h"Go to the source code of this file.
Functions | |
| void | ModifyStationRatingAround (TileIndex tile, Owner owner, int amount, uint radius) |
| Forcibly modify station ratings near a given tile. | |
| void | ShowStationViewWindow (StationID station) |
| Opens StationViewWindow for given station. | |
| void | UpdateAllStationVirtCoords () |
| Update the virtual coords needed to draw the station sign for all stations. | |
| void | ClearAllStationCachedNames () |
| CargoArray | GetProductionAroundTiles (TileIndex tile, int w, int h, int rad) |
| Get the cargo types being produced around the tile (in a rectangle). | |
| CargoArray | GetAcceptanceAroundTiles (TileIndex tile, int w, int h, int rad, CargoTypes *always_accepted=nullptr) |
| Get the acceptance of cargoes around the tile in 1/8. | |
| void | UpdateStationAcceptance (Station *st, bool show_msg) |
| Update the acceptance for a station. | |
| CargoTypes | GetAcceptanceMask (const Station *st) |
| Get a mask of the cargo types that the station accepts. | |
| CargoTypes | GetEmptyMask (const Station *st) |
| Get a mask of the cargo types that are empty at the station. | |
| void | SetRailStationTileFlags (TileIndex tile, const StationSpec *statspec) |
| Set rail station tile flags for the given tile. | |
| const DrawTileSprites * | GetStationTileLayout (StationType st, uint8_t gfx) |
| Get station tile layout for a station type and its station gfx. | |
| void | StationPickerDrawSprite (int x, int y, StationType st, RailType railtype, RoadType roadtype, int image) |
| bool | HasStationInUse (StationID station, bool include_company, CompanyID company) |
| Tests whether the company's vehicles have this station in orders. | |
| void | DeleteOilRig (TileIndex t) |
| void | UpdateStationDockingTiles (Station *st) |
| void | RemoveDockingTile (TileIndex t) |
| void | ClearDockingTilesCheckingNeighbours (TileIndex tile) |
| Clear docking tile status from tiles around a removed dock, if the tile has no neighbours which would keep it as a docking tile. | |
| void | UpdateAirportsNoise () |
| Recalculate the noise generated by the airports of each town. | |
| bool | SplitGroundSpriteForOverlay (const TileInfo *ti, SpriteID *ground, RailTrackOffset *overlay_offset) |
| Check whether a sprite is a track sprite, which can be replaced by a non-track ground sprite and a rail overlay. | |
| void | IncreaseStats (Station *st, const Vehicle *v, StationID next_station_id, uint32_t time) |
| Increase capacity for all link stats associated with vehicles in the given consist. | |
| void | IncreaseStats (Station *st, CargoType cargo, StationID next_station_id, uint capacity, uint usage, uint32_t time, EdgeUpdateModes modes) |
| Increase capacity for a link stat given by station cargo and next hop. | |
| void | RerouteCargo (Station *st, CargoType cargo, StationID avoid, StationID avoid2) |
| Reroute cargo of type c at station st or in any vehicles unloading there. | |
| Money | StationMaintenanceCost (uint32_t num) |
| Calculates the maintenance cost of a number of station tiles. | |
| Money | AirportMaintenanceCost (Owner owner) |
| Calculates the maintenance cost of all airports of a company. | |
Functions related to stations.
Definition in file station_func.h.
Calculates the maintenance cost of all airports of a company.
| owner | Company. |
Definition at line 713 of file station.cpp.
References Airport, BaseStation::facilities, SpecializedStation< Station, false >::Iterate(), BaseStation::owner, and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().
Referenced by CompaniesGenStatistics().
| void ClearAllStationCachedNames | ( | ) |
Definition at line 475 of file station_cmd.cpp.
| void ClearDockingTilesCheckingNeighbours | ( | TileIndex | tile | ) |
Clear docking tile status from tiles around a removed dock, if the tile has no neighbours which would keep it as a docking tile.
| tile | Ex-dock tile to check. |
Definition at line 2984 of file station_cmd.cpp.
References CheckForDockingTile(), DIAGDIR_BEGIN, DIAGDIR_END, IsValidTile(), SetDockingTile(), and TileOffsByDiagDir().
Referenced by RemoveDock().
| void DeleteOilRig | ( | TileIndex | t | ) |
Definition at line 4689 of file station_cmd.cpp.
| CargoArray GetAcceptanceAroundTiles | ( | TileIndex | center_tile, |
| int | w, | ||
| int | h, | ||
| int | rad, | ||
| CargoTypes * | always_accepted | ||
| ) |
Get the acceptance of cargoes around the tile in 1/8.
| center_tile | Center of the search area |
| w | X extent of area |
| h | Y extent of area |
| rad | Search radius in addition to given area |
| always_accepted | bitmask of cargo accepted by houses and headquarters; can be nullptr |
| ind | Industry associated with neutral station (e.g. oil rig) or nullptr |
Definition at line 569 of file station_cmd.cpp.
References _settings_game, OrthogonalTileArea::Expand(), Industry::GetByTile(), IsTileType(), MP_INDUSTRY, Industry::neutral_station, StationSettings::serve_neutral_industries, and GameSettings::station.
Referenced by DrawStationCoverageAreaText().
| CargoTypes GetAcceptanceMask | ( | const Station * | st | ) |
Get a mask of the cargo types that the station accepts.
| st | Station to query |
Definition at line 487 of file station_cmd.cpp.
References GoodsEntry::Acceptance, Station::goods, and SetBit().
Referenced by StationViewWindow::DrawAcceptedCargo(), and UpdateStationAcceptance().
| CargoTypes GetEmptyMask | ( | const Station * | st | ) |
Get a mask of the cargo types that are empty at the station.
| st | Station to query |
Definition at line 502 of file station_cmd.cpp.
References Station::goods, and SetBit().
Referenced by TriggerRoadStopRandomisation(), and TriggerStationRandomisation().
| CargoArray GetProductionAroundTiles | ( | TileIndex | north_tile, |
| int | w, | ||
| int | h, | ||
| int | rad | ||
| ) |
Get the cargo types being produced around the tile (in a rectangle).
| north_tile | Northern most tile of area |
| w | X extent of the area |
| h | Y extent of the area |
| rad | Search radius in addition to the given area |
Definition at line 531 of file station_cmd.cpp.
References _settings_game, OrthogonalTileArea::Expand(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_industry_pool >::Get(), GetIndustryIndex(), FlatSet< Tkey, Tcompare >::insert(), IsTileType(), IsValidCargoType(), MP_INDUSTRY, Industry::neutral_station, Industry::produced, StationSettings::serve_neutral_industries, and GameSettings::station.
Referenced by DrawStationCoverageAreaText().
| const DrawTileSprites * GetStationTileLayout | ( | StationType | st, |
| uint8_t | gfx | ||
| ) |
Get station tile layout for a station type and its station gfx.
| st | Station type to draw. |
| gfx | StationGfx of tile to draw. |
Definition at line 3098 of file station_cmd.cpp.
References to_underlying().
Referenced by DrawStationTile().
Tests whether the company's vehicles have this station in orders.
| station | station ID |
| include_company | If true only check vehicles of company, if false only check vehicles of other companies |
| company | company ID |
Definition at line 2842 of file station_cmd.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_orderlist_pool >::Iterate(), and Vehicle::owner.
Referenced by CompanyStationsWindow::BuildStationsList(), and RemoveBuoy().
| void IncreaseStats | ( | Station * | st, |
| CargoType | cargo, | ||
| StationID | next_station_id, | ||
| uint | capacity, | ||
| uint | usage, | ||
| uint32_t | time, | ||
| EdgeUpdateModes | modes | ||
| ) |
Increase capacity for a link stat given by station cargo and next hop.
| st | Station to get the link stats from. |
| cargo | Cargo to increase stat for. |
| next_station_id | Station the consist will be travelling to next. |
| capacity | Capacity to add to link stat. |
| usage | Usage to add to link stat. |
| mode | Update mode to be applied. |
Definition at line 4245 of file station_cmd.cpp.
References LinkGraph::AddNode(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_link_graph_pool >::CanAllocateItem(), Debug, LinkGraphSchedule::Dequeue(), SpecializedStation< Station, false >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_link_graph_pool >::Get(), Station::goods, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, LinkGraphSchedule::instance, GoodsEntry::link_graph, LinkGraph::Merge(), GoodsEntry::node, LinkGraphSchedule::Queue(), and LinkGraph::Size().
Referenced by Vehicle::BeginLoading(), IncreaseStats(), and LinkRefresher::RefreshStats().
| void IncreaseStats | ( | Station * | st, |
| const Vehicle * | front, | ||
| StationID | next_station_id, | ||
| uint32_t | time | ||
| ) |
Increase capacity for all link stats associated with vehicles in the given consist.
| st | Station to get the link stats from. |
| front | First vehicle in the consist. |
| next_station_id | Station the consist will be travelling to next. |
Definition at line 4297 of file station_cmd.cpp.
References Vehicle::cargo, Vehicle::cargo_type, Increase, IncreaseStats(), Vehicle::Next(), Vehicle::refit_cap, and VehicleCargoList::StoredCount().
Forcibly modify station ratings near a given tile.
Used when a crash hurts a company's station ratings nearby, or when local authority actions affect nearby ratings.
| tile | The center of the ratings change area. |
| owner | The station owner whose stations are affected. |
| amount | The amount to change the rating. |
| radius | The radius to search for stations, from the origin tile. |
Definition at line 4371 of file station_cmd.cpp.
References DistanceManhattan(), ForAllStationsRadius(), BaseStation::owner, and BaseStation::xy.
Referenced by CheckTrainCollision(), CrashAirplane(), TownActionAdvertiseLarge(), TownActionAdvertiseMedium(), TownActionAdvertiseSmall(), and TownActionBuyRights().
| void RemoveDockingTile | ( | TileIndex | t | ) |
Definition at line 2963 of file station_cmd.cpp.
Reroute cargo of type c at station st or in any vehicles unloading there.
Make sure the cargo's new next hop is neither "avoid" nor "avoid2".
| st | Station to be rerouted at. |
| cargo | Type of cargo. |
| avoid | Original next hop of cargo, avoid this. |
| avoid2 | Another station to be avoided when rerouting. |
Definition at line 4127 of file station_cmd.cpp.
References GoodsEntry::GoodsEntryData::cargo, GoodsEntry::GetData(), Station::goods, GoodsEntry::HasData(), Vehicle::Next(), and StationCargoList::Reroute().
Referenced by DeleteStaleLinks(), LinkGraphJob::~LinkGraphJob(), and Station::~Station().
| void SetRailStationTileFlags | ( | TileIndex | tile, |
| const StationSpec * | statspec | ||
| ) |
Set rail station tile flags for the given tile.
| tile | Tile to set flags on. |
| statspec | Statspec of the tile. |
Definition at line 1400 of file station_cmd.cpp.
References StationSpec::Blocked, GetStationGfx(), GetStationTileFlags(), StationSpec::NoWires, StationSpec::Pylons, SetStationTileBlocked(), SetStationTileHavePylons(), and SetStationTileHaveWires().
Referenced by CmdBuildRailStation(), and CmdBuildRailWaypoint().
| void ShowStationViewWindow | ( | StationID | station | ) |
Opens StationViewWindow for given station.
| station | station which window should be opened |
Definition at line 2172 of file station_gui.cpp.
| bool SplitGroundSpriteForOverlay | ( | const TileInfo * | ti, |
| SpriteID * | ground, | ||
| RailTrackOffset * | overlay_offset | ||
| ) |
Check whether a sprite is a track sprite, which can be replaced by a non-track ground sprite and a rail overlay.
If the ground sprite is suitable, ground is replaced with the new non-track ground sprite, and overlay_offset is set to the overlay to draw.
| ti | Positional info for the tile to decide snowyness etc. May be nullptr. | |
| [in,out] | ground | Groundsprite to draw. |
| [out] | overlay_offset | Overlay to draw. |
Definition at line 3114 of file station_cmd.cpp.
References _settings_game, GameSettings::game_creation, GetSnowLine(), GetTropicZone(), GameCreationSettings::landscape, RTO_X, RTO_Y, TileInfo::tile, TILE_HEIGHT, TROPICZONE_DESERT, and Coord3D< T >::z.
Referenced by DrawStationTile().
|
inline |
Calculates the maintenance cost of a number of station tiles.
| num | Number of station tiles. |
Definition at line 60 of file station_func.h.
References IntSqrt().
Referenced by CompaniesGenStatistics().
| void StationPickerDrawSprite | ( | int | x, |
| int | y, | ||
| StationType | st, | ||
| RailType | railtype, | ||
| RoadType | roadtype, | ||
| int | image | ||
| ) |
Definition at line 3500 of file station_cmd.cpp.
| void UpdateAirportsNoise | ( | ) |
Recalculate the noise generated by the airports of each town.
Definition at line 2587 of file station_cmd.cpp.
References AirportGetNearestTown(), AT_OILRIG, GetAirportNoiseLevelForDistance(), INVALID_TILE, SpecializedStation< Station, false >::Iterate(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_town_pool >::Iterate(), and Town::noise_reached.
Referenced by DoCreateTown(), and InitializeWindowsAndCaches().
| void UpdateAllStationVirtCoords | ( | ) |
Update the virtual coords needed to draw the station sign for all stations.
Definition at line 462 of file station_cmd.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_station_pool >::Iterate().
Referenced by CmdRenameTown(), and UpdateAllVirtCoords().
| void UpdateStationAcceptance | ( | Station * | st, |
| bool | show_msg | ||
| ) |
Update the acceptance for a station.
| st | Station to update |
| show_msg | controls whether to display a message that acceptance was changed. |
Definition at line 609 of file station_cmd.cpp.
References _local_company, GoodsEntry::Acceptance, Station::always_accepted, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Any(), BaseStation::facilities, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_link_graph_pool >::Get(), GetAcceptanceAroundStation(), GetAcceptanceMask(), Station::goods, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, IsCargoInClass(), BaseStation::IsInUse(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_link_graph_pool >::IsValidID(), GoodsEntry::link_graph, GoodsEntry::node, NUM_CARGO, BaseStation::owner, Passengers, BaseStation::rect, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Set(), SetWindowWidgetDirty(), ShowRejectOrAcceptNews(), GoodsEntry::status, WC_STATION_VIEW, and WID_SV_ACCEPT_RATING_LIST.
Referenced by AfterLoadGame(), Station::AfterStationTileSetChange(), and StationHandleBigTick().
| void UpdateStationDockingTiles | ( | Station * | st | ) |
Definition at line 4614 of file station_cmd.cpp.