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
);
33 CargoTypes
GetAcceptanceMask(const Station
*st
);
34 CargoTypes
GetEmptyMask(const Station
*st
);
36 void SetRailStationTileFlags(TileIndex tile
, const StationSpec
*statspec
);
37 const DrawTileSprites
*GetStationTileLayout(StationType st
, uint8_t gfx
);
38 void StationPickerDrawSprite(int x
, int y
, StationType st
, RailType railtype
, RoadType roadtype
, int image
);
40 bool HasStationInUse(StationID station
, bool include_company
, CompanyID company
);
42 void DeleteOilRig(TileIndex t
);
43 void UpdateStationDockingTiles(Station
*st
);
44 void RemoveDockingTile(TileIndex t
);
45 void ClearDockingTilesCheckingNeighbours(TileIndex tile
);
47 void UpdateAirportsNoise();
49 bool SplitGroundSpriteForOverlay(const TileInfo
*ti
, SpriteID
*ground
, RailTrackOffset
*overlay_offset
);
51 void IncreaseStats(Station
*st
, const Vehicle
*v
, StationID next_station_id
, uint32_t time
);
52 void IncreaseStats(Station
*st
, CargoID cargo
, StationID next_station_id
, uint capacity
, uint usage
, uint32_t time
, EdgeUpdateMode mode
);
53 void RerouteCargo(Station
*st
, CargoID c
, StationID avoid
, StationID avoid2
);
56 * Calculates the maintenance cost of a number of station tiles.
57 * @param num Number of station tiles.
60 inline Money
StationMaintenanceCost(uint32_t num
)
62 return (_price
[PR_INFRASTRUCTURE_STATION
] * num
* (1 + IntSqrt(num
))) >> 7; // 7 bits scaling.
65 Money
AirportMaintenanceCost(Owner owner
);
67 #endif /* STATION_FUNC_H */