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"
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);
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. */
44 
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 
67 
68 #endif /* STATION_FUNC_H */
void UpdateAirportsNoise()
Recalculate the noise generated by the airports of each town.
Enums and other types related to roads.
Tile information, used while rendering the tile.
Definition: tile_cmd.h:44
RailType
Enumeration for all possible railtypes.
Definition: rail_type.h:29
Rail specific functions.
Vehicle data structure.
Definition: vehicle_base.h:212
Money AirportMaintenanceCost(Owner owner)
Calculates the maintenance cost of all airports of a company.
Definition: station.cpp:558
bool HasStationInUse(StationID station, bool include_company, CompanyID company)
Tests whether the company&#39;s vehicles have this station in orders.
RoadType
The different roadtypes we support.
Definition: road_type.h:22
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...
void RerouteCargo(Station *st, CargoID c, StationID avoid, StationID avoid2)
Reroute cargo of type c at station st or in any vehicles unloading there.
Ground palette sprite of a tile, together with its sprite layout.
Definition: sprite.h:60
bool CanStationTileHavePylons(TileIndex tile)
Check if a rail station tile shall have pylons when electrified.
bool CanStationTileHaveWires(TileIndex tile)
Check if a rail station tile shall have wires when electrified.
Represents the covered area of e.g.
Definition: tilearea_type.h:18
void FindStationsAroundTiles(const TileArea &location, StationList *stations)
Find all stations around a rectangular producer (industry, house, headquarter, ...)
bool IsStationTileBlocked(TileIndex tile)
Check whether a rail station tile is NOT traversable.
Declaration of link graph types used for cargo distribution.
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 ShowStationViewWindow(StationID station)
Opens StationViewWindow for given station.
EdgeUpdateMode
Special modes for updating links.
StationType
Station types.
Definition: station_type.h:35
Class for storing amounts of cargo.
Definition: cargo_type.h:74
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
Definition: gfx_type.h:19
static Money StationMaintenanceCost(uint32 num)
Calculates the maintenance cost of a number of station tiles.
Definition: station_func.h:61
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:80
Functions related to the economy.
Types related to vehicles.
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.
Base for drawing complex sprites.
void UpdateAllStationVirtCoords()
Update the virtual coords needed to draw the station sign for all stations.
RailTrackOffset
Offsets for sprites within an overlay/underlay set.
Definition: rail.h:59
uint32 IntSqrt(uint32 num)
Compute the integer square root.
Definition: math_func.cpp:79
void UpdateStationAcceptance(Station *st, bool show_msg)
Update the acceptance for a station.
byte CargoID
Cargo slots to indicate a cargo type within a game.
Definition: cargo_type.h:22
Owner
Enum for all companies/owners.
Definition: company_type.h:20
Station data structure.
Definition: station_base.h:446
CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad)
Get the cargo types being produced around the tile (in a rectangle).
The different types of rail.