Functions related to stations. More...
#include "sprite.h"
#include "rail_type.h"
#include "road_type.h"
#include "vehicle_type.h"
#include "economy_func.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) |
Find all stations around a rectangular producer (industry, house, headquarter, ...). | |
void | ShowStationViewWindow (StationID station) |
Opens StationViewWindow for given station. | |
void | UpdateAllStationVirtCoords () |
Update the virtual coords needed to draw the station sign for all stations. | |
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, uint32 *always_accepted=NULL) |
Get the acceptance of cargoes around the tile in 1/8. | |
void | UpdateStationAcceptance (Station *st, bool show_msg) |
Update the acceptance for a station. | |
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. | |
void | DeleteOilRig (TileIndex t) |
bool | IsStationTileBlocked (TileIndex tile) |
Check whether a rail station tile is NOT traversable. | |
bool | IsStationTileElectrifiable (TileIndex tile) |
Check if a rail station tile can be electrified. | |
void | UpdateAirportsNoise () |
Recalculate the noise generated by the airports of each town. | |
void | IncreaseStats (Station *st, const Vehicle *v, StationID next_station_id) |
Increase capacity for all link stats associated with vehicles in the given consist. | |
void | IncreaseStats (Station *st, CargoID cargo, StationID next_station_id, uint capacity, uint usage) |
Increase capacity for a link stat given by station cargo and next hop. | |
void | DeleteStaleFlows (StationID at, CargoID c_id, StationID to) |
Delete all flows at a station for specific cargo and destination. | |
static Money | StationMaintenanceCost (uint32 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 550 of file station.cpp.
References Station::airport, FACIL_AIRPORT, BaseStation::facilities, Airport::GetSpec(), AirportSpec::maintenance_cost, and BaseStation::owner.
Referenced by CompaniesGenStatistics(), CompanyInfrastructureWindow::DrawWidget(), CompanyInfrastructureWindow::GetTotalMaintenanceCost(), and CompanyInfrastructureWindow::UpdateWidgetSize().
void DeleteStaleFlows | ( | StationID | at, | |
CargoID | c_id, | |||
StationID | to | |||
) |
Delete all flows at a station for specific cargo and destination.
at | Station to delete flows from. | |
c_id | Cargo for which flows shall be deleted. | |
to | Remote station of flows to be deleted. |
Definition at line 3331 of file station_cmd.cpp.
References FlowStat::EraseShare(), GoodsEntry::flows, SpecializedStation< Station, false >::Get(), and Station::goods.
Referenced by Station::RunAverages(), and Station::~Station().
void FindStationsAroundTiles | ( | const TileArea & | location, | |
StationList * | stations | |||
) |
Find all stations around a rectangular producer (industry, house, headquarter, ...).
location | The location/area of the producer | |
stations | The list to store the stations in |
Definition at line 3583 of file station_cmd.cpp.
References _settings_game, GameSettings::construction, ConstructionSettings::freeform_edges, SpecializedStation< Station, false >::GetByTile(), Station::GetCatchmentRadius(), TileArea::h, SmallVector< T, S >::Include(), IsTileType(), MapSizeX(), MapSizeY(), MAX_CATCHMENT, StationSettings::modified_catchment, MP_STATION, GameSettings::station, TileArea::tile, TileX(), TileXY(), TileY(), and TileArea::w.
Referenced by StationFinder::GetStations(), and WhoCanServiceIndustry().
CargoArray GetAcceptanceAroundTiles | ( | TileIndex | tile, | |
int | w, | |||
int | h, | |||
int | rad, | |||
uint32 * | 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 NULL |
Definition at line 509 of file station_cmd.cpp.
References MapSizeX(), MapSizeY(), max(), min(), TileX(), TileXY(), and TileY().
Referenced by DrawStationCoverageAreaText(), and UpdateStationAcceptance().
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 456 of file station_cmd.cpp.
References CT_INVALID, TileArea::Intersects(), lengthof, Industry::location, MapSizeX(), MapSizeY(), max(), min(), Industry::produced_cargo, TILE_AREA_LOOP, TileX(), TileXY(), and TileY().
Referenced by DrawStationCoverageAreaText().
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 2393 of file station_cmd.cpp.
References FOR_ALL_VEHICLES, Order::GetDestination(), Order::IsType(), and Vehicle::owner.
Referenced by CompanyStationsWindow::BuildStationsList(), and RemoveBuoy().
void IncreaseStats | ( | Station * | st, | |
CargoID | cargo, | |||
StationID | next_station_id, | |||
uint | capacity, | |||
uint | usage | |||
) |
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. If UINT_MAX refresh the link instead of increasing. |
Definition at line 3394 of file station_cmd.cpp.
References SpecializedStation< Station, false >::Get(), GetMovingAverageLength(), Station::goods, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, and GoodsEntry::link_stats.
Referenced by Vehicle::BeginLoading(), IncreaseStats(), and Vehicle::RefreshNextHopsStats().
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 3421 of file station_cmd.cpp.
References Vehicle::cargo, Vehicle::cargo_type, CargoList< Tinst, Tcont >::Count(), IncreaseStats(), Vehicle::Next(), and Vehicle::refit_cap.
bool IsStationTileBlocked | ( | TileIndex | tile | ) |
Check whether a rail station tile is NOT traversable.
tile | Tile to test. |
Definition at line 890 of file newgrf_station.cpp.
References StationSpec::blocked, GetStationGfx(), and HasBit().
Referenced by AfterLoadCompanyStats(), CmdBuildRailStation(), CmdConvertRail(), ExploreSegment(), IsCompatibleTrainStationTile(), RemoveFromRailBaseStation(), and RemoveRailStation().
bool IsStationTileElectrifiable | ( | TileIndex | tile | ) |
Check if a rail station tile can be electrified.
tile | Tile to test. |
Definition at line 903 of file newgrf_station.cpp.
References GetStationGfx(), HasBit(), StationSpec::pylons, and StationSpec::wires.
Referenced by GetRailTrackBitsUniversal().
void ShowStationViewWindow | ( | StationID | station | ) |
Opens StationViewWindow for given station.
station | station which window should be opened |
Definition at line 1899 of file station_gui.cpp.
static Money StationMaintenanceCost | ( | uint32 | num | ) | [inline, static] |
Calculates the maintenance cost of a number of station tiles.
num | Number of station tiles. |
Definition at line 59 of file station_func.h.
References IntSqrt().
Referenced by CompaniesGenStatistics(), CompanyInfrastructureWindow::DrawWidget(), CompanyInfrastructureWindow::GetTotalMaintenanceCost(), and CompanyInfrastructureWindow::UpdateWidgetSize().
void UpdateAllStationVirtCoords | ( | ) |
Update the virtual coords needed to draw the station sign for all stations.
Definition at line 411 of file station_cmd.cpp.
References BaseStation::UpdateVirtCoord().
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 544 of file station_cmd.cpp.
References _local_company, GoodsEntry::acceptance_pickup, Station::always_accepted, CC_PASSENGERS, CT_INVALID, FACIL_BUS_STOP, FACIL_TRUCK_STOP, BaseStation::facilities, GoodsEntry::GES_ACCEPTANCE, GetAcceptanceAroundTiles(), GetAcceptanceMask(), Station::GetCatchmentRadius(), Station::goods, HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, IsCargoInClass(), BaseStation::IsInUse(), lengthof, min(), BaseStation::owner, BaseStation::rect, SB(), SetWindowWidgetDirty(), ShowRejectOrAcceptNews(), TileXY(), WC_STATION_VIEW, and WID_SV_ACCEPT_RATING_LIST.
Referenced by AfterLoadGame(), CmdBuildAirport(), CmdBuildDock(), CmdBuildRailStation(), CmdBuildRoadStop(), and StationHandleBigTick().