|
OpenTTD Source 20261112-master-gbcbec5e63f
|
Command definitions related to stations. More...
#include "command_type.h"#include "rail_type.h"#include "road_type.h"#include "station_type.h"#include "newgrf_roadstop.h"#include "newgrf_station.h"#include "tilearea_airport.h"#include "tilearea_airportlayout.h"#include "tilearea_wrapper.h"Go to the source code of this file.
Functions | |
| Town * | AirportGetNearestTown (const AirportSpec *as, Direction rotation, TileIndex tile, TileIteratorWrapper< AirportTileIterator, AirportTileTableIterator > &&iter, uint &mindist) |
| Finds the town nearest to given airport. | |
| uint8_t | GetAirportNoiseLevelForDistance (const AirportSpec *as, uint distance) |
| Get a possible noise reduction factor based on distance from town center. | |
| CommandCost | CmdBuildAirport (DoCommandFlags flags, TileIndex tile, uint8_t airport_type, uint8_t layout, StationID station_to_join, bool allow_adjacent) |
| Place an Airport. | |
| CommandCost | CmdBuildDock (DoCommandFlags flags, TileIndex tile, StationID station_to_join, bool adjacent) |
| Build a dock/haven. | |
| CommandCost | CmdBuildRailStation (DoCommandFlags 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. | |
| CommandCost | CmdRemoveFromRailStation (DoCommandFlags flags, TileIndex start, TileIndex end, bool keep_rail) |
| Remove a single tile from a rail station. | |
| CommandCost | CmdBuildRoadStop (DoCommandFlags 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. | |
| CommandCost | CmdRemoveRoadStop (DoCommandFlags flags, TileIndex tile, uint8_t width, uint8_t height, RoadStopType stop_type, bool remove_road) |
| Remove bus or truck stops. | |
| CommandCost | CmdRenameStation (DoCommandFlags flags, StationID station_id, const std::string &text) |
| Rename a station. | |
| std::tuple< CommandCost, StationID > | CmdMoveStationName (DoCommandFlags flags, StationID station_id, TileIndex tile) |
| Move a station name. | |
| CommandCost | CmdOpenCloseAirport (DoCommandFlags flags, StationID station_id) |
| Open/close an airport to incoming aircraft. | |
| void | CcMoveStationName (Commands, const CommandCost &result, StationID station_id) |
| Callback function that is called after a name is moved. | |
Command definitions related to stations.
Definition in file station_cmd.h.
|
extern |
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) | |
| iter | An iterator over all airport tiles (consumed) | |
| [out] | mindist | Minimum distance to town |
Definition at line 2552 of file station_cmd.cpp.
References CalcClosestTownFromTile(), DistanceManhattan(), E, INVALID_TILE, IsInsideBS(), AirportSpec::size_x, AirportSpec::size_y, TileX(), TileY(), W, and Town::xy.
Referenced by AirportGetNearestTown(), CmdBuildAirport(), RemoveAirport(), and UpdateAirportsNoise().
| void CcMoveStationName | ( | Commands | , |
| const CommandCost & | result, | ||
| StationID | station_id ) |
Callback function that is called after a name is moved.
| result | of the operation |
| station_id | ID of the changed station |
Definition at line 4535 of file station_cmd.cpp.
References CommandCost::Failed(), SpecializedStation< Station, false >::Get(), ResetObjectToPlace(), and SetViewportStationRect().
Referenced by QueryStringWindow::OnPlaceObject().
| CommandCost CmdBuildAirport | ( | DoCommandFlags | 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 2626 of file station_cmd.cpp.
References _price, _settings_game, OrthogonalTileArea::Add(), AddAnimatedTile(), CommandCost::AddCost(), Station::AddFacility(), Station::AfterStationTileSetChange(), AirportFTAClass::Airplanes, Airport, Station::airport, AirportGetNearestTown(), AT_OILRIG, Airport::blocks, BuildStationAirport, BuildStationPart(), Built, CheckFlatLandAirport(), CheckIfAuthorityAllowsNewStation(), CheckStationSpread(), ClosestTownFromTile(), CMD_ERROR, CommandCostWithParam(), E, Execute, BaseStation::facilities, CommandCost::Failed(), FindJoiningStation(), GB(), AirportSpec::Get(), AirportTileSpec::Get(), GetAirport(), GetAirportNoiseLevelForDistance(), SpecializedStation< Station, false >::GetIfValid(), GetTranslatedAirportTileID(), Heliport, Invalid, INVALID_TILE, InvalidateWindowData(), AirportSpec::IsAvailable(), OrthogonalTileArea::IsEmpty(), SpecializedStation< Station, false >::IsValidID(), AirportSpec::IsWithinMapBounds(), SpecializedStation< Station, false >::Iterate(), Airport::layout, RailStationTileLayout< T >::layout, AirportSpec::layouts, MakeAirport(), Town::MaxTownNoise(), NoAnimation, Town::noise_reached, NUM_AIRPORTS, BaseStation::owner, Airport::rotation, SetStationTileRandomBits(), SetWindowDirty(), AirportSpec::size_x, AirportSpec::size_y, BaseStation::spread, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), BaseStation::town, Airport::type, UpdateAirplanesOnNewStation(), and W.
| CommandCost CmdBuildDock | ( | DoCommandFlags | 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 2894 of file station_cmd.cpp.
References _current_company, _dock_h_chk, _dock_tileoffs_chkaround, _dock_w_chk, _price, _settings_game, OrthogonalTileArea::Add(), CommandCost::AddCost(), Station::AddFacility(), Station::AfterStationTileSetChange(), BuildStationDock, BuildStationPart(), Canal, CheckIfAuthorityAllowsNewStation(), CMD_ERROR, Construction, DiagDirToAxis(), Dock, Execute, CommandCost::Failed(), FindJoiningStation(), CommandCost::GetCost(), SpecializedStation< Station, false >::GetIfValid(), GetInclinedSlopeDirection(), GetTileSlope(), GetWaterClass(), GFX_DOCK_BASE_WATER_PART, HasTileWaterClass(), HasTileWaterGround(), Invalid, IsDockBridgeAboveOk(), IsTileFlat(), IsTileOwner(), IsTileType(), SpecializedStation< Station, false >::IsValidID(), IsWaterTile(), MakeDock(), BaseStation::owner, ReverseDiagDir(), Station::ship_station, BaseStation::spread, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), TileOffsByDiagDir(), to_underlying(), ToTileIndexDiff(), and Water.
| CommandCost CmdBuildRailStation | ( | DoCommandFlags | 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 1432 of file station_cmd.cpp.
References _current_company, _settings_game, OrthogonalTileArea::Add(), Station::AddFacility(), AddTrackToSignalBuffer(), Station::AfterStationTileSetChange(), AllocateSpecToStation(), AssignSpecToStation(), Avail, AxisToDiagDir(), AxisToTrack(), BuildStationPart(), Built, BaseStation::cached_anim_triggers, CalculateRailStationCost(), CALLBACK_FAILED, StationSpec::callback_mask, CBID_STATION_AVAILABILITY, CBID_STATION_BUILD_TILE_LAYOUT, CheckIfAuthorityAllowsNewStation(), CheckStationSpread(), CMD_ERROR, Convert8bitBooleanCallback(), DeallocateSpecFromStation(), DeleteAnimatedTile(), DeleteNewGRFInspectWindow(), StationSpec::disallowed_lengths, StationSpec::disallowed_platforms, ErrorUnknownCallbackResult(), Execute, CommandCost::Failed(), FindJoiningStation(), FreeTrainReservation(), GB(), NewGRFClass< StationSpec, StationClassID >::Get(), NewGRFClass< StationSpec, StationClassID >::GetClassCount(), GetCustomStationSpecIndex(), GetPlatformInfo(), GetRailStationAxis(), GetRailType(), NewGRFClass< Tspec, Tindex >::GetSpec(), NewGRFClass< Tspec, Tindex >::GetSpecCount(), GetTrainForReservation(), StationSpec::grf_prop, GRFFilePropsBase::grffile, GRFFilePropsBase::grfid, HasBit(), HasStationReservation(), HasStationTileRail(), Company::infrastructure, INVALID_TILE, IsBridgeAbove(), IsCompatibleTrainStationTile(), IsRailStationBridgeAboveOk(), IsRailStationTile(), IsStationTileBlocked(), IsValidAxis(), SpecializedStation< Station, false >::IsValidID(), IsValidTile(), IsWaypointClass(), MakeRailStation(), Station::MarkTilesDirty(), OtherAxis(), BaseStation::owner, Rail, CompanyInfrastructure::rail, RestoreTrainReservation(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Set(), SetAnimationFrame(), SetCustomStationSpecIndex(), SetRailStationPlatformReservation(), SetRailStationTileFlags(), SetStationGfx(), SetStationTileRandomBits(), BaseStation::spread, CompanyInfrastructure::station, Stations, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), OrthogonalTileArea::tile, TileAddWrap(), TileOffsByAxis(), TileOffsByDiagDir(), to_underlying(), Train, BaseStation::train_station, ValParamRailType(), X, and YapfNotifyTrackLayoutChange().
| CommandCost CmdBuildRoadStop | ( | DoCommandFlags | 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 2066 of file station_cmd.cpp.
References _current_company, _price, _settings_game, OrthogonalTileArea::Add(), Station::AddFacility(), Station::AfterStationTileSetChange(), AllocateSpecToRoadStop(), AssignSpecToRoadStop(), Avail, BuildStationBus, BuildStationPart(), BuildStationTruck, Built, Bus, Station::bus_station, BusStop, BaseStation::cached_roadstop_anim_triggers, CalculateRoadStopCost(), CALLBACK_FAILED, CBID_STATION_AVAILABILITY, CheckIfAuthorityAllowsNewStation(), CheckStationSpread(), CMD_ERROR, Convert8bitBooleanCallback(), Count, DiagDirToAxis(), DriveThroughOnly, End, Execute, CommandCost::Failed(), FindJoiningRoadStop(), FindRoadStopSpot(), GB(), NewGRFClass< RoadStopSpec, RoadStopClassID >::Get(), RoadStopSpec::GetBuildCost(), NewGRFClass< RoadStopSpec, RoadStopClassID >::GetClassCount(), GetRoadBits(), GetRoadOwner(), GetRoadType(), NewGRFClass< Tspec, Tindex >::GetSpec(), NewGRFClass< Tspec, Tindex >::GetSpecCount(), RoadStopSpec::grf_prop, GRFFilePropsBase::grffile, OrthogonalTileArea::h, INVALID_ROADTYPE, INVALID_TILE, IsNormalRoadTile(), IsStationRoadStop(), IsTileType(), IsValidDiagDirection(), SpecializedStation< Station, false >::IsValidID(), IsValidTile(), IsWaypointClass(), RailStationTileLayout< T >::length, RoadStop::MakeDriveThrough(), MakeDriveThroughRoadStop(), MakeRoadStop(), MarkTileDirtyByTile(), MayHaveRoad(), BaseStation::owner, RemoveRoadStop(), Road, ROAD_STOP_TRACKBIT_FACTOR, ROADSTOPTYPE_ALL, ROADSTOPTYPE_FREIGHT, ROADSTOPTYPE_PASSENGER, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Set(), SetCustomRoadStopSpecIndex(), BaseStation::spread, Station, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), TileAddWrap(), Tram, Truck, Station::truck_station, TruckStop, UpdateCompanyRoadInfrastructure(), ValParamRoadType(), and OrthogonalTileArea::w.
| std::tuple< CommandCost, StationID > CmdMoveStationName | ( | DoCommandFlags | flags, |
| StationID | station_id, | ||
| TileIndex | tile ) |
Move a station name.
| flags | type of operation |
| station_id | id of the station |
| tile | to move the station name to |
Definition at line 4498 of file station_cmd.cpp.
References CheckOwnership(), CMD_ERROR, OrthogonalTileArea::Contains(), Execute, CommandCost::Failed(), ForAllStationsRadius(), SpecializedStation< Station, false >::GetIfValid(), Station::MoveSign(), BaseStation::owner, OWNER_NONE, Station::RecomputeCatchment(), BaseStation::spread, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), Station::UpdateVirtCoord(), and BaseStation::xy.
| CommandCost CmdOpenCloseAirport | ( | DoCommandFlags | 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 2834 of file station_cmd.cpp.
References Airport, Station::airport, AirportClosed, Airport::blocks, CheckOwnership(), CMD_ERROR, Execute, BaseStation::facilities, CommandCost::Failed(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Flip(), SpecializedStation< Station, false >::Get(), SpecializedStation< Station, false >::IsValidID(), BaseStation::owner, OWNER_NONE, SetWindowWidgetDirty(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and WID_SV_CLOSE_AIRPORT.
| CommandCost CmdRemoveFromRailStation | ( | DoCommandFlags | 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 1856 of file station_cmd.cpp.
References _price, ClearStationRail, CMD_ERROR, CommandCost::Failed(), OrthogonalTileArea::IsEmpty(), RemoveFromRailBaseStation(), SetWindowWidgetDirty(), Map::Size(), BaseStation::train_station, and WID_SV_TRAINS.
| CommandCost CmdRemoveRoadStop | ( | DoCommandFlags | 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 2481 of file station_cmd.cpp.
References Bankrupt, CMD_ERROR, End, INVALID_TILE, IsValidTile(), RemoveGenericRoadStop(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and TileAddWrap().
| CommandCost CmdRenameStation | ( | DoCommandFlags | 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 4461 of file station_cmd.cpp.
References BaseStation::cached_name, CheckOwnership(), CMD_ERROR, Execute, CommandCost::Failed(), SpecializedStation< Station, false >::GetIfValid(), InvalidateWindowData(), MAX_LENGTH_STATION_NAME_CHARS, BaseStation::name, BaseStation::owner, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), Station::UpdateVirtCoord(), and Utf8StringLength().
|
extern |
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 2521 of file station_cmd.cpp.
References _settings_game, and AirportSpec::noise_level.
Referenced by CmdBuildAirport(), RemoveAirport(), and UpdateAirportsNoise().