Remove unused string code SCC_STRING_ID
[openttd/fttd.git] / src / station_func.h
blobec2b335e7f808ea167f92b582127a4887892a1ca
1 /* $Id$ */
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 */
10 /** @file station_func.h Functions related to stations. */
12 #ifndef STATION_FUNC_H
13 #define STATION_FUNC_H
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 "map/coord.h"
22 #include "map/class.h"
23 #include "map/rail.h"
24 #include "map/depot.h"
25 #include "map/station.h"
27 bool IsHangar(TileIndex t);
29 /**
30 * Is tile \a t an hangar tile?
31 * @param t Tile to check
32 * @return \c true if the tile is an hangar
34 static inline bool IsHangarTile(TileIndex t)
36 return IsStationTile(t) && IsHangar(t);
39 void ModifyStationRatingAround(TileIndex tile, Owner owner, int amount, uint radius);
41 void FindStationsAroundTiles(const TileArea &location, StationList *stations);
43 void ShowStationViewWindow(StationID station);
44 void UpdateAllStationVirtCoords();
46 CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad);
47 CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, uint32 *always_accepted = NULL);
49 void UpdateStationAcceptance(Station *st, bool show_msg);
51 const DrawTileSprites *GetStationTileLayout(StationType st, byte gfx);
52 void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image);
54 bool HasStationInUse(StationID station, bool include_company, CompanyID company);
56 void DeleteOilRig(TileIndex t);
58 /* Check if a rail station tile is traversable. */
59 bool IsStationTileBlocked(TileIndex tile);
61 /**
62 * Is the given tile a tile with a depot on it?
63 * @param tile the tile to check
64 * @return true if and only if there is a depot on the tile.
66 static inline bool IsDepotTile(TileIndex tile)
68 return IsGroundDepotTile(tile) || IsShipDepotTile(tile) || IsHangarTile(tile);
71 /**
72 * Check if a tile is a valid continuation to a railstation tile.
73 * The tile \a test_tile is a valid continuation to \a station_tile, if all of the following are true:
74 * \li \a test_tile is a rail station tile
75 * \li the railtype of \a test_tile is compatible with the railtype of \a station_tile
76 * \li the tracks on \a test_tile and \a station_tile are in the same direction
77 * \li both tiles belong to the same station
78 * \li \a test_tile is not blocked (@see IsStationTileBlocked)
79 * @param test_tile Tile to test
80 * @param station_tile Station tile to compare with
81 * @pre IsRailStationTile(station_tile)
82 * @return true if the two tiles are compatible
84 static inline bool IsCompatibleTrainStationTile(TileIndex test_tile, TileIndex station_tile)
86 assert(IsRailStationTile(station_tile));
87 return IsRailStationTile(test_tile) && IsCompatibleRail(GetRailType(test_tile), GetRailType(station_tile)) &&
88 GetRailStationAxis(test_tile) == GetRailStationAxis(station_tile) &&
89 GetStationIndex(test_tile) == GetStationIndex(station_tile) &&
90 !IsStationTileBlocked(test_tile);
93 bool CanStationTileHavePylons(TileIndex tile);
94 bool CanStationTileHaveWires(TileIndex tile);
96 void UpdateAirportsNoise();
98 bool SplitGroundSpriteForOverlay(const TileInfo *ti, SpriteID *ground, RailTrackOffset *overlay_offset);
100 void IncreaseStats(Station *st, const Vehicle *v, StationID next_station_id);
101 void IncreaseStats(Station *st, CargoID cargo, StationID next_station_id, uint capacity, uint usage);
102 void RerouteCargo(Station *st, CargoID c, StationID avoid, StationID avoid2);
105 * Calculates the maintenance cost of a number of station tiles.
106 * @param num Number of station tiles.
107 * @return Total cost.
109 static inline Money StationMaintenanceCost(uint32 num)
111 return (_price[PR_INFRASTRUCTURE_STATION] * num * (1 + IntSqrt(num))) >> 7; // 7 bits scaling.
114 Money AirportMaintenanceCost(Owner owner);
116 #endif /* STATION_FUNC_H */