OpenTTD

station_func.h
Go to the documentation of this file.
1 /* $Id: station_func.h 26549 2014-05-01 14:50:52Z fonsinchen $ */
2
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
8 */
9
12 #ifndef STATION_FUNC_H
13 #define STATION_FUNC_H
14
15 #include "sprite.h"
16 #include "rail_type.h"
17 #include "road_type.h"
18 #include "vehicle_type.h"
19 #include "economy_func.h"
20 #include "rail.h"
21 #include "linkgraph/linkgraph_type.h"
22
23 void ModifyStationRatingAround(TileIndex tile, Owner owner, int amount, uint radius);
24
25 void FindStationsAroundTiles(const TileArea &location, StationList *stations);
26
27 void ShowStationViewWindow(StationID station);
28 void UpdateAllStationVirtCoords();
29
30 CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad);
31 CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, uint32 *always_accepted = NULL);
32
33 void UpdateStationAcceptance(Station *st, bool show_msg);
34
35 const DrawTileSprites *GetStationTileLayout(StationType st, byte gfx);
36 void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image);
37
38 bool HasStationInUse(StationID station, bool include_company, CompanyID company);
39
40 void DeleteOilRig(TileIndex t);
41
42 /* Check if a rail station tile is traversable. */
43 bool IsStationTileBlocked(TileIndex tile);
44
45 bool CanStationTileHavePylons(TileIndex tile);
46 bool CanStationTileHaveWires(TileIndex tile);
47
48 void UpdateAirportsNoise();
49
50 bool SplitGroundSpriteForOverlay(const TileInfo *ti, SpriteID *ground, RailTrackOffset *overlay_offset);
51
52 void IncreaseStats(Station *st, const Vehicle *v, StationID next_station_id);
53 void IncreaseStats(Station *st, CargoID cargo, StationID next_station_id, uint capacity, uint usage, EdgeUpdateMode mode);
54 void RerouteCargo(Station *st, CargoID c, StationID avoid, StationID avoid2);
55
61 static inline Money StationMaintenanceCost(uint32 num)
62 {
63 return (_price[PR_INFRASTRUCTURE_STATION] * num * (1 + IntSqrt(num))) >> 7; // 7 bits scaling.
64 }
65
66 Money AirportMaintenanceCost(Owner owner);
67
68 #endif /* STATION_FUNC_H */
UpdateAirportsNoise
void UpdateAirportsNoise()
Recalculate the noise generated by the airports of each town.
Definition: station_cmd.cpp:2159
road_type.h
Enums and other types related to roads.
TileInfo
Tile information, used while rendering the tile.
Definition: tile_cmd.h:44
RailType
RailType
Enumeration for all possible railtypes.
Definition: rail_type.h:29
rail.h
Rail specific functions.
Vehicle
Vehicle data structure.
Definition: vehicle_base.h:212
AirportMaintenanceCost
Money AirportMaintenanceCost(Owner owner)
Calculates the maintenance cost of all airports of a company.
Definition: station.cpp:558
HasStationInUse
bool HasStationInUse(StationID station, bool include_company, CompanyID company)
Tests whether the company&#39;s vehicles have this station in orders.
Definition: station_cmd.cpp:2434
SmallVector< Station *, 2 >
RoadType
RoadType
The different roadtypes we support.
Definition: road_type.h:22
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:2630
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:3427
DrawTileSprites
Ground palette sprite of a tile, together with its sprite layout.
Definition: sprite.h:60
CanStationTileHavePylons
bool CanStationTileHavePylons(TileIndex tile)
Check if a rail station tile shall have pylons when electrified.
Definition: newgrf_station.cpp:864
CanStationTileHaveWires
bool CanStationTileHaveWires(TileIndex tile)
Check if a rail station tile shall have wires when electrified.
Definition: newgrf_station.cpp:878
OrthogonalTileArea
Represents the covered area of e.g.
Definition: tilearea_type.h:18
FindStationsAroundTiles
void FindStationsAroundTiles(const TileArea &location, StationList *stations)
Find all stations around a rectangular producer (industry, house, headquarter, ...)
Definition: station_cmd.cpp:3778
IsStationTileBlocked
bool IsStationTileBlocked(TileIndex tile)
Check whether a rail station tile is NOT traversable.
Definition: newgrf_station.cpp:851
linkgraph_type.h
Declaration of link graph types used for cargo distribution.
IncreaseStats
void IncreaseStats(Station *st, const Vehicle *v, StationID next_station_id)
Increase capacity for all link stats associated with vehicles in the given consist.
Definition: station_cmd.cpp:3595
ShowStationViewWindow
void ShowStationViewWindow(StationID station)
Opens StationViewWindow for given station.
Definition: station_gui.cpp:2110
EdgeUpdateMode
EdgeUpdateMode
Special modes for updating links.
Definition: linkgraph_type.h:55
StationType
StationType
Station types.
Definition: station_type.h:35
CargoArray
Class for storing amounts of cargo.
Definition: cargo_type.h:74
SpriteID
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
Definition: gfx_type.h:19
StationMaintenanceCost
static Money StationMaintenanceCost(uint32 num)
Calculates the maintenance cost of a number of station tiles.
Definition: station_func.h:61
TileIndex
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:80
economy_func.h
Functions related to the economy.
vehicle_type.h
Types related to vehicles.
GetAcceptanceAroundTiles
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.
Definition: station_cmd.cpp:527
sprite.h
Base for drawing complex sprites.
UpdateAllStationVirtCoords
void UpdateAllStationVirtCoords()
Update the virtual coords needed to draw the station sign for all stations.
Definition: station_cmd.cpp:429
RailTrackOffset
RailTrackOffset
Offsets for sprites within an overlay/underlay set.
Definition: rail.h:59
IntSqrt
uint32 IntSqrt(uint32 num)
Compute the integer square root.
Definition: math_func.cpp:79
UpdateStationAcceptance
void UpdateStationAcceptance(Station *st, bool show_msg)
Update the acceptance for a station.
Definition: station_cmd.cpp:562
CargoID
byte CargoID
Cargo slots to indicate a cargo type within a game.
Definition: cargo_type.h:22
Owner
Owner
Enum for all companies/owners.
Definition: company_type.h:20
Station
Station data structure.
Definition: station_base.h:446
OverflowSafeInt< int64, INT64_MAX, INT64_MIN >
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:474
rail_type.h
The different types of rail.