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 ShowStationViewWindow(StationID station
);
26 void UpdateAllStationVirtCoords();
27 void ClearAllStationCachedNames();
29 CargoArray
GetProductionAroundTiles(TileIndex tile
, int w
, int h
, int rad
);
30 CargoArray
GetAcceptanceAroundTiles(TileIndex tile
, int w
, int h
, int rad
, CargoTypes
*always_accepted
= nullptr);
32 void UpdateStationAcceptance(Station
*st
, bool show_msg
);
34 const DrawTileSprites
*GetStationTileLayout(StationType st
, byte gfx
);
35 void StationPickerDrawSprite(int x
, int y
, StationType st
, RailType railtype
, RoadType roadtype
, int image
);
37 bool HasStationInUse(StationID station
, bool include_company
, CompanyID company
);
39 void DeleteOilRig(TileIndex t
);
40 void UpdateStationDockingTiles(Station
*st
);
41 void RemoveDockingTile(TileIndex t
);
42 void ClearDockingTilesCheckingNeighbours(TileIndex tile
);
43 bool IsValidDockingDirectionForDock(TileIndex t
, DiagDirection d
);
45 /* Check if a rail station tile is traversable. */
46 bool IsStationTileBlocked(TileIndex tile
);
48 bool CanStationTileHavePylons(TileIndex tile
);
49 bool CanStationTileHaveWires(TileIndex tile
);
51 void UpdateAirportsNoise();
53 bool SplitGroundSpriteForOverlay(const TileInfo
*ti
, SpriteID
*ground
, RailTrackOffset
*overlay_offset
);
55 void IncreaseStats(Station
*st
, const Vehicle
*v
, StationID next_station_id
, uint32 time
);
56 void IncreaseStats(Station
*st
, CargoID cargo
, StationID next_station_id
, uint capacity
, uint usage
, uint32 time
, EdgeUpdateMode mode
);
57 void RerouteCargo(Station
*st
, CargoID c
, StationID avoid
, StationID avoid2
);
60 * Calculates the maintenance cost of a number of station tiles.
61 * @param num Number of station tiles.
64 static inline Money
StationMaintenanceCost(uint32 num
)
66 return (_price
[PR_INFRASTRUCTURE_STATION
] * num
* (1 + IntSqrt(num
))) >> 7; // 7 bits scaling.
69 Money
AirportMaintenanceCost(Owner owner
);
71 #endif /* STATION_FUNC_H */