#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 "strings_func.h"
#include "functions.h"
#include "window_func.h"
#include "date_func.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 "table/strings.h"
Go to the source code of this file.
Functions | |
| static void | MakeDefaultWaypointName (Waypoint *wp) |
| Set the default name for a waypoint. | |
| static Waypoint * | FindDeletedWaypointCloseTo (TileIndex tile, StringID str) |
| Find a deleted waypoint close to a tile. | |
| Axis | GetAxisForNewWaypoint (TileIndex tile) |
| Get the axis for a new waypoint. | |
| CommandCost | ClearTile_Station (TileIndex tile, DoCommandFlag flags) |
| static CommandCost | IsValidTileForWaypoint (TileIndex tile, Axis axis, StationID *waypoint) |
| Check whether the given tile is suitable for a waypoint. | |
| void | GetStationLayout (byte *layout, int numtracks, int plat_len, const StationSpec *statspec) |
| CommandCost | FindJoiningWaypoint (StationID existing_station, StationID station_to_join, bool adjacent, TileArea ta, Waypoint **wp) |
| Find a nearby waypoint that joins this waypoint. | |
| bool | CanExpandRailStation (const BaseStation *st, TileArea &new_ta, Axis axis) |
| Check whether we can expand the rail part of the given station. | |
| CommandCost | CmdBuildRailWaypoint (TileIndex start_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
| Convert existing rail to waypoint. | |
| CommandCost | CmdBuildBuoy (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
| Build a buoy. | |
| CommandCost | RemoveBuoy (TileIndex tile, DoCommandFlag flags) |
| Remove a buoy. | |
| static bool | IsUniqueWaypointName (const char *name) |
| CommandCost | CmdRenameWaypoint (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
| Rename a waypoint. | |
Definition in file waypoint_cmd.cpp.
| bool CanExpandRailStation | ( | const BaseStation * | st, | |
| TileArea & | new_ta, | |||
| Axis | axis | |||
| ) |
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 | |
| axis | the axis of the newly build rail |
Definition at line 758 of file station_cmd.cpp.
References _settings_game, TileArea::h, max(), min(), StationSettings::nonuniform_stations, GameSettings::station, StationSettings::station_spread, TileArea::tile, TILE_LOOP, BaseStation::TileBelongsToRailStation(), TileDiffXY(), TileX(), TileXY(), TileY(), BaseStation::train_station, and TileArea::w.
Referenced by CmdBuildRailStation(), and CmdBuildRailWaypoint().
| CommandCost CmdBuildBuoy | ( | TileIndex | tile, | |
| DoCommandFlag | flags, | |||
| uint32 | p1, | |||
| uint32 | p2, | |||
| const char * | text | |||
| ) |
Build a buoy.
| tile | tile where to place the bouy | |
| flags | operation to perform | |
| p1 | unused | |
| p2 | unused | |
| text | unused |
Definition at line 333 of file waypoint_cmd.cpp.
References _date, DC_EXEC, FACIL_DOCK, FindDeletedWaypointCloseTo(), GetTileSlope(), InvalidateWindowData(), IsBridgeAbove(), MakeDefaultWaypointName(), MayHaveBridgeAbove(), OWNER_NONE, return_cmd_error, and SLOPE_FLAT.
| CommandCost CmdBuildRailWaypoint | ( | TileIndex | start_tile, | |
| DoCommandFlag | flags, | |||
| uint32 | p1, | |||
| uint32 | p2, | |||
| const char * | text | |||
| ) |
Convert existing rail to waypoint.
Eg build a waypoint station over piece of rail
| start_tile | northern most tile where waypoint will be built | |
| flags | type of operation | |
| p1 | various bitstuffed elements
| |
| p2 | various bitstuffed elements
| |
| text | unused |
Definition at line 213 of file waypoint_cmd.cpp.
References _date, _settings_game, AllocaM, AllocateSpecToStation(), AXIS_X, AxisToDiagDir(), AxisToTrack(), CanExpandRailStation(), CMD_ERROR, DC_EXEC, DeallocateSpecFromStation(), StationSettings::distant_join_stations, FACIL_TRAIN, CommandCost::Failed(), FindDeletedWaypointCloseTo(), FindJoiningWaypoint(), GB(), GetCustomStationSpec(), GetNumCustomStations(), GetRailReservationTrackBits(), GetRailType(), GetTileOwner(), HasBit(), HasStationReservation(), INVALID_TILE, IsTileType(), IsValidTileForWaypoint(), MakeDefaultWaypointName(), MarkTileDirtyByTile(), MP_RAILWAY, MP_STATION, StationSettings::nonuniform_stations, OtherAxis(), return_cmd_error, SetRailStationReservation(), STAT_CLASS_WAYP, GameSettings::station, StationSettings::station_spread, TileOffsByDiagDir(), and YapfNotifyTrackLayoutChange().
| CommandCost CmdRenameWaypoint | ( | TileIndex | tile, | |
| DoCommandFlag | flags, | |||
| uint32 | p1, | |||
| uint32 | p2, | |||
| const char * | text | |||
| ) |
Rename a waypoint.
| tile | unused | |
| flags | type of operation | |
| p1 | id of waypoint | |
| p2 | unused | |
| text | the new name or an empty string when resetting to the default |
Definition at line 431 of file waypoint_cmd.cpp.
References CMD_ERROR, DC_EXEC, MakeDefaultWaypointName(), MAX_LENGTH_STATION_NAME_BYTES, OWNER_NONE, return_cmd_error, and StrEmpty().
Find a deleted waypoint close to a tile.
| tile | to search from | |
| str | the string to get the 'type' of |
Definition at line 110 of file waypoint_cmd.cpp.
References DistanceManhattan(), and OWNER_NONE.
Referenced by CmdBuildBuoy(), and CmdBuildRailWaypoint().
| 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 927 of file station_cmd.cpp.
Referenced by CmdBuildRailWaypoint().
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 136 of file waypoint_cmd.cpp.
References AXIS_X, AXIS_Y, GetRailTileType(), GetTrackBits(), INVALID_AXIS, IsRailWaypointTile(), IsTileType(), MP_RAILWAY, RAIL_TILE_NORMAL, TRACK_BIT_X, and TRACK_BIT_Y.
Referenced by IsValidTileForWaypoint().
| static CommandCost IsValidTileForWaypoint | ( | TileIndex | tile, | |
| Axis | axis, | |||
| StationID * | waypoint | |||
| ) | [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 159 of file waypoint_cmd.cpp.
References _settings_game, ConstructionSettings::build_on_slopes, CMD_ERROR, GameSettings::construction, DC_AUTO, GetAxisForNewWaypoint(), GetStationIndex(), GetTileOwner(), GetTileSlope(), IsBridgeAbove(), IsRailWaypoint(), IsSteepSlope(), IsTileType(), MayHaveBridgeAbove(), MP_STATION, return_cmd_error, and SLOPE_FLAT.
Referenced by CmdBuildRailWaypoint().
| static void MakeDefaultWaypointName | ( | Waypoint * | wp | ) | [static] |
Set the default name for a waypoint.
| wp | Waypoint to work on |
Definition at line 49 of file waypoint_cmd.cpp.
References HasBit(), and SetBit().
Referenced by CmdBuildBuoy(), CmdBuildRailWaypoint(), and CmdRenameWaypoint().
| CommandCost RemoveBuoy | ( | TileIndex | tile, | |
| DoCommandFlag | flags | |||
| ) |
Remove a buoy.
| tile | TileIndex been queried | |
| flags | operation to perform |
Definition at line 379 of file waypoint_cmd.cpp.
References CMD_ERROR, DC_BANKRUPT, DC_EXEC, FACIL_DOCK, GetTileOwner(), HasStationInUse(), INVALID_COMPANY, INVALID_STRING_ID, InvalidateWindowData(), MarkTileDirtyByTile(), and return_cmd_error.
1.5.6