|
OpenTTD Source
1.10.0-RC1
|
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) |
| void | FindStationsAroundTiles (const TileArea &location, StationList *stations, bool use_nearby=true) |
| Find all stations around a rectangular producer (industry, house, headquarter, ...) More... | |
| void | ShowStationViewWindow (StationID station) |
| Opens StationViewWindow for given station. More... | |
| void | UpdateAllStationVirtCoords () |
| Update the virtual coords needed to draw the station sign for all stations. More... | |
| void | ClearAllStationCachedNames () |
| CargoArray | GetProductionAroundTiles (TileIndex tile, int w, int h, int rad) |
| Get the cargo types being produced around the tile (in a rectangle). More... | |
| 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. More... | |
| void | UpdateStationAcceptance (Station *st, bool show_msg) |
| Update the acceptance for a station. More... | |
| const DrawTileSprites * | GetStationTileLayout (StationType st, byte 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. More... | |
| 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. More... | |
| bool | IsValidDockingDirectionForDock (TileIndex t, DiagDirection d) |
| Check if a dock tile can be docked from the given direction. More... | |
| bool | IsStationTileBlocked (TileIndex tile) |
| Check whether a rail station tile is NOT traversable. More... | |
| bool | CanStationTileHavePylons (TileIndex tile) |
| Check if a rail station tile shall have pylons when electrified. More... | |
| bool | CanStationTileHaveWires (TileIndex tile) |
| Check if a rail station tile shall have wires when electrified. More... | |
| 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. More... | |
| void | IncreaseStats (Station *st, const Vehicle *v, StationID next_station_id) |
| Increase capacity for all link stats associated with vehicles in the given consist. More... | |
| void | IncreaseStats (Station *st, CargoID cargo, StationID next_station_id, uint capacity, uint usage, EdgeUpdateMode mode) |
| Increase capacity for a link stat given by station cargo and next hop. More... | |
| void | RerouteCargo (Station *st, CargoID c, StationID avoid, StationID avoid2) |
| Reroute cargo of type c at station st or in any vehicles unloading there. More... | |
| static Money | StationMaintenanceCost (uint32 num) |
| Calculates the maintenance cost of a number of station tiles. More... | |
| Money | AirportMaintenanceCost (Owner owner) |
| Calculates the maintenance cost of all airports of a company. More... | |
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 653 of file station.cpp.
References FACIL_AIRPORT, BaseStation::facilities, SpecializedStation< Station, false >::Iterate(), and BaseStation::owner.
| bool CanStationTileHavePylons | ( | TileIndex | tile | ) |
Check if a rail station tile shall have pylons when electrified.
| tile | Tile to test. |
Definition at line 882 of file newgrf_station.cpp.
| bool CanStationTileHaveWires | ( | TileIndex | tile | ) |
Check if a rail station tile shall have wires when electrified.
| tile | Tile to test. |
Definition at line 896 of file newgrf_station.cpp.
Referenced by MaskWireBits().
| 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 2620 of file station_cmd.cpp.
| void FindStationsAroundTiles | ( | const TileArea & | location, |
| StationList *const | stations, | ||
| bool | use_nearby | ||
| ) |
Find all stations around a rectangular producer (industry, house, headquarter, ...)
| location | The location/area of the producer | |
| [out] | stations | The list to store the stations in |
| use_nearby | Use nearby station list of industry/town associated with location.tile |
Definition at line 3977 of file station_cmd.cpp.
References Industry::GetByTile(), IsTileType(), MP_HOUSE, MP_INDUSTRY, Industry::stations_near, and OrthogonalTileArea::tile.
Referenced by StationFinder::GetStations(), and PopulateStationsNearby().
| CargoArray GetAcceptanceAroundTiles | ( | TileIndex | tile, |
| int | w, | ||
| int | h, | ||
| int | rad, | ||
| CargoTypes * | always_accepted | ||
| ) |
Get the acceptance of cargoes around the tile in 1/8.
| 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 547 of file station_cmd.cpp.
References _settings_game, OrthogonalTileArea::Expand(), Industry::GetByTile(), IsTileType(), MP_INDUSTRY, StationSettings::serve_neutral_industries, GameSettings::station, and TILE_AREA_LOOP.
| CargoArray GetProductionAroundTiles | ( | TileIndex | tile, |
| int | w, | ||
| int | h, | ||
| int | rad | ||
| ) |
Get the cargo types being produced around the tile (in a rectangle).
| tile | Northtile 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 508 of file station_cmd.cpp.
References OrthogonalTileArea::Expand(), GetIndustryIndex(), IsTileType(), MP_INDUSTRY, and TILE_AREA_LOOP.
| bool HasStationInUse | ( | StationID | station, |
| bool | include_company, | ||
| CompanyID | company | ||
| ) |
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 2487 of file station_cmd.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Iterate(), and Vehicle::owner.
Referenced by CompanyStationsWindow::BuildStationsList(), and RemoveBuoy().
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 3793 of file station_cmd.cpp.
References Vehicle::cargo, Vehicle::cargo_type, EUM_INCREASE, IncreaseStats(), min(), Vehicle::Next(), Vehicle::refit_cap, and VehicleCargoList::StoredCount().
| void IncreaseStats | ( | Station * | st, |
| CargoID | cargo, | ||
| StationID | next_station_id, | ||
| uint | capacity, | ||
| uint | usage, | ||
| EdgeUpdateMode | mode | ||
| ) |
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 3741 of file station_cmd.cpp.
References SpecializedStation< Station, false >::Get(), Station::goods, and GoodsEntry::link_graph.
Referenced by IncreaseStats().
| bool IsStationTileBlocked | ( | TileIndex | tile | ) |
Check whether a rail station tile is NOT traversable.
| tile | Tile to test. |
Definition at line 869 of file newgrf_station.cpp.
Referenced by CmdConvertRail().
| bool IsValidDockingDirectionForDock | ( | TileIndex | t, |
| DiagDirection | d | ||
| ) |
Check if a dock tile can be docked from the given direction.
| t | Tile index of dock. |
| d | DiagDirection adjacent to dock being tested. |
Bitmap of valid directions for each dock tile part.
Definition at line 2642 of file station_cmd.cpp.
Referenced by CheckForDockingTile().
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. |
| c | Type of cargo. |
| avoid | Original next hop of cargo, avoid this. |
| avoid2 | Another station to be avoided when rerouting. |
Definition at line 3626 of file station_cmd.cpp.
References GoodsEntry::cargo, Vehicle::cargo, Vehicle::cargo_type, Station::goods, Vehicle::Next(), VehicleCargoList::Reroute(), and StationCargoList::Reroute().
| void ShowStationViewWindow | ( | StationID | station | ) |
Opens StationViewWindow for given station.
| station | station which window should be opened |
Definition at line 2142 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 2760 of file station_cmd.cpp.
|
inlinestatic |
Calculates the maintenance cost of a number of station tiles.
| num | Number of station tiles. |
Definition at line 66 of file station_func.h.
| void UpdateAllStationVirtCoords | ( | ) |
Update the virtual coords needed to draw the station sign for all stations.
Definition at line 449 of file station_cmd.cpp.
References GetStringWithArgs(), SpecializedStation< Waypoint, true >::IsExpected(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_station_pool >::Iterate(), lastof, MAX_CHAR_LENGTH, MAX_LENGTH_STATION_NAME_CHARS, and Station::UpdateVirtCoord().
Referenced by 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 587 of file station_cmd.cpp.
References _local_company, Station::always_accepted, CC_PASSENGERS, CT_INVALID, FACIL_BUS_STOP, FACIL_TRUCK_STOP, BaseStation::facilities, GoodsEntry::GES_ACCEPTANCE, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_link_graph_pool >::Get(), GetAcceptanceAroundStation(), GetAcceptanceMask(), Station::goods, HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, IsCargoInClass(), BaseStation::IsInUse(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_link_graph_pool >::IsValidID(), lengthof, GoodsEntry::link_graph, GoodsEntry::node, NUM_CARGO, BaseStation::owner, BaseStation::rect, SB(), SetWindowWidgetDirty(), ShowRejectOrAcceptNews(), GoodsEntry::status, WC_STATION_VIEW, and WID_SV_ACCEPT_RATING_LIST.
Referenced by StationHandleBigTick().