OpenTTD Source: src/station_func.h Source File

OpenTTD Source 13.2.1

station_func.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_FUNC_H
11 #define STATION_FUNC_H
12
13 #include "sprite.h"
14 #include "rail_type.h"
15 #include "road_type.h"
16 #include "vehicle_type.h"
17 #include "economy_func.h"
18 #include "rail.h"
19 #include "road.h"
20 #include "linkgraph/linkgraph_type.h"
21 #include "industry_type.h"
22
23 void ModifyStationRatingAround(TileIndex tile, Owner owner, int amount, uint radius);
24
25 void ShowStationViewWindow(StationID station);
26 void UpdateAllStationVirtCoords();
27 void ClearAllStationCachedNames();
28
29 CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad);
30 CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, CargoTypes *always_accepted = nullptr);
31
32 void UpdateStationAcceptance(Station *st, bool show_msg);
33
34 const DrawTileSprites *GetStationTileLayout(StationType st, byte gfx);
35 void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image);
36
37 bool HasStationInUse(StationID station, bool include_company, CompanyID company);
38
39 void DeleteOilRig(TileIndex t);
40 void UpdateStationDockingTiles(Station *st);
41 void RemoveDockingTile(TileIndex t);
42 void ClearDockingTilesCheckingNeighbours(TileIndex tile);
43 bool IsValidDockingDirectionForDock(TileIndex t, DiagDirection d);
44
45 /* Check if a rail station tile is traversable. */
46 bool IsStationTileBlocked(TileIndex tile);
47
48 bool CanStationTileHavePylons(TileIndex tile);
49 bool CanStationTileHaveWires(TileIndex tile);
50
51 void UpdateAirportsNoise();
52
53 bool SplitGroundSpriteForOverlay(const TileInfo *ti, SpriteID *ground, RailTrackOffset *overlay_offset);
54
55 void IncreaseStats(Station *st, const Vehicle *v, StationID next_station_id, uint32 time);
56 void IncreaseStats(Station *st, CargoID cargo, StationID next_station_id, uint capacity, uint usage, uint32 time, EdgeUpdateMode mode);
57 void RerouteCargo(Station *st, CargoID c, StationID avoid, StationID avoid2);
58
64 static inline Money StationMaintenanceCost(uint32 num)
65 {
66 return (_price[PR_INFRASTRUCTURE_STATION] * num * (1 + IntSqrt(num))) >> 7; // 7 bits scaling.
67 }
68
69 Money AirportMaintenanceCost(Owner owner);
70
71 #endif /* STATION_FUNC_H */
UpdateStationAcceptance
void UpdateStationAcceptance(Station *st, bool show_msg)
Update the acceptance for a station.
Definition: station_cmd.cpp:588
IncreaseStats
void IncreaseStats(Station *st, const Vehicle *v, StationID next_station_id, uint32 time)
Increase capacity for all link stats associated with vehicles in the given consist.
Definition: station_cmd.cpp:3756
TileInfo
Tile information, used while rendering the tile.
Definition: tile_cmd.h:42
ClearDockingTilesCheckingNeighbours
void ClearDockingTilesCheckingNeighbours(TileIndex tile)
Clear docking tile status from tiles around a removed dock, if the tile has no neighbours which would...
Definition: station_cmd.cpp:2583
sprite.h
Station
Station data structure.
Definition: station_base.h:454
CargoArray
Class for storing amounts of cargo.
Definition: cargo_type.h:82
CanStationTileHavePylons
bool CanStationTileHavePylons(TileIndex tile)
Check if a rail station tile shall have pylons when electrified.
Definition: newgrf_station.cpp:870
TileIndex
The index/ID of a Tile.
Definition: tile_type.h:85
IntSqrt
uint32 IntSqrt(uint32 num)
Compute the integer square root.
Definition: math_func.cpp:77
economy_func.h
Vehicle
Vehicle data structure.
Definition: vehicle_base.h:224
Owner
Owner
Enum for all companies/owners.
Definition: company_type.h:18
EdgeUpdateMode
EdgeUpdateMode
Special modes for updating links.
Definition: linkgraph_type.h:52
SpriteID
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
Definition: gfx_type.h:17
StationType
StationType
Station types.
Definition: station_type.h:32
RailType
RailType
Enumeration for all possible railtypes.
Definition: rail_type.h:27
UpdateAllStationVirtCoords
void UpdateAllStationVirtCoords()
Update the virtual coords needed to draw the station sign for all stations.
Definition: station_cmd.cpp:450
IsValidDockingDirectionForDock
bool IsValidDockingDirectionForDock(TileIndex t, DiagDirection d)
Check if a dock tile can be docked from the given direction.
Definition: station_cmd.cpp:2605
RerouteCargo
void RerouteCargo(Station *st, CargoID c, StationID avoid, StationID avoid2)
Reroute cargo of type c at station st or in any vehicles unloading there.
Definition: station_cmd.cpp:3586
SplitGroundSpriteForOverlay
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 ra...
Definition: station_cmd.cpp:2720
DrawTileSprites
Ground palette sprite of a tile, together with its sprite layout.
Definition: sprite.h:58
rail.h
road.h
DiagDirection
DiagDirection
Enumeration for diagonal directions.
Definition: direction_type.h:77
CanStationTileHaveWires
bool CanStationTileHaveWires(TileIndex tile)
Check if a rail station tile shall have wires when electrified.
Definition: newgrf_station.cpp:884
StationMaintenanceCost
static Money StationMaintenanceCost(uint32 num)
Calculates the maintenance cost of a number of station tiles.
Definition: station_func.h:64
ShowStationViewWindow
void ShowStationViewWindow(StationID station)
Opens StationViewWindow for given station.
Definition: station_gui.cpp:2117
industry_type.h
UpdateAirportsNoise
void UpdateAirportsNoise()
Recalculate the noise generated by the airports of each town.
Definition: station_cmd.cpp:2186
vehicle_type.h
IsStationTileBlocked
bool IsStationTileBlocked(TileIndex tile)
Check whether a rail station tile is NOT traversable.
Definition: newgrf_station.cpp:857
RailTrackOffset
RailTrackOffset
Offsets for sprites within an overlay/underlay set.
Definition: rail.h:67
HasStationInUse
bool HasStationInUse(StationID station, bool include_company, CompanyID company)
Tests whether the company's vehicles have this station in orders.
Definition: station_cmd.cpp:2445
RoadType
RoadType
The different roadtypes we support.
Definition: road_type.h:22
GetAcceptanceAroundTiles
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.
Definition: station_cmd.cpp:548
rail_type.h
AirportMaintenanceCost
Money AirportMaintenanceCost(Owner owner)
Calculates the maintenance cost of all airports of a company.
Definition: station.cpp:674
linkgraph_type.h
road_type.h
OverflowSafeInt< int64 >
CargoID
byte CargoID
Cargo slots to indicate a cargo type within a game.
Definition: cargo_type.h:20
GetProductionAroundTiles
CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad)
Get the cargo types being produced around the tile (in a rectangle).
Definition: station_cmd.cpp:509