(svn r27985) -Codechange: Convert VA2 switches into ones with non-overlapping ranges...
[openttd.git] / src / station_func.h
blobf33dbd21fb905eb4308432df0d71881317ec581a
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 "linkgraph/linkgraph_type.h"
23 void ModifyStationRatingAround(TileIndex tile, Owner owner, int amount, uint radius);
25 void FindStationsAroundTiles(const TileArea &location, StationList *stations);
27 void ShowStationViewWindow(StationID station);
28 void UpdateAllStationVirtCoords();
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);
33 void UpdateStationAcceptance(Station *st, bool show_msg);
35 const DrawTileSprites *GetStationTileLayout(StationType st, byte gfx);
36 void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image);
38 bool HasStationInUse(StationID station, bool include_company, CompanyID company);
40 void DeleteOilRig(TileIndex t);
42 /* Check if a rail station tile is traversable. */
43 bool IsStationTileBlocked(TileIndex tile);
45 bool CanStationTileHavePylons(TileIndex tile);
46 bool CanStationTileHaveWires(TileIndex tile);
48 void UpdateAirportsNoise();
50 bool SplitGroundSpriteForOverlay(const TileInfo *ti, SpriteID *ground, RailTrackOffset *overlay_offset);
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);
56 /**
57 * Calculates the maintenance cost of a number of station tiles.
58 * @param num Number of station tiles.
59 * @return Total cost.
61 static inline Money StationMaintenanceCost(uint32 num)
63 return (_price[PR_INFRASTRUCTURE_STATION] * num * (1 + IntSqrt(num))) >> 7; // 7 bits scaling.
66 Money AirportMaintenanceCost(Owner owner);
68 #endif /* STATION_FUNC_H */