OpenTTD Source 20241224-master-gf74b0cf984
|
Handling of station tiles. More...
#include "stdafx.h"
#include "aircraft.h"
#include "bridge_map.h"
#include "vehiclelist_func.h"
#include "viewport_func.h"
#include "viewport_kdtree.h"
#include "command_func.h"
#include "town.h"
#include "news_func.h"
#include "train.h"
#include "ship.h"
#include "roadveh.h"
#include "industry.h"
#include "newgrf_cargo.h"
#include "newgrf_debug.h"
#include "newgrf_station.h"
#include "newgrf_canal.h"
#include "pathfinder/yapf/yapf_cache.h"
#include "road_internal.h"
#include "autoslope.h"
#include "water.h"
#include "strings_internal.h"
#include "clear_func.h"
#include "timer/timer_game_calendar.h"
#include "vehicle_func.h"
#include "string_func.h"
#include "animated_tile_func.h"
#include "elrail_func.h"
#include "station_base.h"
#include "station_func.h"
#include "station_kdtree.h"
#include "roadstop_base.h"
#include "newgrf_railtype.h"
#include "newgrf_roadtype.h"
#include "waypoint_base.h"
#include "waypoint_func.h"
#include "pbs.h"
#include "debug.h"
#include "core/random_func.hpp"
#include "core/container_func.hpp"
#include "company_base.h"
#include "table/airporttile_ids.h"
#include "newgrf_airporttiles.h"
#include "order_backup.h"
#include "newgrf_house.h"
#include "company_gui.h"
#include "linkgraph/linkgraph_base.h"
#include "linkgraph/refresh.h"
#include "tunnelbridge_map.h"
#include "station_cmd.h"
#include "waypoint_cmd.h"
#include "landscape_cmd.h"
#include "rail_cmd.h"
#include "newgrf_roadstop.h"
#include "timer/timer.h"
#include "timer/timer_game_economy.h"
#include "timer/timer_game_tick.h"
#include "cheat_type.h"
#include "road_func.h"
#include "widgets/station_widget.h"
#include "table/strings.h"
#include <bitset>
#include "safeguards.h"
#include "table/station_land.h"
Go to the source code of this file.
Data Structures | |
struct | StationNameInformation |
Information to handle station action 0 property 24 correctly. More... | |
Macros | |
#define | M(x) ((x) - STR_SV_STNAME) |
Typedefs | |
typedef bool(* | CMSAMatcher) (TileIndex tile) |
Function to check whether the given tile matches some criterion. | |
Enumerations | |
enum | StationNaming { STATIONNAMING_RAIL , STATIONNAMING_ROAD , STATIONNAMING_AIRPORT , STATIONNAMING_OILRIG , STATIONNAMING_DOCK , STATIONNAMING_HELIPORT } |
Functions | |
bool | IsHangar (Tile t) |
Check whether the given tile is a hangar. | |
template<class T , class F > | |
CommandCost | GetStationAround (TileArea ta, StationID closest_station, CompanyID company, T **st, F filter) |
Look for a station owned by the given company around the given tile area. | |
static int | CountMapSquareAround (TileIndex tile, CMSAMatcher cmp) |
Counts the numbers of tiles matching a specific type in the area around. | |
static bool | CMSAMine (TileIndex tile) |
Check whether the tile is a mine. | |
static bool | CMSAWater (TileIndex tile) |
Check whether the tile is water. | |
static bool | CMSATree (TileIndex tile) |
Check whether the tile is a tree. | |
static bool | FindNearIndustryName (TileIndex tile, void *user_data) |
Find a station action 0 property 24 station name, or reduce the free_names if needed. | |
static StringID | GenerateStationName (Station *st, TileIndex tile, StationNaming name_class) |
static Station * | GetClosestDeletedStation (TileIndex tile) |
Find the closest deleted station of the current company. | |
void | UpdateAllStationVirtCoords () |
Update the virtual coords needed to draw the station sign for all stations. | |
void | ClearAllStationCachedNames () |
CargoTypes | GetAcceptanceMask (const Station *st) |
Get a mask of the cargo types that the station accepts. | |
CargoTypes | GetEmptyMask (const Station *st) |
Get a mask of the cargo types that are empty at the station. | |
static void | ShowRejectOrAcceptNews (const Station *st, CargoTypes cargoes, bool reject) |
Add news item for when a station changes which cargoes it accepts. | |
CargoArray | GetProductionAroundTiles (TileIndex north_tile, int w, int h, int rad) |
Get the cargo types being produced around the tile (in a rectangle). | |
CargoArray | GetAcceptanceAroundTiles (TileIndex center_tile, int w, int h, int rad, CargoTypes *always_accepted) |
Get the acceptance of cargoes around the tile in 1/8. | |
static CargoArray | GetAcceptanceAroundStation (const Station *st, CargoTypes *always_accepted) |
Get the acceptance of cargoes around the station in. | |
void | UpdateStationAcceptance (Station *st, bool show_msg) |
Update the acceptance for a station. | |
static void | UpdateStationSignCoord (BaseStation *st) |
static CommandCost | BuildStationPart (Station **st, DoCommandFlag flags, bool reuse, TileArea area, StationNaming name_class) |
Common part of building various station parts and possibly attaching them to an existing one. | |
static void | DeleteStationIfEmpty (BaseStation *st) |
This is called right after a station was deleted. | |
CommandCost | ClearTile_Station (TileIndex tile, DoCommandFlag flags) |
Clear a single tile of a station. | |
CommandCost | CheckBuildableTile (TileIndex tile, uint invalid_dirs, int &allowed_z, bool allow_steep, bool check_bridge=true) |
Checks if the given tile is buildable, flat and has a certain height. | |
static CommandCost | CheckFlatLandAirport (AirportTileTableIterator tile_iter, DoCommandFlag flags) |
Checks if an airport can be built at the given location and clear the area. | |
static CommandCost | CheckFlatLandRailStation (TileIndex tile_cur, TileIndex north_tile, int &allowed_z, DoCommandFlag flags, Axis axis, StationID *station, RailType rt, std::vector< Train * > &affected_vehicles, StationClassID spec_class, uint16_t spec_index, uint8_t plat_len, uint8_t numtracks) |
Checks if a rail station can be built at the given tile. | |
CommandCost | CheckFlatLandRoadStop (TileIndex cur_tile, int &allowed_z, DoCommandFlag flags, uint invalid_dirs, bool is_drive_through, StationType station_type, Axis axis, StationID *station, RoadType rt) |
Checks if a road stop can be built at the given tile. | |
CommandCost | CanExpandRailStation (const BaseStation *st, TileArea &new_ta) |
Check whether we can expand the rail part of the given station. | |
static uint8_t * | CreateSingle (uint8_t *layout, int n) |
static uint8_t * | CreateMulti (uint8_t *layout, int n, uint8_t b) |
void | GetStationLayout (uint8_t *layout, uint numtracks, uint plat_len, const StationSpec *statspec) |
Create the station layout for the given number of tracks and platform length. | |
template<class T , StringID error_message, class F > | |
CommandCost | FindJoiningBaseStation (StationID existing_station, StationID station_to_join, bool adjacent, TileArea ta, T **st, F filter) |
Find a nearby station that joins this station. | |
static CommandCost | FindJoiningStation (StationID existing_station, StationID station_to_join, bool adjacent, TileArea ta, Station **st) |
Find a nearby station that joins this station. | |
CommandCost | FindJoiningWaypoint (StationID existing_waypoint, StationID waypoint_to_join, bool adjacent, TileArea ta, Waypoint **wp, bool is_road) |
Find a nearby waypoint that joins this waypoint. | |
static void | FreeTrainReservation (Train *v) |
Clear platform reservation during station building/removing. | |
static void | RestoreTrainReservation (Train *v) |
Restore platform reservation during station building/removing. | |
static CommandCost | CalculateRailStationCost (TileArea tile_area, DoCommandFlag flags, Axis axis, StationID *station, RailType rt, std::vector< Train * > &affected_vehicles, StationClassID spec_class, uint16_t spec_index, uint8_t plat_len, uint8_t numtracks) |
Calculates cost of new rail stations within the area. | |
static StationSpec::TileFlags | GetStationTileFlags (StationGfx gfx, const StationSpec *statspec) |
Get station tile flags for the given StationGfx. | |
void | SetRailStationTileFlags (TileIndex tile, const StationSpec *statspec) |
Set rail station tile flags for the given tile. | |
CommandCost | CmdBuildRailStation (DoCommandFlag flags, TileIndex tile_org, RailType rt, Axis axis, uint8_t numtracks, uint8_t plat_len, StationClassID spec_class, uint16_t spec_index, StationID station_to_join, bool adjacent) |
Build rail station. | |
static TileArea | MakeStationAreaSmaller (BaseStation *st, TileArea ta, bool(*func)(BaseStation *, TileIndex)) |
static bool | TileBelongsToRailStation (BaseStation *st, TileIndex tile) |
static void | MakeRailStationAreaSmaller (BaseStation *st) |
static bool | TileBelongsToShipStation (BaseStation *st, TileIndex tile) |
static void | MakeShipStationAreaSmaller (Station *st) |
static bool | TileBelongsToRoadWaypointStation (BaseStation *st, TileIndex tile) |
void | MakeRoadWaypointStationAreaSmaller (BaseStation *st, TileArea &road_waypoint_area) |
template<class T > | |
CommandCost | RemoveFromRailBaseStation (TileArea ta, std::vector< T * > &affected_stations, DoCommandFlag flags, Money removal_cost, bool keep_rail) |
Remove a number of tiles from any rail station within the area. | |
CommandCost | CmdRemoveFromRailStation (DoCommandFlag flags, TileIndex start, TileIndex end, bool keep_rail) |
Remove a single tile from a rail station. | |
CommandCost | CmdRemoveFromRailWaypoint (DoCommandFlag flags, TileIndex start, TileIndex end, bool keep_rail) |
Remove a single tile from a waypoint. | |
template<class T > | |
CommandCost | RemoveRailStation (T *st, DoCommandFlag flags, Money removal_cost) |
Remove a rail station/waypoint. | |
static CommandCost | RemoveRailStation (TileIndex tile, DoCommandFlag flags) |
Remove a rail station. | |
static CommandCost | RemoveRailWaypoint (TileIndex tile, DoCommandFlag flags) |
Remove a rail waypoint. | |
static RoadStop ** | FindRoadStopSpot (bool truck_station, Station *st) |
static CommandCost | RemoveRoadStop (TileIndex tile, DoCommandFlag flags, int replacement_spec_index) |
Remove a bus station/truck stop. | |
CommandCost | RemoveRoadWaypointStop (TileIndex tile, DoCommandFlag flags, int replacement_spec_index) |
Remove a road waypoint. | |
static CommandCost | FindJoiningRoadStop (StationID existing_stop, StationID station_to_join, bool adjacent, TileArea ta, Station **st) |
Find a nearby station that joins this road stop. | |
CommandCost | CalculateRoadStopCost (TileArea tile_area, DoCommandFlag flags, bool is_drive_through, StationType station_type, Axis axis, DiagDirection ddir, StationID *est, RoadType rt, Money unit_cost) |
Calculates cost of new road stops within the area. | |
CommandCost | CmdBuildRoadStop (DoCommandFlag flags, TileIndex tile, uint8_t width, uint8_t length, RoadStopType stop_type, bool is_drive_through, DiagDirection ddir, RoadType rt, RoadStopClassID spec_class, uint16_t spec_index, StationID station_to_join, bool adjacent) |
Build a bus or truck stop. | |
static Vehicle * | ClearRoadStopStatusEnum (Vehicle *v, void *) |
static CommandCost | RemoveGenericRoadStop (DoCommandFlag flags, const TileArea &roadstop_area, StationType station_type, bool remove_road) |
Remove a tile area of road stop or road waypoints. | |
CommandCost | CmdRemoveRoadStop (DoCommandFlag flags, TileIndex tile, uint8_t width, uint8_t height, RoadStopType stop_type, bool remove_road) |
Remove bus or truck stops. | |
CommandCost | CmdRemoveFromRoadWaypoint (DoCommandFlag flags, TileIndex start, TileIndex end) |
Remove road waypoints. | |
uint8_t | GetAirportNoiseLevelForDistance (const AirportSpec *as, uint distance) |
Get a possible noise reduction factor based on distance from town center. | |
Town * | AirportGetNearestTown (const AirportSpec *as, Direction rotation, TileIndex tile, TileIterator &&it, uint &mindist) |
Finds the town nearest to given airport. | |
static Town * | AirportGetNearestTown (const Station *st, uint &mindist) |
Finds the town nearest to given existing airport. | |
void | UpdateAirportsNoise () |
Recalculate the noise generated by the airports of each town. | |
CommandCost | CmdBuildAirport (DoCommandFlag flags, TileIndex tile, uint8_t airport_type, uint8_t layout, StationID station_to_join, bool allow_adjacent) |
Place an Airport. | |
static CommandCost | RemoveAirport (TileIndex tile, DoCommandFlag flags) |
Remove an airport. | |
CommandCost | CmdOpenCloseAirport (DoCommandFlag flags, StationID station_id) |
Open/close an airport to incoming aircraft. | |
bool | HasStationInUse (StationID station, bool include_company, CompanyID company) |
Tests whether the company's vehicles have this station in orders. | |
CommandCost | CmdBuildDock (DoCommandFlag flags, TileIndex tile, StationID station_to_join, bool adjacent) |
Build a dock/haven. | |
void | RemoveDockingTile (TileIndex t) |
void | ClearDockingTilesCheckingNeighbours (TileIndex tile) |
Clear docking tile status from tiles around a removed dock, if the tile has no neighbours which would keep it as a docking tile. | |
static TileIndex | FindDockLandPart (TileIndex t) |
Find the part of a dock that is land-based. | |
static CommandCost | RemoveDock (TileIndex tile, DoCommandFlag flags) |
Remove a dock. | |
const DrawTileSprites * | GetStationTileLayout (StationType st, uint8_t gfx) |
Get station tile layout for a station type and its station gfx. | |
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 rail overlay. | |
static void | DrawTile_Station (TileInfo *ti) |
void | StationPickerDrawSprite (int x, int y, StationType st, RailType railtype, RoadType roadtype, int image) |
static int | GetSlopePixelZ_Station (TileIndex tile, uint, uint, bool) |
static Foundation | GetFoundation_Station (TileIndex, Slope tileh) |
static void | FillTileDescRoadStop (TileIndex tile, TileDesc *td) |
void | FillTileDescRailStation (TileIndex tile, TileDesc *td) |
void | FillTileDescAirport (TileIndex tile, TileDesc *td) |
static void | GetTileDesc_Station (TileIndex tile, TileDesc *td) |
static TrackStatus | GetTileTrackStatus_Station (TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side) |
static void | TileLoop_Station (TileIndex tile) |
static void | AnimateTile_Station (TileIndex tile) |
static bool | ClickTile_Station (TileIndex tile) |
static VehicleEnterTileStatus | VehicleEnter_Station (Vehicle *v, TileIndex tile, int x, int y) |
void | TriggerWatchedCargoCallbacks (Station *st) |
Run the watched cargo callback for all houses in the catchment area. | |
static bool | StationHandleBigTick (BaseStation *st) |
This function is called for each station once every 250 ticks. | |
static void | byte_inc_sat (uint8_t *p) |
static void | TruncateCargo (const CargoSpec *cs, GoodsEntry *ge, uint amount=UINT_MAX) |
Truncate the cargo by a specific amount. | |
static void | UpdateStationRating (Station *st) |
void | RerouteCargo (Station *st, CargoID c, StationID avoid, StationID avoid2) |
Reroute cargo of type c at station st or in any vehicles unloading there. | |
void | DeleteStaleLinks (Station *from) |
Check all next hops of cargo packets in this station for existence of a a valid link they may use to travel on. | |
void | IncreaseStats (Station *st, CargoID cargo, StationID next_station_id, uint capacity, uint usage, uint32_t time, EdgeUpdateMode mode) |
Increase capacity for a link stat given by station cargo and next hop. | |
void | IncreaseStats (Station *st, const Vehicle *front, StationID next_station_id, uint32_t time) |
Increase capacity for all link stats associated with vehicles in the given consist. | |
static void | StationHandleSmallTick (BaseStation *st) |
void | OnTick_Station () |
void | ModifyStationRatingAround (TileIndex tile, Owner owner, int amount, uint radius) |
static uint | UpdateStationWaiting (Station *st, CargoID type, uint amount, SourceType source_type, SourceID source_id) |
static bool | IsUniqueStationName (const std::string &name) |
CommandCost | CmdRenameStation (DoCommandFlag flags, StationID station_id, const std::string &text) |
Rename a station. | |
static void | AddNearbyStationsByCatchment (TileIndex tile, StationList &stations, StationList &nearby) |
static bool | CanMoveGoodsToStation (const Station *st, CargoID type) |
uint | MoveGoodsToStation (CargoID type, uint amount, SourceType source_type, SourceID source_id, const StationList &all_stations, Owner exclusivity) |
void | UpdateStationDockingTiles (Station *st) |
void | BuildOilRig (TileIndex tile) |
void | DeleteOilRig (TileIndex tile) |
static void | ChangeTileOwner_Station (TileIndex tile, Owner old_owner, Owner new_owner) |
static CommandCost | CanRemoveRoadWithStop (TileIndex tile, DoCommandFlag flags) |
Check if a drive-through road stop tile can be cleared. | |
static CommandCost | TerraformTile_Station (TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new) |
Variables | |
static const TileIndexDiffC | _dock_tileoffs_chkaround [] |
static const uint8_t | _dock_w_chk [4] = { 2, 1, 2, 1 } |
static const uint8_t | _dock_h_chk [4] = { 1, 2, 1, 2 } |
static IntervalTimer< TimerGameEconomy > | _economy_stations_monthly ({TimerGameEconomy::MONTH, TimerGameEconomy::Priority::STATION}, [](auto) { for(Station *st :Station::Iterate()) { for(GoodsEntry &ge :st->goods) { SB(ge.status, GoodsEntry::GES_LAST_MONTH, 1, GB(ge.status, GoodsEntry::GES_CURRENT_MONTH, 1));ClrBit(ge.status, GoodsEntry::GES_CURRENT_MONTH);} } }) |
Economy monthly loop for stations. | |
const TileTypeProcs | _tile_type_station_procs |
Handling of station tiles.
Definition in file station_cmd.cpp.
#define M | ( | x | ) | ((x) - STR_SV_STNAME) |
Definition at line 213 of file station_cmd.cpp.
typedef bool(* CMSAMatcher) (TileIndex tile) |
Function to check whether the given tile matches some criterion.
tile | the tile to check |
Definition at line 144 of file station_cmd.cpp.
enum StationNaming |
Definition at line 215 of file station_cmd.cpp.
|
static |
Definition at line 4343 of file station_cmd.cpp.
Town * AirportGetNearestTown | ( | const AirportSpec * | as, |
Direction | rotation, | ||
TileIndex | tile, | ||
TileIterator && | it, | ||
uint & | mindist | ||
) |
Finds the town nearest to given airport.
Based on minimal manhattan distance to any airport's tile. If two towns have the same distance, town with lower index is returned.
as | airport's description | |
rotation | airport's rotation | |
tile | origin tile (top corner of the airport) | |
it | An iterator over all airport tiles (consumed) | |
[out] | mindist | Minimum distance to town |
Definition at line 2452 of file station_cmd.cpp.
References CalcClosestTownFromTile(), DIR_E, DIR_W, DistanceManhattan(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::GetNumItems(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_TILE, IsInsideBS(), AirportSpec::size_x, AirportSpec::size_y, TileX(), TileY(), and Town::xy.
Referenced by AirportGetNearestTown(), CmdBuildAirport(), RemoveAirport(), and UpdateAirportsNoise().
Finds the town nearest to given existing airport.
Based on minimal manhattan distance to any airport's tile. If two towns have the same distance, town with lower index is returned.
station | existing station with airport | |
[out] | mindist | Minimum distance to town |
Definition at line 2495 of file station_cmd.cpp.
References Station::airport, AirportGetNearestTown(), Airport::GetSpec(), Airport::rotation, and OrthogonalTileArea::tile.
|
static |
Definition at line 3672 of file station_cmd.cpp.
void BuildOilRig | ( | TileIndex | tile | ) |
Definition at line 4505 of file station_cmd.cpp.
|
static |
Common part of building various station parts and possibly attaching them to an existing one.
[in,out] | st | Station to attach to |
flags | Command flags | |
reuse | Whether to try to reuse a deleted station (gray sign) if possible | |
area | Area occupied by the new part | |
name_class | Station naming class to use to generate the new station's name |
Definition at line 701 of file station_cmd.cpp.
References _current_company, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_station_pool >::CanAllocateItem(), ClosestTownFromTile(), CMD_ERROR, DC_EXEC, CommandCost::Failed(), GenerateStationName(), GetClosestDeletedStation(), OrthogonalTileArea::h, Kdtree< T, TxyFunc, CoordT, DistT >::Insert(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), SetBit(), OrthogonalTileArea::tile, and OrthogonalTileArea::w.
Referenced by CmdBuildAirport(), CmdBuildDock(), CmdBuildRailStation(), and CmdBuildRoadStop().
|
inlinestatic |
Definition at line 3805 of file station_cmd.cpp.
|
static |
Calculates cost of new rail stations within the area.
tile_area | Area to check. |
flags | Operation to perform. |
axis | Rail station axis. |
station | StationID to be queried and returned if available. |
rt | The rail type to check for (overbuilding rail stations over rail). |
affected_vehicles | List of trains with PBS reservations on the tiles |
spec_class | Station class. |
spec_index | Index into the station class. |
plat_len | Platform length. |
numtracks | Number of platforms. |
Definition at line 1269 of file station_cmd.cpp.
References CommandCost::AddCost(), CheckFlatLandRailStation(), EXPENSES_CONSTRUCTION, CommandCost::Failed(), GetRailStationAxis(), IsRailStationTile(), RailBuildCost(), and OrthogonalTileArea::tile.
Referenced by CmdBuildRailStation().
CommandCost CalculateRoadStopCost | ( | TileArea | tile_area, |
DoCommandFlag | flags, | ||
bool | is_drive_through, | ||
StationType | station_type, | ||
Axis | axis, | ||
DiagDirection | ddir, | ||
StationID * | est, | ||
RoadType | rt, | ||
Money | unit_cost | ||
) |
Calculates cost of new road stops within the area.
tile_area | Area to check. |
flags | Operation to perform. |
is_drive_through | True if trying to build a drive-through station. |
station_type | Station type (bus, truck or road waypoint). |
axis | Axis of a drive-through road stop. |
ddir | Entrance direction (DiagDirection) for normal stops. Converted to the axis for drive-through stops. |
station | StationID to be queried and returned if available. |
rt | Road type to build, may be INVALID_ROADTYPE if an existing road is required. |
unit_cost | The cost to build one road stop of the current type. |
Definition at line 1919 of file station_cmd.cpp.
References CommandCost::AddCost(), AxisToDiagDir(), CheckFlatLandRoadStop(), EXPENSES_CONSTRUCTION, CommandCost::Failed(), IsAnyRoadStop(), IsTileType(), MP_STATION, ReverseDiagDir(), and SetBit().
Referenced by CmdBuildRoadStop(), and CmdBuildRoadWaypoint().
CommandCost CanExpandRailStation | ( | const BaseStation * | st, |
TileArea & | new_ta | ||
) |
Check whether we can expand the rail part of the given station.
st | the station to expand |
new_ta | the current (and if all is fine new) tile area of the rail part of the station |
Definition at line 1081 of file station_cmd.cpp.
References _settings_game, OrthogonalTileArea::h, GameSettings::station, StationSettings::station_spread, OrthogonalTileArea::tile, TileX(), TileXY(), TileY(), BaseStation::train_station, and OrthogonalTileArea::w.
Referenced by CmdBuildRailStation(), and CmdBuildRailWaypoint().
Definition at line 4373 of file station_cmd.cpp.
|
static |
Check if a drive-through road stop tile can be cleared.
Road stops built on town-owned roads check the conditions that would allow clearing of the original road.
tile | The road stop tile to check. |
flags | Command flags. |
Definition at line 4661 of file station_cmd.cpp.
References _current_company, CheckAllowRemoveRoad(), CheckOwnership(), CommandCost::Failed(), GetAnyRoadBits(), GetRoadOwner(), INVALID_ROADTYPE, OWNER_NONE, OWNER_TOWN, and OWNER_WATER.
Referenced by ClearTile_Station().
Definition at line 4568 of file station_cmd.cpp.
CommandCost CheckBuildableTile | ( | TileIndex | tile, |
uint | invalid_dirs, | ||
int & | allowed_z, | ||
bool | allow_steep, | ||
bool | check_bridge = true |
||
) |
Checks if the given tile is buildable, flat and has a certain height.
tile | TileIndex to check. |
invalid_dirs | Prohibited directions for slopes (set of DiagDirection). |
allowed_z | Height allowed for the tile. If allowed_z is negative, it will be set to the height of this tile. |
allow_steep | Whether steep slopes are allowed. |
check_bridge | Check for the existence of a bridge. |
Definition at line 803 of file station_cmd.cpp.
References _settings_game, CommandCost::AddCost(), ConstructionSettings::build_on_slopes, CanBuildDepotByTileh(), GameSettings::construction, DIAGDIR_BEGIN, DIAGDIR_END, EnsureNoVehicleOnGround(), EXPENSES_CONSTRUCTION, CommandCost::Failed(), GetSlopeMaxZ(), GetTileSlopeZ(), HasBit(), IsBridgeAbove(), IsSteepSlope(), and SLOPE_FLAT.
Referenced by CheckFlatLandAirport(), CheckFlatLandRailStation(), CheckFlatLandRoadStop(), and CmdBuildObject().
|
static |
Checks if an airport can be built at the given location and clear the area.
tile_iter | Airport tile iterator. |
flags | Operation to perform. |
Definition at line 852 of file station_cmd.cpp.
References CommandCost::AddCost(), CheckBuildableTile(), EXPENSES_CONSTRUCTION, CommandCost::Failed(), and INVALID_TILE.
Referenced by CmdBuildAirport().
|
static |
Checks if a rail station can be built at the given tile.
tile_cur | Tile to check. |
north_tile | North tile of the area being checked. |
allowed_z | Height allowed for the tile. If allowed_z is negative, it will be set to the height of this tile. |
flags | Operation to perform. |
axis | Rail station axis. |
station | StationID to be queried and returned if available. |
rt | The rail type to check for (overbuilding rail stations over rail). |
affected_vehicles | List of trains with PBS reservations on the tiles |
spec_class | Station class. |
spec_index | Index into the station class. |
plat_len | Platform length. |
numtracks | Number of platforms. |
Definition at line 886 of file station_cmd.cpp.
References CommandCost::AddCost(), StationSpec::callback_mask, CBM_STATION_SLOPE_CHECK, CheckBuildableTile(), ClearTile_Station(), DC_AUTO, DIAGDIR_NE, EXPENSES_CONSTRUCTION, CommandCost::Failed(), NewGRFClass< Tspec, Tindex, Tmax >::Get(), GetRailReservationTrackBits(), GetRailType(), NewGRFClass< Tspec, Tindex, Tmax >::GetSpec(), GetStationIndex(), GetTrackBits(), GetTrainForReservation(), HasBit(), HasPowerOnRail(), HasSignals(), INVALID_RAILTYPE, IsPlainRailTile(), IsRailStation(), IsTileType(), MP_STATION, PerformStationTileSlopeCheck(), RemoveFirstTrack(), TRACK_BIT_NONE, TRACK_X, and TRACK_Y.
Referenced by CalculateRailStationCost().
CommandCost CheckFlatLandRoadStop | ( | TileIndex | cur_tile, |
int & | allowed_z, | ||
DoCommandFlag | flags, | ||
uint | invalid_dirs, | ||
bool | is_drive_through, | ||
StationType | station_type, | ||
Axis | axis, | ||
StationID * | station, | ||
RoadType | rt | ||
) |
Checks if a road stop can be built at the given tile.
cur_tile | Tile to check. |
allowed_z | Height allowed for the tile. If allowed_z is negative, it will be set to the height of this tile. |
flags | Operation to perform. |
invalid_dirs | Prohibited directions (set of DiagDirections). |
is_drive_through | True if trying to build a drive-through station. |
station_type | Station type (bus, truck or road waypoint). |
axis | Axis of a drive-through road stop. |
station | StationID to be queried and returned if available. |
rt | Road type to build, may be INVALID_ROADTYPE if an existing road is required. |
Definition at line 968 of file station_cmd.cpp.
References _settings_game, CommandCost::AddCost(), AXIS_X, CheckBuildableTile(), CheckOwnership(), ClearTile_Station(), GameSettings::construction, CountBits(), DC_AUTO, DRD_NONE, EXPENSES_CONSTRUCTION, CommandCost::Failed(), GetAllRoadBits(), GetDisallowedRoadDirections(), GetDriveThroughStopAxis(), GetRoadBits(), GetRoadOwner(), GetStationIndex(), GetStationType(), HasExactlyOneBit(), HasPowerOnRoad(), INVALID_ROADTYPE, IsAnyRoadStop(), IsDriveThroughStopTile(), IsNormalRoadTile(), IsTileType(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), MP_STATION, OWNER_NONE, OWNER_TOWN, ROAD_NONE, ConstructionSettings::road_stop_on_competitor_road, ConstructionSettings::road_stop_on_town_road, ROAD_X, ROAD_Y, and RoadBuildCost().
Referenced by CalculateRoadStopCost().
void ClearAllStationCachedNames | ( | ) |
Definition at line 489 of file station_cmd.cpp.
void ClearDockingTilesCheckingNeighbours | ( | TileIndex | tile | ) |
Clear docking tile status from tiles around a removed dock, if the tile has no neighbours which would keep it as a docking tile.
tile | Ex-dock tile to check. |
Definition at line 2898 of file station_cmd.cpp.
References CheckForDockingTile(), DIAGDIR_BEGIN, DIAGDIR_END, IsValidTile(), SetDockingTile(), and TileOffsByDiagDir().
Referenced by RemoveDock().
Definition at line 2116 of file station_cmd.cpp.
CommandCost ClearTile_Station | ( | TileIndex | tile, |
DoCommandFlag | flags | ||
) |
Clear a single tile of a station.
tile | The tile to clear. |
flags | The DoCommand flags related to the "command". |
Definition at line 4696 of file station_cmd.cpp.
References CanRemoveRoadWithStop(), CMD_ERROR, DC_AUTO, CommandCost::Failed(), GetStationType(), HasTileRoadType(), IsDriveThroughStopTile(), RemoveAirport(), RemoveBuoy(), RemoveDock(), RemoveRailStation(), RemoveRailWaypoint(), RemoveRoadStop(), RemoveRoadWaypointStop(), and SetDParam().
Referenced by CheckFlatLandRailStation(), CheckFlatLandRoadStop(), and IsValidTileForWaypoint().
|
static |
Definition at line 3691 of file station_cmd.cpp.
CommandCost CmdBuildAirport | ( | DoCommandFlag | flags, |
TileIndex | tile, | ||
uint8_t | airport_type, | ||
uint8_t | layout, | ||
StationID | station_to_join, | ||
bool | allow_adjacent | ||
) |
Place an Airport.
flags | operation to perform |
tile | tile where airport will be built |
airport_type | airport type, |
layout | airport layout |
station_to_join | station ID to join (NEW_STATION if build new one) |
allow_adjacent | allow airports directly adjacent to other airports. |
Definition at line 2525 of file station_cmd.cpp.
References _settings_game, AAT_BUILT, OrthogonalTileArea::Add(), AddAnimatedTile(), CommandCost::AddCost(), Station::AddFacility(), Station::AfterStationTileSetChange(), AirportFTAClass::AIRPLANES, Station::airport, AirportGetNearestTown(), ANIM_STATUS_NO_ANIMATION, AirportTileSpec::animation, AT_OILRIG, BuildStationPart(), CheckFlatLandAirport(), CheckIfAuthorityAllowsNewStation(), ClosestTownFromTile(), CMD_ERROR, DC_EXEC, GameSettings::difficulty, DIR_E, DIR_W, StationSettings::distant_join_stations, GameSettings::economy, FACIL_AIRPORT, BaseStation::facilities, CommandCost::Failed(), FindJoiningStation(), Airport::flags, GB(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), AirportTileSpec::Get(), AirportSpec::Get(), GetAirport(), GetAirportNoiseLevelForDistance(), SpecializedStation< Station, false >::GetIfValid(), GetTranslatedAirportTileID(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_TILE, InvalidateWindowData(), AirportSpec::IsAvailable(), SpecializedStation< Station, false >::IsValidID(), AirportSpec::IsWithinMapBounds(), SpecializedStation< Station, false >::Iterate(), Airport::layout, AirportSpec::layouts, MakeAirport(), Town::MaxTownNoise(), Town::noise_reached, NUM_AIRPORTS, BaseStation::owner, BaseStation::rect, Airport::rotation, SetDParam(), SetStationTileRandomBits(), SetWindowDirty(), AirportSpec::size_x, AirportSpec::size_y, GameSettings::station, EconomySettings::station_noise_level, StationSettings::station_spread, AnimationInfo::status, Swap(), OrthogonalTileArea::tile, BaseStation::town, DifficultySettings::town_council_tolerance, Airport::type, UpdateAirplanesOnNewStation(), WATER_CLASS_INVALID, WC_STATION_VIEW, and WC_TOWN_VIEW.
CommandCost CmdBuildDock | ( | DoCommandFlag | flags, |
TileIndex | tile, | ||
StationID | station_to_join, | ||
bool | adjacent | ||
) |
Build a dock/haven.
flags | operation to perform |
tile | tile where dock will be built |
station_to_join | station ID to join (NEW_STATION if build new one) |
adjacent | allow docks directly adjacent to other docks. |
Definition at line 2791 of file station_cmd.cpp.
References _current_company, _settings_game, OrthogonalTileArea::Add(), CommandCost::AddCost(), Station::AddFacility(), Station::AfterStationTileSetChange(), BuildStationPart(), CheckIfAuthorityAllowsNewStation(), CMD_ERROR, DC_EXEC, StationSettings::distant_join_stations, EXPENSES_CONSTRUCTION, FACIL_DOCK, CommandCost::Failed(), FindJoiningStation(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), SpecializedStation< Station, false >::GetIfValid(), GetInclinedSlopeDirection(), GetTileSlope(), GetWaterClass(), OrthogonalTileArea::h, HasTileWaterClass(), HasTileWaterGround(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_DIAGDIR, IsBridgeAbove(), IsTileFlat(), IsTileOwner(), IsTileType(), SpecializedStation< Station, false >::IsValidID(), IsWaterTile(), MakeDock(), MP_WATER, BaseStation::owner, BaseStation::rect, ReverseDiagDir(), Station::ship_station, GameSettings::station, OrthogonalTileArea::tile, TileOffsByDiagDir(), ToTileIndexDiff(), OrthogonalTileArea::w, and WATER_CLASS_CANAL.
CommandCost CmdBuildRailStation | ( | DoCommandFlag | flags, |
TileIndex | tile_org, | ||
RailType | rt, | ||
Axis | axis, | ||
uint8_t | numtracks, | ||
uint8_t | plat_len, | ||
StationClassID | spec_class, | ||
uint16_t | spec_index, | ||
StationID | station_to_join, | ||
bool | adjacent | ||
) |
Build rail station.
flags | operation to perform |
tile_org | northern most position of station dragging/placement |
rt | railtype |
axis | orientation (Axis) |
numtracks | number of tracks |
plat_len | platform length |
spec_class | custom station class |
spec_index | custom station id |
station_to_join | station ID to join (NEW_STATION if build new one) |
adjacent | allow stations directly adjacent to other stations. |
Definition at line 1344 of file station_cmd.cpp.
References _current_company, _settings_game, Station::AddFacility(), AddTrackToSignalBuffer(), Station::AfterStationTileSetChange(), AllocateSpecToStation(), AXIS_X, AxisToDiagDir(), AxisToTrack(), BuildStationPart(), BaseStation::cached_anim_triggers, CalculateRailStationCost(), CALLBACK_FAILED, StationSpec::callback_mask, CanExpandRailStation(), CBID_STATION_AVAILABILITY, CBID_STATION_BUILD_TILE_LAYOUT, CBM_STATION_AVAIL, CheckIfAuthorityAllowsNewStation(), CMD_ERROR, Convert8bitBooleanCallback(), DC_EXEC, DeallocateSpecFromStation(), DeleteAnimatedTile(), StationSpec::disallowed_lengths, StationSpec::disallowed_platforms, StationSettings::distant_join_stations, ErrorUnknownCallbackResult(), FACIL_TRAIN, CommandCost::Failed(), FindJoiningStation(), FreeTrainReservation(), GB(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), NewGRFClass< Tspec, Tindex, Tmax >::Get(), NewGRFClass< Tspec, Tindex, Tmax >::GetClassCount(), GetCustomStationSpecIndex(), GetPlatformInfo(), GetRailStationAxis(), GetRailType(), NewGRFClass< Tspec, Tindex, Tmax >::GetSpec(), NewGRFClass< Tspec, Tindex, Tmax >::GetSpecCount(), GetStationGfx(), GetStationLayout(), GetTrainForReservation(), StationSpec::grf_prop, GRFFilePropsBase< Tcnt >::grffile, GRFFilePropsBase< Tcnt >::grfid, HasBit(), HasStationReservation(), HasStationTileRail(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Company::infrastructure, INVALID_TILE, IsCompatibleTrainStationTile(), IsRailStationTile(), IsStationTileBlocked(), IsValidAxis(), SpecializedStation< Station, false >::IsValidID(), IsWaypointClass(), MakeRailStation(), Station::MarkTilesDirty(), OtherAxis(), BaseStation::owner, CompanyInfrastructure::rail, BaseStation::rect, RestoreTrainReservation(), SAT_BUILT, SetAnimationFrame(), SetCustomStationSpecIndex(), SetRailStationPlatformReservation(), SetRailStationTileFlags(), SetStationGfx(), SetStationTileRandomBits(), CompanyInfrastructure::station, GameSettings::station, StationSettings::station_spread, OrthogonalTileArea::tile, TileOffsByAxis(), TileOffsByDiagDir(), BaseStation::train_station, AnimationInfo::triggers, ValParamRailType(), and YapfNotifyTrackLayoutChange().
CommandCost CmdBuildRoadStop | ( | DoCommandFlag | flags, |
TileIndex | tile, | ||
uint8_t | width, | ||
uint8_t | length, | ||
RoadStopType | stop_type, | ||
bool | is_drive_through, | ||
DiagDirection | ddir, | ||
RoadType | rt, | ||
RoadStopClassID | spec_class, | ||
uint16_t | spec_index, | ||
StationID | station_to_join, | ||
bool | adjacent | ||
) |
Build a bus or truck stop.
flags | Operation to perform. |
tile | Northernmost tile of the stop. |
width | Width of the road stop. |
length | Length of the road stop. |
stop_type | Type of road stop (bus/truck). |
is_drive_through | False for normal stops, true for drive-through. |
ddir | Entrance direction (DiagDirection) for normal stops. Converted to the axis for drive-through stops. |
rt | The roadtype. |
spec_class | Road stop spec class. |
spec_index | Road stop spec index. |
station_to_join | Station ID to join (NEW_STATION if build new one). |
adjacent | Allow stations directly adjacent to other stations. |
Definition at line 1964 of file station_cmd.cpp.
References _current_company, _settings_game, OrthogonalTileArea::Add(), Station::AddFacility(), Station::AfterStationTileSetChange(), BuildStationPart(), Station::bus_station, BaseStation::cached_roadstop_anim_triggers, CalculateRoadStopCost(), CALLBACK_FAILED, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_roadstop_pool >::CanAllocateItem(), CBID_STATION_AVAILABILITY, CBM_ROAD_STOP_AVAIL, CheckIfAuthorityAllowsNewStation(), CMD_ERROR, Convert8bitBooleanCallback(), CountBits(), DC_EXEC, DiagDirToAxis(), StationSettings::distant_join_stations, FACIL_BUS_STOP, FACIL_TRUCK_STOP, CommandCost::Failed(), FindJoiningRoadStop(), FindRoadStopSpot(), GB(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), NewGRFClass< Tspec, Tindex, Tmax >::Get(), RoadStopSpec::GetBuildCost(), NewGRFClass< Tspec, Tindex, Tmax >::GetClassCount(), GetRoadBits(), GetRoadOwner(), NewGRFClass< Tspec, Tindex, Tmax >::GetSpec(), NewGRFClass< Tspec, Tindex, Tmax >::GetSpecCount(), RoadStopSpec::grf_prop, GRFFilePropsBase< Tcnt >::grffile, OrthogonalTileArea::h, HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_ROADTYPE, INVALID_TILE, IsNormalRoadTile(), IsStationRoadStop(), IsTileType(), IsValidDiagDirection(), SpecializedStation< Station, false >::IsValidID(), IsValidTile(), IsWaypointClass(), RoadStop::MakeDriveThrough(), MakeDriveThroughRoadStop(), MakeRoadStop(), MarkTileDirtyByTile(), MayHaveRoad(), MP_STATION, BaseStation::owner, BaseStation::rect, RemoveRoadStop(), ROAD_STOP_TRACKBIT_FACTOR, ROADSTOP_BUS, ROADSTOP_END, ROADSTOP_TRUCK, ROADSTOPTYPE_ALL, ROADSTOPTYPE_FREIGHT, ROADSTOPTYPE_PASSENGER, RSF_DRIVE_THROUGH_ONLY, SAT_BUILT, SetCustomRoadStopSpecIndex(), GameSettings::station, StationSettings::station_spread, TileAddWrap(), AnimationInfo::triggers, Station::truck_station, UpdateCompanyRoadInfrastructure(), ValParamRoadType(), and OrthogonalTileArea::w.
CommandCost CmdOpenCloseAirport | ( | DoCommandFlag | flags, |
StationID | station_id | ||
) |
Open/close an airport to incoming aircraft.
flags | Operation to perform. |
station_id | Station ID of the airport. |
Definition at line 2735 of file station_cmd.cpp.
References Station::airport, AIRPORT_CLOSED_block, CheckOwnership(), CMD_ERROR, DC_EXEC, FACIL_AIRPORT, BaseStation::facilities, CommandCost::Failed(), Airport::flags, SpecializedStation< Station, false >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, SpecializedStation< Station, false >::IsValidID(), BaseStation::owner, OWNER_NONE, SetWindowWidgetDirty(), WC_STATION_VIEW, and WID_SV_CLOSE_AIRPORT.
CommandCost CmdRemoveFromRailStation | ( | DoCommandFlag | flags, |
TileIndex | start, | ||
TileIndex | end, | ||
bool | keep_rail | ||
) |
Remove a single tile from a rail station.
This allows for custom-built station with holes and weird layouts
flags | operation to perform |
start | tile of station piece to remove |
end | other edge of the rect to remove |
keep_rail | if set keep the rail |
Definition at line 1749 of file station_cmd.cpp.
References CMD_ERROR, CommandCost::Failed(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_TILE, RemoveFromRailBaseStation(), SetWindowWidgetDirty(), Map::Size(), OrthogonalTileArea::tile, BaseStation::train_station, WC_STATION_VIEW, and WID_SV_TRAINS.
CommandCost CmdRemoveFromRailWaypoint | ( | DoCommandFlag | flags, |
TileIndex | start, | ||
TileIndex | end, | ||
bool | keep_rail | ||
) |
Remove a single tile from a waypoint.
This allows for custom-built waypoint with holes and weird layouts
flags | operation to perform |
start | tile of waypoint piece to remove |
end | other edge of the rect to remove |
keep_rail | if set keep the rail |
Definition at line 1782 of file station_cmd.cpp.
References CMD_ERROR, RemoveFromRailBaseStation(), and Map::Size().
CommandCost CmdRemoveFromRoadWaypoint | ( | DoCommandFlag | flags, |
TileIndex | start, | ||
TileIndex | end | ||
) |
Remove road waypoints.
flags | operation to perform |
start | tile of road waypoint piece to remove |
end | other edge of the rect to remove |
Definition at line 2403 of file station_cmd.cpp.
References CMD_ERROR, RemoveGenericRoadStop(), and Map::Size().
CommandCost CmdRemoveRoadStop | ( | DoCommandFlag | flags, |
TileIndex | tile, | ||
uint8_t | width, | ||
uint8_t | height, | ||
RoadStopType | stop_type, | ||
bool | remove_road | ||
) |
Remove bus or truck stops.
flags | Operation to perform. |
tile | Northernmost tile of the removal area. |
width | Width of the removal area. |
height | Height of the removal area. |
stop_type | Type of stop (bus/truck). |
remove_road | Remove roads of drive-through stops? |
Definition at line 2381 of file station_cmd.cpp.
References CMD_ERROR, DC_BANKRUPT, INVALID_TILE, IsValidTile(), RemoveGenericRoadStop(), ROADSTOP_BUS, ROADSTOP_END, and TileAddWrap().
CommandCost CmdRenameStation | ( | DoCommandFlag | flags, |
StationID | station_id, | ||
const std::string & | text | ||
) |
Rename a station.
flags | operation to perform |
station_id | station ID that is to be renamed |
text | the new name or an empty string when resetting to the default |
Definition at line 4313 of file station_cmd.cpp.
References BaseStation::cached_name, CheckOwnership(), CMD_ERROR, DC_EXEC, CommandCost::Failed(), SpecializedStation< Station, false >::GetIfValid(), InvalidateWindowData(), MAX_LENGTH_STATION_NAME_CHARS, BaseStation::name, BaseStation::owner, Station::UpdateVirtCoord(), Utf8StringLength(), and WC_STATION_LIST.
|
static |
Check whether the tile is a mine.
tile | the tile to investigate. |
Definition at line 171 of file station_cmd.cpp.
References CC_LIQUID, CC_MAIL, CC_PASSENGERS, CargoSpec::classes, CargoSpec::Get(), Industry::GetByTile(), GetIndustrySpec(), INDUSTRYLIFE_EXTRACTIVE, IsTileType(), IsValidCargoID(), IndustrySpec::life_type, MP_INDUSTRY, Industry::produced, and Industry::type.
Referenced by GenerateStationName().
|
static |
Check whether the tile is a tree.
tile | the tile to investigate. |
Definition at line 208 of file station_cmd.cpp.
References IsTileType(), and MP_TREES.
Referenced by GenerateStationName().
|
static |
Check whether the tile is water.
tile | the tile to investigate. |
Definition at line 198 of file station_cmd.cpp.
References IsTileType(), IsWater(), and MP_WATER.
Referenced by GenerateStationName().
|
static |
Counts the numbers of tiles matching a specific type in the area around.
tile | the center tile of the 'count area' |
cmp | the comparator/matcher ( |
Definition at line 152 of file station_cmd.cpp.
References INVALID_TILE, and TileAddWrap().
Referenced by GenerateStationName().
|
inlinestatic |
Definition at line 1108 of file station_cmd.cpp.
|
inlinestatic |
Definition at line 1100 of file station_cmd.cpp.
void DeleteOilRig | ( | TileIndex | tile | ) |
Definition at line 4553 of file station_cmd.cpp.
void DeleteStaleLinks | ( | Station * | from | ) |
Check all next hops of cargo packets in this station for existence of a a valid link they may use to travel on.
Reroute any cargo not having a valid link and remove timed out links found like this from the linkgraph. We're not all links here as that is expensive and useless. A link no one is using doesn't hurt either.
from | Station to check. |
Definition at line 4024 of file station_cmd.cpp.
References _settings_game, LinkGraph::COMPRESSION_INTERVAL, TimerGameEconomy::date, Vehicle::date_of_last_service, FlowStatMap::DeleteFlows(), DistanceManhattan(), DT_MANUAL, GoodsEntry::flows, SpecializedStation< Station, false >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_link_graph_pool >::GetIfValid(), Station::goods, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, TimerGameConst< struct Economy >::INVALID_DATE, Vehicle::IsStoppedInDepot(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_orderlist_pool >::Iterate(), LinkGraph::LastCompression(), GoodsEntry::link_graph, GameSettings::linkgraph, LinkGraph::MIN_TIMEOUT_DISTANCE, Order::next, Vehicle::NextShared(), GoodsEntry::node, NUM_CARGO, RerouteCargo(), FlowStatMap::RestrictFlows(), LinkRefresher::Run(), LinkGraph::STALE_LINK_DEPOT_TIMEOUT, and BaseStation::xy.
|
static |
This is called right after a station was deleted.
It checks if the whole station is free of substations, and if so, the station will be deleted after a little while.
st | Station |
Definition at line 738 of file station_cmd.cpp.
References BaseStation::delete_ctr, InvalidateWindowData(), BaseStation::IsInUse(), BaseStation::owner, and WC_STATION_LIST.
Referenced by Station::AfterStationTileSetChange(), RemoveFromRailBaseStation(), and RemoveRoadWaypointStop().
|
static |
Definition at line 3086 of file station_cmd.cpp.
Definition at line 3513 of file station_cmd.cpp.
Definition at line 3494 of file station_cmd.cpp.
Definition at line 3456 of file station_cmd.cpp.
Find the part of a dock that is land-based.
t | Dock tile to find land part of |
Definition at line 2919 of file station_cmd.cpp.
References DIAGDIR_BEGIN, DIAGDIR_END, GetDockDirection(), GetStationGfx(), GFX_DOCK_BASE_WATER_PART, INVALID_TILE, IsDockTile(), IsValidTile(), and TileOffsByDiagDir().
Referenced by RemoveDock().
CommandCost FindJoiningBaseStation | ( | StationID | existing_station, |
StationID | station_to_join, | ||
bool | adjacent, | ||
TileArea | ta, | ||
T ** | st, | ||
F | filter | ||
) |
Find a nearby station that joins this station.
T | the class to find a station for |
error_message | the error message when building a station on top of others |
F | the filter functor type |
existing_station | an existing station we build over |
station_to_join | the station to join to |
adjacent | whether adjacent stations are allowed |
ta | the area of the newly build station |
st | 'return' pointer for the found station |
Definition at line 1163 of file station_cmd.cpp.
References _current_company, CommandCost::Failed(), and GetStationAround().
|
static |
Find a nearby station that joins this road stop.
existing_stop | an existing road stop we build over |
station_to_join | the station to join to |
adjacent | whether adjacent stations are allowed |
ta | the area of the newly build station |
st | 'return' pointer for the found station |
Definition at line 1901 of file station_cmd.cpp.
Referenced by CmdBuildRoadStop().
|
static |
Find a nearby station that joins this station.
existing_station | an existing station we build over |
station_to_join | the station to join to |
adjacent | whether adjacent stations are allowed |
ta | the area of the newly build station |
st | 'return' pointer for the found station |
Definition at line 1207 of file station_cmd.cpp.
Referenced by CmdBuildAirport(), CmdBuildDock(), and CmdBuildRailStation().
CommandCost FindJoiningWaypoint | ( | StationID | existing_waypoint, |
StationID | waypoint_to_join, | ||
bool | adjacent, | ||
TileArea | ta, | ||
Waypoint ** | wp, | ||
bool | is_road | ||
) |
Find a nearby waypoint that joins this waypoint.
existing_waypoint | an existing waypoint we build over |
waypoint_to_join | the waypoint to join to |
adjacent | whether adjacent waypoints are allowed |
ta | the area of the newly build waypoint |
wp | 'return' pointer for the found waypoint |
is_road | whether to find a road waypoint |
Definition at line 1222 of file station_cmd.cpp.
References HasBit(), Waypoint::waypoint_flags, and WPF_ROAD.
Referenced by CmdBuildRailWaypoint(), and CmdBuildRoadWaypoint().
|
static |
Find a station action 0 property 24 station name, or reduce the free_names if needed.
tile | the tile to search |
user_data | the StationNameInformation to base the search on |
Definition at line 238 of file station_cmd.cpp.
References StationNameInformation::free_names, GetIndustrySpec(), GetIndustryType(), StationNameInformation::indtypes, IsTileType(), M, and MP_INDUSTRY.
Referenced by GenerateStationName().
truck_station | Determines whether a stop is ROADSTOP_BUS or ROADSTOP_TRUCK |
st | The Station to do the whole procedure for |
Definition at line 1874 of file station_cmd.cpp.
References Station::bus_stops, RoadStop::next, and Station::truck_stops.
Referenced by CmdBuildRoadStop().
|
static |
Clear platform reservation during station building/removing.
v | vehicle which holds reservation |
Definition at line 1235 of file station_cmd.cpp.
References FreeTrainTrackReservation(), Train::GetVehicleTrackdir(), IsRailStationTile(), SpecializedVehicle< T, Type >::Last(), ReverseTrackdir(), SetRailStationPlatformReservation(), Vehicle::tile, and TrackdirToExitdir().
Referenced by CmdBuildRailStation(), and RemoveFromRailBaseStation().
|
static |
Bitmask of remaining station names that can be used when a more specific name has not been used.
Definition at line 254 of file station_cmd.cpp.
References _settings_game, CircularTileSearch(), ClrBit(), CMSAMine(), CMSATree(), CMSAWater(), CountMapSquareAround(), DistanceFromEdge(), DistanceMax(), IndustrySpec::enabled, FindFirstBit(), FindNearIndustryName(), StationNameInformation::free_names, GameSettings::game_creation, GetIndustrySpec(), GetIndustryType(), GetTileZ(), HasBit(), Station::indtype, IsTileForestIndustry(), SpecializedStation< Station, false >::Iterate(), GameCreationSettings::landscape, M, NUM_INDUSTRYTYPES, IndustrySpec::station_name, TileX(), TileY(), BaseStation::town, and Town::xy.
Referenced by BuildStationPart().
|
static |
Get the acceptance of cargoes around the station in.
st | Station to get acceptance of. |
always_accepted | bitmask of cargo accepted by houses and headquarters; can be nullptr |
Definition at line 607 of file station_cmd.cpp.
References Station::catchment_tiles, and INVALID_TILE.
Referenced by UpdateStationAcceptance().
CargoArray GetAcceptanceAroundTiles | ( | TileIndex | center_tile, |
int | w, | ||
int | h, | ||
int | rad, | ||
CargoTypes * | always_accepted | ||
) |
Get the acceptance of cargoes around the tile in 1/8.
center_tile | Center of the search area |
w | X extent of area |
h | Y extent of area |
rad | Search radius in addition to given area |
always_accepted | bitmask of cargo accepted by houses and headquarters; can be nullptr |
ind | Industry associated with neutral station (e.g. oil rig) or nullptr |
Definition at line 585 of file station_cmd.cpp.
References _settings_game, OrthogonalTileArea::Expand(), Industry::GetByTile(), IsTileType(), MP_INDUSTRY, Industry::neutral_station, StationSettings::serve_neutral_industries, and GameSettings::station.
Referenced by DrawStationCoverageAreaText().
CargoTypes GetAcceptanceMask | ( | const Station * | st | ) |
Get a mask of the cargo types that the station accepts.
st | Station to query |
Definition at line 501 of file station_cmd.cpp.
References GoodsEntry::GES_ACCEPTANCE, Station::goods, HasBit(), and SetBit().
Referenced by StationViewWindow::DrawAcceptedCargo(), and UpdateStationAcceptance().
uint8_t GetAirportNoiseLevelForDistance | ( | const AirportSpec * | as, |
uint | distance | ||
) |
Get a possible noise reduction factor based on distance from town center.
The further you get, the less noise you generate. So all those folks at city council can now happily slee... work in their offices
as | airport information |
distance | minimum distance between town and airport |
Definition at line 2421 of file station_cmd.cpp.
References _settings_game, GameSettings::difficulty, AirportSpec::noise_level, and DifficultySettings::town_council_tolerance.
Referenced by CmdBuildAirport(), RemoveAirport(), and UpdateAirportsNoise().
Find the closest deleted station of the current company.
tile | the tile to search from. |
Definition at line 388 of file station_cmd.cpp.
References _current_company, ForAllStationsRadius(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, BaseStation::IsInUse(), and BaseStation::owner.
Referenced by BuildStationPart().
CargoTypes GetEmptyMask | ( | const Station * | st | ) |
Get a mask of the cargo types that are empty at the station.
st | Station to query |
Definition at line 516 of file station_cmd.cpp.
References Station::goods, and SetBit().
Referenced by TriggerRoadStopRandomisation(), and TriggerStationRandomisation().
|
static |
Definition at line 3451 of file station_cmd.cpp.
CargoArray GetProductionAroundTiles | ( | TileIndex | north_tile, |
int | w, | ||
int | h, | ||
int | rad | ||
) |
Get the cargo types being produced around the tile (in a rectangle).
north_tile | Northern most tile of area |
w | X extent of the area |
h | Y extent of the area |
rad | Search radius in addition to the given area |
Definition at line 547 of file station_cmd.cpp.
References _settings_game, OrthogonalTileArea::Expand(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::Get(), GetIndustryIndex(), IsTileType(), IsValidCargoID(), MP_INDUSTRY, Industry::neutral_station, Industry::produced, StationSettings::serve_neutral_industries, and GameSettings::station.
Referenced by DrawStationCoverageAreaText().
|
static |
Definition at line 3446 of file station_cmd.cpp.
CommandCost GetStationAround | ( | TileArea | ta, |
StationID | closest_station, | ||
CompanyID | company, | ||
T ** | st, | ||
F | filter | ||
) |
Look for a station owned by the given company around the given tile area.
ta | the area to search over |
closest_station | the closest owned station found so far |
company | the company whose stations to look for |
st | to 'return' the found station |
filter | Filter function |
Definition at line 119 of file station_cmd.cpp.
References OrthogonalTileArea::Expand(), GetStationIndex(), IsTileType(), and MP_STATION.
Referenced by FindJoiningBaseStation().
void GetStationLayout | ( | uint8_t * | layout, |
uint | numtracks, | ||
uint | plat_len, | ||
const StationSpec * | statspec | ||
) |
Create the station layout for the given number of tracks and platform length.
layout | The layout to write to. |
numtracks | The number of tracks to write. |
plat_len | The length of the platforms. |
statspec | The specification of the station to (possibly) get the layout from. |
Definition at line 1126 of file station_cmd.cpp.
References GetStationLayoutKey(), and StationSpec::layouts.
Referenced by CmdBuildRailStation(), and CmdBuildRailWaypoint().
|
static |
Get station tile flags for the given StationGfx.
gfx | StationGfx of station tile. |
statspec | Station spec of station tile. |
Definition at line 1310 of file station_cmd.cpp.
References StationSpec::Pylons, and StationSpec::tileflags.
Referenced by SetRailStationTileFlags().
const DrawTileSprites * GetStationTileLayout | ( | StationType | st, |
uint8_t | gfx | ||
) |
Get station tile layout for a station type and its station gfx.
st | Station type to draw. |
gfx | StationGfx of tile to draw. |
Definition at line 3014 of file station_cmd.cpp.
Referenced by DrawStationTile().
Definition at line 3531 of file station_cmd.cpp.
|
static |
Definition at line 3566 of file station_cmd.cpp.
bool HasStationInUse | ( | StationID | station, |
bool | include_company, | ||
CompanyID | company | ||
) |
Tests whether the company's vehicles have this station in orders.
station | station ID |
include_company | If true only check vehicles of company, if false only check vehicles of other companies |
company | company ID |
Definition at line 2758 of file station_cmd.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_orderlist_pool >::Iterate(), and Vehicle::owner.
Referenced by CompanyStationsWindow::BuildStationsList(), and RemoveBuoy().
void IncreaseStats | ( | Station * | st, |
CargoID | cargo, | ||
StationID | next_station_id, | ||
uint | capacity, | ||
uint | usage, | ||
uint32_t | time, | ||
EdgeUpdateMode | mode | ||
) |
Increase capacity for a link stat given by station cargo and next hop.
st | Station to get the link stats from. |
cargo | Cargo to increase stat for. |
next_station_id | Station the consist will be travelling to next. |
capacity | Capacity to add to link stat. |
usage | Usage to add to link stat. |
mode | Update mode to be applied. |
Definition at line 4118 of file station_cmd.cpp.
References LinkGraph::AddNode(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_link_graph_pool >::CanAllocateItem(), Debug, SpecializedStation< Station, false >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_link_graph_pool >::Get(), Station::goods, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, LinkGraphSchedule::instance, GoodsEntry::link_graph, LinkGraph::Merge(), GoodsEntry::node, LinkGraphSchedule::Queue(), LinkGraph::Size(), and LinkGraphSchedule::Unqueue().
Referenced by Vehicle::BeginLoading(), IncreaseStats(), and LinkRefresher::RefreshStats().
void IncreaseStats | ( | Station * | st, |
const Vehicle * | front, | ||
StationID | next_station_id, | ||
uint32_t | time | ||
) |
Increase capacity for all link stats associated with vehicles in the given consist.
st | Station to get the link stats from. |
front | First vehicle in the consist. |
next_station_id | Station the consist will be travelling to next. |
Definition at line 4170 of file station_cmd.cpp.
References Vehicle::cargo, Vehicle::cargo_type, EUM_INCREASE, IncreaseStats(), Vehicle::Next(), Vehicle::refit_cap, and VehicleCargoList::StoredCount().
bool IsHangar | ( | Tile | t | ) |
Check whether the given tile is a hangar.
t | the tile to of whether it is a hangar. |
Definition at line 92 of file station_cmd.cpp.
References Station::airport, AirportSpec::depots, BaseStation::GetByTile(), Airport::GetRotatedTileFromOffset(), Airport::GetSpec(), IsAirport(), IsTileType(), and MP_STATION.
Referenced by IsHangarTile().
|
static |
Definition at line 4297 of file station_cmd.cpp.
|
static |
Definition at line 1605 of file station_cmd.cpp.
void MakeRoadWaypointStationAreaSmaller | ( | BaseStation * | st, |
TileArea & | road_waypoint_area | ||
) |
Definition at line 1626 of file station_cmd.cpp.
|
static |
Definition at line 1615 of file station_cmd.cpp.
|
static |
Definition at line 1550 of file station_cmd.cpp.
Definition at line 4236 of file station_cmd.cpp.
uint MoveGoodsToStation | ( | CargoID | type, |
uint | amount, | ||
SourceType | source_type, | ||
SourceID | source_id, | ||
const StationList & | all_stations, | ||
Owner | exclusivity | ||
) |
Definition at line 4394 of file station_cmd.cpp.
void OnTick_Station | ( | ) |
Definition at line 4198 of file station_cmd.cpp.
|
static |
Remove an airport.
tile | TileIndex been queried |
flags | operation to perform |
Definition at line 2654 of file station_cmd.cpp.
References _current_company, _settings_game, CommandCost::AddCost(), Station::AfterStationTileSetChange(), Station::airport, AirportGetNearestTown(), CheckOwnership(), OrthogonalTileArea::Clear(), CloseWindowById(), DC_EXEC, DeleteNewGRFInspectWindow(), GameSettings::economy, EnsureNoVehicleOnGround(), EXPENSES_CONSTRUCTION, BaseStation::facilities, CommandCost::Failed(), FLYING, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), GetAirportNoiseLevelForDistance(), BaseStation::GetByTile(), Airport::GetHangarTile(), Airport::GetNumHangars(), Airport::GetSpec(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Iterate(), Town::noise_reached, BaseStation::owner, OWNER_WATER, Airport::psa, BaseStation::rect, OrderBackup::Reset(), SetWindowClassesDirty(), SetWindowDirty(), EconomySettings::station_noise_level, OrthogonalTileArea::tile, WC_STATION_VIEW, WC_TOWN_VIEW, WC_VEHICLE_DEPOT, and WC_VEHICLE_ORDERS.
Referenced by ClearTile_Station().
|
static |
Remove a dock.
tile | TileIndex been queried |
flags | operation to perform |
Definition at line 2942 of file station_cmd.cpp.
References Station::AfterStationTileSetChange(), CheckOwnership(), OrthogonalTileArea::Clear(), ClearDockingTilesCheckingNeighbours(), CMD_ERROR, DC_EXEC, Station::docking_station, EnsureNoVehicleOnGround(), EXPENSES_CONSTRUCTION, FACIL_DOCK, BaseStation::facilities, CommandCost::Failed(), FindDockLandPart(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), BaseStation::GetByTile(), GetDockDirection(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_TILE, IsDockingTile(), IsDockTile(), IsShipDestinationTile(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Iterate(), MarkTileDirtyByTile(), BaseStation::owner, BaseStation::rect, SetWindowClassesDirty(), Station::ship_station, CommandCost::Succeeded(), OrthogonalTileArea::tile, TileOffsByDiagDir(), and WC_VEHICLE_ORDERS.
Referenced by ClearTile_Station().
void RemoveDockingTile | ( | TileIndex | t | ) |
Definition at line 2877 of file station_cmd.cpp.
CommandCost RemoveFromRailBaseStation | ( | TileArea | ta, |
std::vector< T * > & | affected_stations, | ||
DoCommandFlag | flags, | ||
Money | removal_cost, | ||
bool | keep_rail | ||
) |
Remove a number of tiles from any rail station within the area.
ta | the area to clear station tile from. |
affected_stations | the stations affected. |
flags | the command flags. |
removal_cost | the cost for removing the tile, including the rail. |
keep_rail | whether to keep the rail of the station. |
T | the type of station to remove. |
Definition at line 1642 of file station_cmd.cpp.
References _current_company, CommandCost::AddCost(), AddTrackToSignalBuffer(), CheckOwnership(), DC_EXEC, DeallocateSpecFromStation(), DeleteNewGRFInspectWindow(), DeleteStationIfEmpty(), DirtyCompanyInfrastructureWindows(), EnsureNoVehicleOnGround(), EXPENSES_CONSTRUCTION, BaseStation::facilities, CommandCost::Failed(), FreeTrainReservation(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), GetCustomStationSpecIndex(), GetRailStationTrack(), GetRailType(), GetTileOwner(), GetTrainForReservation(), HasStationReservation(), HasStationTileRail(), include(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_TILE, IsStationTileBlocked(), OWNER_WATER, RestoreTrainReservation(), SetWindowClassesDirty(), SetWindowWidgetDirty(), OrthogonalTileArea::tile, TrackToTrackBits(), BaseStation::train_station, BaseStation::UpdateVirtCoord(), WC_STATION_VIEW, WC_VEHICLE_ORDERS, WID_SV_TRAINS, and YapfNotifyTrackLayoutChange().
Referenced by CmdRemoveFromRailStation(), CmdRemoveFromRailWaypoint(), and RemoveRailStation().
|
static |
Remove a tile area of road stop or road waypoints.
flags | operation to perform |
roadstop_area | tile area of road stop or road waypoint tiles to remove |
station_type | station type to remove |
remove_road | Remove roads of drive-through stops? |
Definition at line 2318 of file station_cmd.cpp.
References _current_company, CommandCost::AddCost(), AxisToRoadBits(), ClosestTownFromTile(), CountBits(), DC_EXEC, EXPENSES_CONSTRUCTION, CommandCost::Failed(), GetDriveThroughStopAxis(), GetRoadOwner(), GetStationType(), INVALID_ROADTYPE, IsAnyRoadStop(), IsDriveThroughStopTile(), IsTileType(), MakeRoadNormal(), MP_STATION, OWNER_NONE, RemoveRoadStop(), RemoveRoadWaypointStop(), ROAD_NONE, and UpdateCompanyRoadInfrastructure().
Referenced by CmdRemoveFromRoadWaypoint(), and CmdRemoveRoadStop().
CommandCost RemoveRailStation | ( | T * | st, |
DoCommandFlag | flags, | ||
Money | removal_cost | ||
) |
Remove a rail station/waypoint.
st | The station/waypoint to remove the rail part from |
flags | operation to perform |
removal_cost | the cost for removing a tile |
T | the type of station to remove |
Definition at line 1803 of file station_cmd.cpp.
References _current_company, CommandCost::AddCost(), CheckOwnership(), EXPENSES_CONSTRUCTION, CommandCost::Failed(), OrthogonalTileArea::h, OWNER_WATER, RemoveFromRailBaseStation(), and OrthogonalTileArea::w.
Referenced by ClearTile_Station(), RemoveRailStation(), and RemoveRailWaypoint().
|
static |
Remove a rail station.
tile | Tile of the station. |
flags | operation to perform |
Definition at line 1837 of file station_cmd.cpp.
References _current_company, DC_EXEC, BaseStation::GetByTile(), OWNER_WATER, Station::RecomputeCatchment(), and RemoveRailStation().
|
static |
Remove a rail waypoint.
tile | Tile of the waypoint. |
flags | operation to perform |
Definition at line 1858 of file station_cmd.cpp.
References _current_company, DC_EXEC, BaseStation::GetByTile(), OWNER_WATER, and RemoveRailStation().
Referenced by ClearTile_Station().
|
static |
Remove a bus station/truck stop.
tile | TileIndex been queried |
flags | operation to perform |
replacement_spec_index | replacement spec index to avoid deallocating, if < 0, tile is not being replaced |
Definition at line 2140 of file station_cmd.cpp.
References _current_company, OrthogonalTileArea::Add(), Station::AfterStationTileSetChange(), Station::bus_station, Station::bus_stops, CheckOwnership(), OrthogonalTileArea::Clear(), RoadStop::ClearDriveThrough(), Vehicle::current_order, DC_BANKRUPT, DC_EXEC, DeleteAnimatedTile(), DeleteNewGRFInspectWindow(), Vehicle::dest_tile, DirtyCompanyInfrastructureWindows(), EnsureNoVehicleOnGround(), EXPENSES_CONSTRUCTION, BaseStation::facilities, CommandCost::Failed(), FindVehicleOnPos(), FindVehiclesWithOrder(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), BaseStation::GetByTile(), RoadStop::GetByTile(), RoadStopSpec::GetClearCost(), GetCustomRoadStopSpecIndex(), Vehicle::GetOrderStationLocation(), GetRoadOwner(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, IsDriveThroughStopTile(), IsTruckStop(), Order::IsType(), RoadStop::next, BaseStation::owner, OWNER_WATER, BaseStation::rect, ROAD_STOP_TRACKBIT_FACTOR, ROADSTOP_BUS, ROADSTOP_TRUCK, SetWindowClassesDirty(), Station::truck_station, Station::truck_stops, BaseVehicle::type, UpdateCompanyRoadInfrastructure(), VEH_ROAD, and WC_VEHICLE_ORDERS.
Referenced by ClearTile_Station(), CmdBuildRoadStop(), and RemoveGenericRoadStop().
CommandCost RemoveRoadWaypointStop | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
int | replacement_spec_index | ||
) |
Remove a road waypoint.
tile | TileIndex been queried |
flags | operation to perform |
replacement_spec_index | replacement spec index to avoid deallocating, if < 0, tile is not being replaced |
Definition at line 2254 of file station_cmd.cpp.
References _current_company, CheckOwnership(), DC_BANKRUPT, DC_EXEC, DeleteNewGRFInspectWindow(), DeleteStationIfEmpty(), DirtyCompanyInfrastructureWindows(), EnsureNoVehicleOnGround(), EXPENSES_CONSTRUCTION, FACIL_BUS_STOP, FACIL_TRUCK_STOP, BaseStation::facilities, CommandCost::Failed(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), BaseStation::GetByTile(), RoadStopSpec::GetClearCost(), GetCustomRoadStopSpecIndex(), GetRoadOwner(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_TILE, BaseStation::owner, OWNER_WATER, BaseStation::rect, ROAD_STOP_TRACKBIT_FACTOR, Waypoint::road_waypoint_area, SetWindowWidgetDirty(), OrthogonalTileArea::tile, UpdateCompanyRoadInfrastructure(), Waypoint::UpdateVirtCoord(), WC_STATION_VIEW, and WID_SV_ROADVEHS.
Referenced by ClearTile_Station(), CmdBuildRoadWaypoint(), and RemoveGenericRoadStop().
Reroute cargo of type c at station st or in any vehicles unloading there.
Make sure the cargo's new next hop is neither "avoid" nor "avoid2".
st | Station to be rerouted at. |
c | Type of cargo. |
avoid | Original next hop of cargo, avoid this. |
avoid2 | Another station to be avoided when rerouting. |
Definition at line 4000 of file station_cmd.cpp.
References GoodsEntry::cargo, Station::goods, Vehicle::Next(), and StationCargoList::Reroute().
Referenced by DeleteStaleLinks(), LinkGraphJob::~LinkGraphJob(), and Station::~Station().
|
static |
Restore platform reservation during station building/removing.
v | vehicle which held reservation |
Definition at line 1247 of file station_cmd.cpp.
References Train::GetVehicleTrackdir(), IsRailStationTile(), SpecializedVehicle< T, Type >::Last(), ReverseTrackdir(), SetRailStationPlatformReservation(), Vehicle::tile, TrackdirToExitdir(), and TryPathReserve().
Referenced by CmdBuildRailStation(), and RemoveFromRailBaseStation().
void SetRailStationTileFlags | ( | TileIndex | tile, |
const StationSpec * | statspec | ||
) |
Set rail station tile flags for the given tile.
tile | Tile to set flags on. |
statspec | Statspec of the tile. |
Definition at line 1322 of file station_cmd.cpp.
References StationSpec::Blocked, GetStationGfx(), GetStationTileFlags(), HasFlag(), StationSpec::NoWires, StationSpec::Pylons, SetStationTileBlocked(), SetStationTileHavePylons(), and SetStationTileHaveWires().
Referenced by AfterLoadGame(), CmdBuildRailStation(), and CmdBuildRailWaypoint().
|
static |
Add news item for when a station changes which cargoes it accepts.
st | Station of cargo change. |
cargoes | Bit mask of cargo types to list. |
reject | True iff the station rejects the cargo types. |
Definition at line 532 of file station_cmd.cpp.
References AddNewsItem(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, NF_INCOLOUR, NF_SMALL, NR_STATION, NT_ACCEPTANCE, and SetDParam().
Referenced by UpdateStationAcceptance().
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 rail overlay.
If the ground sprite is suitable, ground is replaced with the new non-track ground sprite, and overlay_offset is set to the overlay to draw.
ti | Positional info for the tile to decide snowyness etc. May be nullptr. | |
[in,out] | ground | Groundsprite to draw. |
[out] | overlay_offset | Overlay to draw. |
Definition at line 3030 of file station_cmd.cpp.
References _settings_game, GameSettings::game_creation, GetSnowLine(), GetTropicZone(), GameCreationSettings::landscape, RTO_X, RTO_Y, TileInfo::tile, TILE_HEIGHT, TROPICZONE_DESERT, and TileInfo::z.
Referenced by DrawStationTile().
|
static |
This function is called for each station once every 250 ticks.
Not all stations will get the tick at the same time.
st | the station receiving the tick. |
Definition at line 3784 of file station_cmd.cpp.
References ClrBit(), BaseStation::delete_ctr, FACIL_WAYPOINT, BaseStation::facilities, SpecializedStation< Station, false >::From(), GoodsEntry::GES_ACCEPTED_BIGTICK, Station::goods, SpecializedStation< Station, false >::IsExpected(), BaseStation::IsInUse(), TriggerWatchedCargoCallbacks(), and UpdateStationAcceptance().
|
static |
Definition at line 4187 of file station_cmd.cpp.
void StationPickerDrawSprite | ( | int | x, |
int | y, | ||
StationType | st, | ||
RailType | railtype, | ||
RoadType | roadtype, | ||
int | image | ||
) |
Definition at line 3395 of file station_cmd.cpp.
|
static |
Definition at line 4739 of file station_cmd.cpp.
|
static |
Definition at line 1600 of file station_cmd.cpp.
|
static |
Definition at line 1621 of file station_cmd.cpp.
|
static |
Definition at line 1610 of file station_cmd.cpp.
|
static |
Definition at line 3613 of file station_cmd.cpp.
void TriggerWatchedCargoCallbacks | ( | Station * | st | ) |
Run the watched cargo callback for all houses in the catchment area.
st | Station. |
Definition at line 3758 of file station_cmd.cpp.
References Station::catchment_tiles, GoodsEntry::GES_ACCEPTED_BIGTICK, Station::goods, HasBit(), INVALID_TILE, IsTileType(), MP_HOUSE, NUM_CARGO, SetBit(), GoodsEntry::status, and WatchedCargoCallback().
Referenced by StationHandleBigTick().
|
static |
Truncate the cargo by a specific amount.
cs | The type of cargo to perform the truncation for. |
ge | The goods entry, of the station, to truncate. |
amount | The amount to truncate the cargo by. |
Definition at line 3817 of file station_cmd.cpp.
References GoodsEntry::cargo, SpecializedStation< Station, false >::GetIfValid(), Station::goods, CargoSpec::Index(), GoodsEntry::max_waiting_cargo, and StationCargoList::Truncate().
void UpdateAirportsNoise | ( | ) |
Recalculate the noise generated by the airports of each town.
Definition at line 2502 of file station_cmd.cpp.
References AirportGetNearestTown(), AT_OILRIG, GetAirportNoiseLevelForDistance(), INVALID_TILE, SpecializedStation< Station, false >::Iterate(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::Iterate(), and Town::noise_reached.
Referenced by DoCreateTown(), and InitializeWindowsAndCaches().
void UpdateAllStationVirtCoords | ( | ) |
Update the virtual coords needed to draw the station sign for all stations.
Definition at line 476 of file station_cmd.cpp.
Referenced by CmdRenameTown(), and UpdateAllVirtCoords().
void UpdateStationAcceptance | ( | Station * | st, |
bool | show_msg | ||
) |
Update the acceptance for a station.
st | Station to update |
show_msg | controls whether to display a message that acceptance was changed. |
Definition at line 625 of file station_cmd.cpp.
References _local_company, Station::always_accepted, CC_PASSENGERS, FACIL_BUS_STOP, FACIL_TRUCK_STOP, BaseStation::facilities, GoodsEntry::GES_ACCEPTANCE, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_link_graph_pool >::Get(), GetAcceptanceAroundStation(), GetAcceptanceMask(), Station::goods, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, IsCargoInClass(), BaseStation::IsInUse(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_link_graph_pool >::IsValidID(), GoodsEntry::link_graph, GoodsEntry::node, NUM_CARGO, BaseStation::owner, BaseStation::rect, SB(), SetWindowWidgetDirty(), ShowRejectOrAcceptNews(), GoodsEntry::status, WC_STATION_VIEW, and WID_SV_ACCEPT_RATING_LIST.
Referenced by AfterLoadGame(), Station::AfterStationTileSetChange(), and StationHandleBigTick().
void UpdateStationDockingTiles | ( | Station * | st | ) |
Definition at line 4479 of file station_cmd.cpp.
|
static |
Definition at line 3833 of file station_cmd.cpp.
|
static |
Definition at line 673 of file station_cmd.cpp.
|
static |
Definition at line 4249 of file station_cmd.cpp.
|
static |
Definition at line 3706 of file station_cmd.cpp.
|
static |
Definition at line 2781 of file station_cmd.cpp.
|
static |
Definition at line 2774 of file station_cmd.cpp.
|
static |
Definition at line 2780 of file station_cmd.cpp.
|
extern |
Definition at line 53 of file landscape.cpp.