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/>.
8 /** @file station_func.h Functions related to stations. */
10 #ifndef STATION_FUNC_H
11 #define STATION_FUNC_H
14 #include "rail_type.h"
15 #include "road_type.h"
16 #include "vehicle_type.h"
17 #include "economy_func.h"
20 #include "linkgraph/linkgraph_type.h"
21 #include "industry_type.h"
23 void ModifyStationRatingAround(TileIndex tile
, Owner owner
, int amount
, uint radius
);
25 void FindStationsAroundTiles(const TileArea
&location
, StationList
*stations
, bool use_nearby
= true);
27 void ShowStationViewWindow(StationID station
);
28 void UpdateAllStationVirtCoords();
29 void ClearAllStationCachedNames();
31 CargoArray
GetProductionAroundTiles(TileIndex tile
, int w
, int h
, int rad
);
32 CargoArray
GetAcceptanceAroundTiles(TileIndex tile
, int w
, int h
, int rad
, CargoTypes
*always_accepted
= nullptr);
34 void UpdateStationAcceptance(Station
*st
, bool show_msg
);
36 const DrawTileSprites
*GetStationTileLayout(StationType st
, byte gfx
);
37 void StationPickerDrawSprite(int x
, int y
, StationType st
, RailType railtype
, RoadType roadtype
, int image
);
39 bool HasStationInUse(StationID station
, bool include_company
, CompanyID company
);
41 void DeleteOilRig(TileIndex t
);
42 void UpdateStationDockingTiles(Station
*st
);
43 void RemoveDockingTile(TileIndex t
);
44 void ClearDockingTilesCheckingNeighbours(TileIndex tile
);
45 bool IsValidDockingDirectionForDock(TileIndex t
, DiagDirection d
);
47 /* Check if a rail station tile is traversable. */
48 bool IsStationTileBlocked(TileIndex tile
);
50 bool CanStationTileHavePylons(TileIndex tile
);
51 bool CanStationTileHaveWires(TileIndex tile
);
53 void UpdateAirportsNoise();
55 bool SplitGroundSpriteForOverlay(const TileInfo
*ti
, SpriteID
*ground
, RailTrackOffset
*overlay_offset
);
57 void IncreaseStats(Station
*st
, const Vehicle
*v
, StationID next_station_id
);
58 void IncreaseStats(Station
*st
, CargoID cargo
, StationID next_station_id
, uint capacity
, uint usage
, EdgeUpdateMode mode
);
59 void RerouteCargo(Station
*st
, CargoID c
, StationID avoid
, StationID avoid2
);
62 * Calculates the maintenance cost of a number of station tiles.
63 * @param num Number of station tiles.
66 static inline Money
StationMaintenanceCost(uint32 num
)
68 return (_price
[PR_INFRASTRUCTURE_STATION
] * num
* (1 + IntSqrt(num
))) >> 7; // 7 bits scaling.
71 Money
AirportMaintenanceCost(Owner owner
);
73 #endif /* STATION_FUNC_H */