2008-03-31 00:06:17 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2008-03-31 00:06:17 +00:00
|
|
|
/** @file station_func.h Functions related to stations. */
|
|
|
|
|
|
|
|
#ifndef STATION_FUNC_H
|
|
|
|
#define STATION_FUNC_H
|
|
|
|
|
|
|
|
#include "sprite.h"
|
2008-03-31 06:42:26 +00:00
|
|
|
#include "rail_type.h"
|
2008-03-31 00:06:17 +00:00
|
|
|
#include "road_type.h"
|
2013-05-19 14:22:04 +00:00
|
|
|
#include "vehicle_type.h"
|
2011-12-03 23:40:46 +00:00
|
|
|
#include "economy_func.h"
|
2012-12-23 15:38:54 +00:00
|
|
|
#include "rail.h"
|
2008-03-31 00:06:17 +00:00
|
|
|
|
2008-09-30 20:39:50 +00:00
|
|
|
void ModifyStationRatingAround(TileIndex tile, Owner owner, int amount, uint radius);
|
2008-03-31 00:06:17 +00:00
|
|
|
|
2010-01-04 18:16:32 +00:00
|
|
|
void FindStationsAroundTiles(const TileArea &location, StationList *stations);
|
2008-03-31 00:06:17 +00:00
|
|
|
|
|
|
|
void ShowStationViewWindow(StationID station);
|
2009-07-13 22:33:25 +00:00
|
|
|
void UpdateAllStationVirtCoords();
|
2008-03-31 00:06:17 +00:00
|
|
|
|
2009-06-27 21:06:58 +00:00
|
|
|
CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad);
|
2009-09-20 17:44:33 +00:00
|
|
|
CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, uint32 *always_accepted = NULL);
|
2009-09-07 07:39:08 +00:00
|
|
|
|
|
|
|
void UpdateStationAcceptance(Station *st, bool show_msg);
|
2008-03-31 00:06:17 +00:00
|
|
|
|
|
|
|
const DrawTileSprites *GetStationTileLayout(StationType st, byte gfx);
|
|
|
|
void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image);
|
|
|
|
|
2010-08-20 12:50:59 +00:00
|
|
|
bool HasStationInUse(StationID station, bool include_company, CompanyID company);
|
2008-03-31 00:06:17 +00:00
|
|
|
|
|
|
|
void DeleteOilRig(TileIndex t);
|
|
|
|
|
2008-03-31 06:42:26 +00:00
|
|
|
/* Check if a rail station tile is traversable. */
|
|
|
|
bool IsStationTileBlocked(TileIndex tile);
|
|
|
|
|
2012-07-15 16:17:22 +00:00
|
|
|
bool CanStationTileHavePylons(TileIndex tile);
|
|
|
|
bool CanStationTileHaveWires(TileIndex tile);
|
2008-03-31 06:42:26 +00:00
|
|
|
|
2008-05-24 02:54:47 +00:00
|
|
|
void UpdateAirportsNoise();
|
2008-03-31 06:42:26 +00:00
|
|
|
|
2012-12-23 15:38:54 +00:00
|
|
|
bool SplitGroundSpriteForOverlay(const TileInfo *ti, SpriteID *ground, RailTrackOffset *overlay_offset);
|
|
|
|
|
2013-05-19 14:22:04 +00:00
|
|
|
void IncreaseStats(Station *st, const Vehicle *v, StationID next_station_id);
|
|
|
|
void IncreaseStats(Station *st, CargoID cargo, StationID next_station_id, uint capacity, uint usage);
|
2013-06-23 08:29:28 +00:00
|
|
|
void RerouteCargo(Station *st, CargoID c, StationID avoid, StationID avoid2);
|
2013-05-19 14:22:04 +00:00
|
|
|
|
2011-12-03 23:40:46 +00:00
|
|
|
/**
|
|
|
|
* Calculates the maintenance cost of a number of station tiles.
|
|
|
|
* @param num Number of station tiles.
|
|
|
|
* @return Total cost.
|
|
|
|
*/
|
|
|
|
static inline Money StationMaintenanceCost(uint32 num)
|
|
|
|
{
|
|
|
|
return (_price[PR_INFRASTRUCTURE_STATION] * num * (1 + IntSqrt(num))) >> 7; // 7 bits scaling.
|
|
|
|
}
|
|
|
|
|
|
|
|
Money AirportMaintenanceCost(Owner owner);
|
|
|
|
|
2008-03-31 00:06:17 +00:00
|
|
|
#endif /* STATION_FUNC_H */
|