|
OpenTTD Source
14.0-beta3
|
#include "stdafx.h"#include "command_func.h"#include "landscape.h"#include "bridge_map.h"#include "town.h"#include "waypoint_base.h"#include "pathfinder/yapf/yapf_cache.h"#include "pathfinder/water_regions.h"#include "strings_func.h"#include "viewport_func.h"#include "viewport_kdtree.h"#include "window_func.h"#include "timer/timer_game_calendar.h"#include "vehicle_func.h"#include "string_func.h"#include "company_func.h"#include "newgrf_station.h"#include "company_base.h"#include "water.h"#include "company_gui.h"#include "waypoint_cmd.h"#include "landscape_cmd.h"#include "table/strings.h"#include "safeguards.h"Go to the source code of this file.
Functions | |
| static Waypoint * | FindDeletedWaypointCloseTo (TileIndex tile, StringID str, CompanyID cid) |
| Find a deleted waypoint close to a tile. More... | |
| Axis | GetAxisForNewWaypoint (TileIndex tile) |
| Get the axis for a new waypoint. More... | |
| CommandCost | ClearTile_Station (TileIndex tile, DoCommandFlag flags) |
| Clear a single tile of a station. More... | |
| static CommandCost | IsValidTileForWaypoint (TileIndex tile, Axis axis, StationID *waypoint) |
| Check whether the given tile is suitable for a waypoint. More... | |
| void | GetStationLayout (byte *layout, uint numtracks, uint plat_len, const StationSpec *statspec) |
| Create the station layout for the given number of tracks and platform length. More... | |
| CommandCost | FindJoiningWaypoint (StationID existing_station, StationID station_to_join, bool adjacent, TileArea ta, Waypoint **wp) |
| Find a nearby waypoint that joins this waypoint. More... | |
| CommandCost | CanExpandRailStation (const BaseStation *st, TileArea &new_ta) |
| Check whether we can expand the rail part of the given station. More... | |
| CommandCost | CmdBuildRailWaypoint (DoCommandFlag flags, TileIndex start_tile, Axis axis, byte width, byte height, StationClassID spec_class, uint16_t spec_index, StationID station_to_join, bool adjacent) |
| Convert existing rail to waypoint. More... | |
| CommandCost | CmdBuildBuoy (DoCommandFlag flags, TileIndex tile) |
| Build a buoy. More... | |
| CommandCost | RemoveBuoy (TileIndex tile, DoCommandFlag flags) |
| Remove a buoy. More... | |
| static bool | IsUniqueWaypointName (const std::string &name) |
| Check whether the name is unique amongst the waypoints. More... | |
| CommandCost | CmdRenameWaypoint (DoCommandFlag flags, StationID waypoint_id, const std::string &text) |
| Rename a waypoint. More... | |
Command Handling for waypoints.
Definition in file waypoint_cmd.cpp.
| 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 BaseStation::train_station.
| 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 4463 of file station_cmd.cpp.
References DC_AUTO, and GetStationType().
Referenced by CheckFlatLandRoadStop(), and IsValidTileForWaypoint().
| CommandCost CmdBuildBuoy | ( | DoCommandFlag | flags, |
| TileIndex | tile | ||
| ) |
Build a buoy.
| flags | operation to perform |
| tile | tile where to place the buoy |
Definition at line 312 of file waypoint_cmd.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_station_pool >::CanAllocateItem(), EXPENSES_CONSTRUCTION, FindDeletedWaypointCloseTo(), HasTileWaterGround(), IsBridgeAbove(), IsTileFlat(), OWNER_NONE, and return_cmd_error.
| CommandCost CmdBuildRailWaypoint | ( | DoCommandFlag | flags, |
| TileIndex | start_tile, | ||
| Axis | axis, | ||
| byte | width, | ||
| byte | height, | ||
| StationClassID | spec_class, | ||
| uint16_t | spec_index, | ||
| StationID | station_to_join, | ||
| bool | adjacent | ||
| ) |
Convert existing rail to waypoint.
Eg build a waypoint station over piece of rail
| flags | type of operation |
| start_tile | northern most tile where waypoint will be built |
| axis | orientation (Axis) |
| width | width of waypoint |
| height | height of waypoint |
| 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 waypoints directly adjacent to other waypoints. |
Definition at line 176 of file waypoint_cmd.cpp.
| CommandCost CmdRenameWaypoint | ( | DoCommandFlag | flags, |
| StationID | waypoint_id, | ||
| const std::string & | text | ||
| ) |
Rename a waypoint.
| flags | type of operation |
| waypoint_id | id of waypoint |
| text | the new name or an empty string when resetting to the default |
Definition at line 421 of file waypoint_cmd.cpp.
References CheckOwnership(), CMD_ERROR, DC_EXEC, CommandCost::Failed(), SpecializedStation< Waypoint, true >::GetIfValid(), IsUniqueWaypointName(), MAX_LENGTH_STATION_NAME_CHARS, BaseStation::name, BaseStation::owner, OWNER_NONE, return_cmd_error, Waypoint::UpdateVirtCoord(), and Utf8StringLength().
Find a deleted waypoint close to a tile.
| tile | to search from |
| str | the string to get the 'type' of |
| cid | previous owner of the waypoint |
Definition at line 73 of file waypoint_cmd.cpp.
References DistanceManhattan(), and SpecializedStation< Waypoint, true >::Iterate().
Referenced by CmdBuildBuoy().
| CommandCost FindJoiningWaypoint | ( | StationID | existing_waypoint, |
| StationID | waypoint_to_join, | ||
| bool | adjacent, | ||
| TileArea | ta, | ||
| Waypoint ** | wp | ||
| ) |
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 |
Definition at line 1221 of file station_cmd.cpp.
Get the axis for a new waypoint.
This means that if it is a valid tile to build a waypoint on it returns a valid Axis, otherwise an invalid one.
| tile | the tile to look at. |
Definition at line 99 of file waypoint_cmd.cpp.
References AXIS_X, AXIS_Y, GetRailStationAxis(), GetRailTileType(), GetTrackBits(), INVALID_AXIS, IsRailWaypointTile(), IsTileType(), MP_RAILWAY, RAIL_TILE_NORMAL, TRACK_BIT_X, and TRACK_BIT_Y.
Referenced by PlaceRail_Waypoint().
| void GetStationLayout | ( | byte * | 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 StationSpec::layouts.
|
static |
Check whether the name is unique amongst the waypoints.
| name | The name to check. |
Definition at line 405 of file waypoint_cmd.cpp.
References SpecializedStation< Waypoint, true >::Iterate().
Referenced by CmdRenameWaypoint().
|
static |
Check whether the given tile is suitable for a waypoint.
| tile | the tile to check for suitability |
| axis | the axis of the waypoint |
| waypoint | Waypoint the waypoint to check for is already joined to. If we find another waypoint it can join to it will throw an error. |
Definition at line 122 of file waypoint_cmd.cpp.
References ClearTile_Station(), DC_AUTO, GetStationIndex(), IsRailWaypoint(), IsTileType(), and MP_STATION.
| CommandCost RemoveBuoy | ( | TileIndex | tile, |
| DoCommandFlag | flags | ||
| ) |
Remove a buoy.
| tile | TileIndex been queried |
| flags | operation to perform |
Definition at line 367 of file waypoint_cmd.cpp.
References _current_company, DC_BANKRUPT, DC_EXEC, EnsureNoVehicleOnGround(), FACIL_DOCK, BaseStation::facilities, CommandCost::Failed(), SpecializedStation< Waypoint, true >::GetByTile(), HasStationInUse(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_STRING_ID, InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), return_cmd_error, and WC_WAYPOINT_VIEW.