OpenTTD Source: src/station_func.h Source File

OpenTTD Source 15.0-RC2

station_func.h
Go to the documentation of this file.
1/*
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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#ifndef STATION_FUNC_H
11#define STATION_FUNC_H
12
13#include "sprite.h"
14#include "rail_type.h"
15#include "road_type.h"
16#include "vehicle_type.h"
17#include "economy_func.h"
18#include "rail.h"
19#include "road.h"
20#include "linkgraph/linkgraph_type.h"
21#include "industry_type.h"
22
23void ModifyStationRatingAround(TileIndex tile, Owner owner, int amount, uint radius);
24
25void ShowStationViewWindow(StationID station);
26void UpdateAllStationVirtCoords();
27void ClearAllStationCachedNames();
28
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);
31
32void UpdateStationAcceptance(Station *st, bool show_msg);
33CargoTypes GetAcceptanceMask(const Station *st);
34CargoTypes GetEmptyMask(const Station *st);
35
36void SetRailStationTileFlags(TileIndex tile, const StationSpec *statspec);
37const DrawTileSprites *GetStationTileLayout(StationType st, uint8_t gfx);
38void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image);
39
40bool HasStationInUse(StationID station, bool include_company, CompanyID company);
41
42void DeleteOilRig(TileIndex t);
43void UpdateStationDockingTiles(Station *st);
44void RemoveDockingTile(TileIndex t);
45void ClearDockingTilesCheckingNeighbours(TileIndex tile);
46
47void UpdateAirportsNoise();
48
49bool SplitGroundSpriteForOverlay(const TileInfo *ti, SpriteID *ground, RailTrackOffset *overlay_offset);
50
51void IncreaseStats(Station *st, const Vehicle *v, StationID next_station_id, uint32_t time);
52void IncreaseStats(Station *st, CargoType cargo, StationID next_station_id, uint capacity, uint usage, uint32_t time, EdgeUpdateModes modes);
53void RerouteCargo(Station *st, CargoType cargo, StationID avoid, StationID avoid2);
54
60 inline Money StationMaintenanceCost(uint32_t num)
61{
62 return (_price[PR_INFRASTRUCTURE_STATION] * num * (1 + IntSqrt(num))) >> 7; // 7 bits scaling.
63}
64
65 Money AirportMaintenanceCost(Owner owner);
66
67#endif /* STATION_FUNC_H */
CargoType
uint8_t CargoType
Cargo slots to indicate a cargo type within a game.
Definition cargo_type.h:21
EnumBitSet
Enum-as-bit-set wrapper.
Definition enum_type.hpp:177
OverflowSafeInt< int64_t >
IntSqrt
uint32_t IntSqrt(uint32_t num)
Compute the integer square root.
Definition math_func.cpp:42
economy_func.h
Functions related to the economy.
SpriteID
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
Definition gfx_type.h:17
industry_type.h
Types related to the industry.
linkgraph_type.h
Declaration of link graph types used for cargo distribution.
rail.h
Rail specific functions.
RailTrackOffset
RailTrackOffset
Offsets for sprites within an overlay/underlay set.
Definition rail.h:61
rail_type.h
The different types of rail.
RailType
RailType
Enumeration for all possible railtypes.
Definition rail_type.h:25
road.h
Road specific functions.
road_type.h
Enums and other types related to roads.
RoadType
RoadType
The different roadtypes we support.
Definition road_type.h:23
sprite.h
Base for drawing complex sprites.
GetAcceptanceAroundTiles
CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, CargoTypes *always_accepted=nullptr)
Get the acceptance of cargoes around the tile in 1/8.
Definition station_cmd.cpp:571
GetEmptyMask
CargoTypes GetEmptyMask(const Station *st)
Get a mask of the cargo types that are empty at the station.
Definition station_cmd.cpp:504
ClearDockingTilesCheckingNeighbours
void ClearDockingTilesCheckingNeighbours(TileIndex tile)
Clear docking tile status from tiles around a removed dock, if the tile has no neighbours which would...
Definition station_cmd.cpp:2987
IncreaseStats
void IncreaseStats(Station *st, const Vehicle *v, StationID next_station_id, uint32_t time)
Increase capacity for all link stats associated with vehicles in the given consist.
Definition station_cmd.cpp:4300
HasStationInUse
bool HasStationInUse(StationID station, bool include_company, CompanyID company)
Tests whether the company's vehicles have this station in orders.
Definition station_cmd.cpp:2845
AirportMaintenanceCost
Money AirportMaintenanceCost(Owner owner)
Calculates the maintenance cost of all airports of a company.
Definition station.cpp:713
GetStationTileLayout
const DrawTileSprites * GetStationTileLayout(StationType st, uint8_t gfx)
Get station tile layout for a station type and its station gfx.
Definition station_cmd.cpp:3101
StationMaintenanceCost
Money StationMaintenanceCost(uint32_t num)
Calculates the maintenance cost of a number of station tiles.
Definition station_func.h:60
RerouteCargo
void RerouteCargo(Station *st, CargoType cargo, StationID avoid, StationID avoid2)
Reroute cargo of type c at station st or in any vehicles unloading there.
Definition station_cmd.cpp:4130
ShowStationViewWindow
void ShowStationViewWindow(StationID station)
Opens StationViewWindow for given station.
Definition station_gui.cpp:2174
UpdateAllStationVirtCoords
void UpdateAllStationVirtCoords()
Update the virtual coords needed to draw the station sign for all stations.
Definition station_cmd.cpp:464
GetAcceptanceMask
CargoTypes GetAcceptanceMask(const Station *st)
Get a mask of the cargo types that the station accepts.
Definition station_cmd.cpp:489
UpdateAirportsNoise
void UpdateAirportsNoise()
Recalculate the noise generated by the airports of each town.
Definition station_cmd.cpp:2590
ModifyStationRatingAround
void ModifyStationRatingAround(TileIndex tile, Owner owner, int amount, uint radius)
Forcibly modify station ratings near a given tile.
Definition station_cmd.cpp:4374
UpdateStationAcceptance
void UpdateStationAcceptance(Station *st, bool show_msg)
Update the acceptance for a station.
Definition station_cmd.cpp:611
SetRailStationTileFlags
void SetRailStationTileFlags(TileIndex tile, const StationSpec *statspec)
Set rail station tile flags for the given tile.
Definition station_cmd.cpp:1402
GetProductionAroundTiles
CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad)
Get the cargo types being produced around the tile (in a rectangle).
Definition station_cmd.cpp:533
SplitGroundSpriteForOverlay
bool SplitGroundSpriteForOverlay(const TileInfo *ti, SpriteID *ground, RailTrackOffset *overlay_offset)
Check whether a sprite is a track sprite, which can be replaced by a non-track ground sprite and a ra...
Definition station_cmd.cpp:3117
StationType
StationType
Station types.
Definition station_type.h:29
CargoArray
Class for storing amounts of cargo.
Definition cargo_type.h:111
DrawTileSprites
Ground palette sprite of a tile, together with its sprite layout.
Definition sprite.h:52
PoolID< uint8_t, struct CompanyIDTag, 0xF, 0xFF >
StationSpec
Station specification.
Definition newgrf_station.h:123
Station
Station data structure.
Definition station_base.h:500
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
TileInfo
Tile information, used while rendering the tile.
Definition tile_cmd.h:30
Vehicle
Vehicle data structure.
Definition vehicle_base.h:205
vehicle_type.h
Types related to vehicles.