Class that handles all rail related functions. More...
#include <script_rail.hpp>
Public Types | |
| enum | ErrorMessages { ERR_RAIL_BASE = ScriptError::ERR_CAT_RAIL << ScriptError::ERR_CAT_BIT_SIZE, ERR_CROSSING_ON_ONEWAY_ROAD, ERR_UNSUITABLE_TRACK, ERR_RAILTYPE_DISALLOWS_CROSSING } |
All rail related error messages. More... | |
| enum | RailType { RAILTYPE_INVALID = ::INVALID_RAILTYPE } |
Types of rail known to the game. More... | |
| enum | RailTrack { RAILTRACK_NE_SW = ::TRACK_BIT_X, RAILTRACK_NW_SE = ::TRACK_BIT_Y, RAILTRACK_NW_NE = ::TRACK_BIT_UPPER, RAILTRACK_SW_SE = ::TRACK_BIT_LOWER, RAILTRACK_NW_SW = ::TRACK_BIT_LEFT, RAILTRACK_NE_SE = ::TRACK_BIT_RIGHT, RAILTRACK_INVALID = ::INVALID_TRACK_BIT } |
A bitmap with all possible rail tracks on a tile. More... | |
| enum | SignalType { SIGNALTYPE_NORMAL = ::SIGTYPE_NORMAL, SIGNALTYPE_ENTRY = ::SIGTYPE_ENTRY, SIGNALTYPE_EXIT = ::SIGTYPE_EXIT, SIGNALTYPE_COMBO = ::SIGTYPE_COMBO, SIGNALTYPE_PBS = ::SIGTYPE_PBS, SIGNALTYPE_PBS_ONEWAY = ::SIGTYPE_PBS_ONEWAY, SIGNALTYPE_TWOWAY = 8, SIGNALTYPE_NORMAL_TWOWAY = SIGNALTYPE_NORMAL | SIGNALTYPE_TWOWAY, SIGNALTYPE_ENTRY_TWOWAY = SIGNALTYPE_ENTRY | SIGNALTYPE_TWOWAY, SIGNALTYPE_EXIT_TWOWAY = SIGNALTYPE_EXIT | SIGNALTYPE_TWOWAY, SIGNALTYPE_COMBO_TWOWAY = SIGNALTYPE_COMBO | SIGNALTYPE_TWOWAY, SIGNALTYPE_NONE = 0xFF } |
Types of signal known to the game. More... | |
| enum | BuildType { BT_TRACK, BT_SIGNAL, BT_DEPOT, BT_STATION, BT_WAYPOINT } |
Types of rail-related objects in the game. More... | |
Static Public Member Functions | |
| static char * | GetName (RailType rail_type) |
| Get the name of a rail type. | |
| static bool | IsRailTile (TileIndex tile) |
| Checks whether the given tile is actually a tile with rail that can be used to traverse a tile. | |
| static bool | IsLevelCrossingTile (TileIndex tile) |
| Checks whether there is a road / rail crossing on a tile. | |
| static bool | IsRailDepotTile (TileIndex tile) |
| Checks whether the given tile is actually a tile with a rail depot. | |
| static bool | IsRailStationTile (TileIndex tile) |
| Checks whether the given tile is actually a tile with a rail station. | |
| static bool | IsRailWaypointTile (TileIndex tile) |
| Checks whether the given tile is actually a tile with a rail waypoint. | |
| static bool | IsRailTypeAvailable (RailType rail_type) |
| Check if a given RailType is available. | |
| static RailType | GetCurrentRailType () |
| Get the current RailType set for all ScriptRail functions. | |
| static void | SetCurrentRailType (RailType rail_type) |
| Set the RailType for all further ScriptRail functions. | |
| static bool | TrainCanRunOnRail (ScriptRail::RailType engine_rail_type, ScriptRail::RailType track_rail_type) |
| Check if a train build for a rail type can run on another rail type. | |
| static bool | TrainHasPowerOnRail (ScriptRail::RailType engine_rail_type, ScriptRail::RailType track_rail_type) |
| Check if a train build for a rail type has power on another rail type. | |
| static RailType | GetRailType (TileIndex tile) |
| Get the RailType that is used on a tile. | |
| static bool | ConvertRailType (TileIndex start_tile, TileIndex end_tile, ScriptRail::RailType convert_to) |
| Convert the tracks on all tiles within a rectangle to another RailType. | |
| static TileIndex | GetRailDepotFrontTile (TileIndex depot) |
| Gets the tile in front of a rail depot. | |
| static RailTrack | GetRailStationDirection (TileIndex tile) |
| Gets the direction of a rail station tile. | |
| static bool | BuildRailDepot (TileIndex tile, TileIndex front) |
| Builds a rail depot. | |
| static bool | BuildRailStation (TileIndex tile, RailTrack direction, uint num_platforms, uint platform_length, StationID station_id) |
| Build a rail station. | |
| static bool | BuildNewGRFRailStation (TileIndex tile, RailTrack direction, uint num_platforms, uint platform_length, StationID station_id, CargoID cargo_id, IndustryType source_industry, IndustryType goal_industry, int distance, bool source_station) |
| Build a NewGRF rail station. | |
| static bool | BuildRailWaypoint (TileIndex tile) |
| Build a rail waypoint. | |
| static bool | RemoveRailWaypointTileRectangle (TileIndex tile, TileIndex tile2, bool keep_rail) |
| Remove all rail waypoint pieces within a rectangle on the map. | |
| static bool | RemoveRailStationTileRectangle (TileIndex tile, TileIndex tile2, bool keep_rail) |
| Remove all rail station platform pieces within a rectangle on the map. | |
| static uint | GetRailTracks (TileIndex tile) |
| Get all RailTracks on the given tile. | |
| static bool | BuildRailTrack (TileIndex tile, RailTrack rail_track) |
| Build rail on the given tile. | |
| static bool | RemoveRailTrack (TileIndex tile, RailTrack rail_track) |
| Remove rail on the given tile. | |
| static bool | AreTilesConnected (TileIndex from, TileIndex tile, TileIndex to) |
| Check if a tile connects two adjacent tiles. | |
| static bool | BuildRail (TileIndex from, TileIndex tile, TileIndex to) |
| Build a rail connection between two tiles. | |
| static bool | RemoveRail (TileIndex from, TileIndex tile, TileIndex to) |
| Remove a rail connection between two tiles. | |
| static SignalType | GetSignalType (TileIndex tile, TileIndex front) |
| Get the SignalType of the signal on a tile or SIGNALTYPE_NONE if there is no signal. | |
| static bool | BuildSignal (TileIndex tile, TileIndex front, SignalType signal) |
| Build a signal on a tile. | |
| static bool | RemoveSignal (TileIndex tile, TileIndex front) |
| Remove a signal. | |
| static Money | GetBuildCost (RailType railtype, BuildType build_type) |
| Get the baseprice of building a rail-related object. | |
| static int32 | GetMaxSpeed (RailType railtype) |
| Get the maximum speed of trains running on this railtype. | |
| static uint16 | GetMaintenanceCostFactor (RailType railtype) |
| Get the maintenance cost factor of a railtype. | |
Class that handles all rail related functions.
ai game
Definition at line 23 of file script_rail.hpp.
Types of rail-related objects in the game.
| BT_TRACK |
Build a track. |
| BT_SIGNAL |
Build a signal. |
| BT_DEPOT |
Build a depot. |
| BT_STATION |
Build a station. |
| BT_WAYPOINT |
Build a rail waypoint. |
Definition at line 88 of file script_rail.hpp.
All rail related error messages.
Definition at line 28 of file script_rail.hpp.
A bitmap with all possible rail tracks on a tile.
Definition at line 53 of file script_rail.hpp.
| enum ScriptRail::RailType |
Types of rail known to the game.
Definition at line 45 of file script_rail.hpp.
Types of signal known to the game.
Definition at line 67 of file script_rail.hpp.
Check if a tile connects two adjacent tiles.
| from | The first tile to connect. | |
| tile | The tile that is checked. | |
| to | The second tile to connect. |
Definition at line 263 of file script_rail.cpp.
References ScriptMap::DistanceManhattan(), GetRailTracks(), IsRailTile(), MapSizeX(), and Swap().
| bool ScriptRail::BuildNewGRFRailStation | ( | TileIndex | tile, | |
| RailTrack | direction, | |||
| uint | num_platforms, | |||
| uint | platform_length, | |||
| StationID | station_id, | |||
| CargoID | cargo_id, | |||
| IndustryType | source_industry, | |||
| IndustryType | goal_industry, | |||
| int | distance, | |||
| bool | source_station | |||
| ) | [static] |
Build a NewGRF rail station.
This calls callback 18 to let a NewGRF provide the station class / id to build, so we don't end up with only the default stations on the map.
| tile | Place to build the station. | |
| direction | The direction to build the station. | |
| num_platforms | The number of platforms to build. | |
| platform_length | The length of each platform. | |
| station_id | The station to join, ScriptStation::STATION_NEW or ScriptStation::STATION_JOIN_ADJACENT. | |
| cargo_id | The CargoID of the cargo that will be transported from / to this station. | |
| source_industry | The IndustryType of the industry you'll transport goods from, ScriptIndustryType::INDUSTRYTYPE_UNKNOWN or ScriptIndustryType::INDUSTRYTYPE_TOWN. | |
| goal_industry | The IndustryType of the industry you'll transport goods to, ScriptIndustryType::INDUSTRYTYPE_UNKNOWN or ScriptIndustryType::INDUSTRYTYPE_TOWN. | |
| distance | The manhattan distance you'll transport the cargo over. | |
| source_station | True if this is the source station, false otherwise. |
Definition at line 168 of file script_rail.cpp.
References AICE_STATION_GET_STATION_ID, CALLBACK_FAILED, StationSpec::cls_id, CMD_BUILD_RAIL_STATION, DEBUG, ScriptObject::DoCommand(), EnforcePrecondition, GetAiPurchaseCallbackResult(), ScriptObject::GetCompany(), GetCurrentRailType(), ScriptIndustryType::INDUSTRYTYPE_TOWN, ScriptIndustryType::INDUSTRYTYPE_UNKNOWN, IsRailTypeAvailable(), ScriptCargo::IsValidCargo(), ScriptIndustryType::IsValidIndustryType(), ScriptStation::IsValidStation(), IsValidTile(), min(), OWNER_DEITY, RAILTRACK_NE_SW, RAILTRACK_NW_SE, ScriptBaseStation::STATION_JOIN_ADJACENT, and ScriptBaseStation::STATION_NEW.
Build a rail connection between two tiles.
| from | The tile just before the tile to build on. | |
| tile | The first tile to build on. | |
| to | The tile just after the last tile to build on. |
| ScriptError::ERR_AREA_NOT_CLEAR | ||
| ScriptError::ERR_LAND_SLOPED_WRONG | ||
| ScriptRail::ERR_CROSSING_ON_ONEWAY_ROAD | ||
| ScriptRoad::ERR_ROAD_WORKS_IN_PROGRESS | ||
| ScriptError::ERR_ALREADY_BUILT |
Definition at line 346 of file script_rail.cpp.
References abs(), CMD_BUILD_RAILROAD_TRACK, DistanceManhattan(), ScriptObject::DoCommand(), EnforcePrecondition, ScriptObject::GetCompany(), GetCurrentRailType(), IsRailTypeAvailable(), IsValidTile(), OWNER_DEITY, SimulateDrag(), TileX(), and TileY().
Builds a rail depot.
| tile | Place to build the depot. | |
| front | The tile exactly in front of the depot. |
Definition at line 138 of file script_rail.cpp.
References CMD_BUILD_TRAIN_DEPOT, ScriptObject::DoCommand(), EnforcePrecondition, ScriptObject::GetCompany(), GetCurrentRailType(), ScriptObject::GetRailType(), IsRailTypeAvailable(), IsValidTile(), OWNER_DEITY, TileX(), and TileY().
| bool ScriptRail::BuildRailStation | ( | TileIndex | tile, | |
| RailTrack | direction, | |||
| uint | num_platforms, | |||
| uint | platform_length, | |||
| StationID | station_id | |||
| ) | [static] |
Build a rail station.
| tile | Place to build the station. | |
| direction | The direction to build the station. | |
| num_platforms | The number of platforms to build. | |
| platform_length | The length of each platform. | |
| station_id | The station to join, ScriptStation::STATION_NEW or ScriptStation::STATION_JOIN_ADJACENT. |
Definition at line 152 of file script_rail.cpp.
References CMD_BUILD_RAIL_STATION, ScriptObject::DoCommand(), EnforcePrecondition, ScriptObject::GetCompany(), GetCurrentRailType(), IsRailTypeAvailable(), ScriptStation::IsValidStation(), IsValidTile(), OWNER_DEITY, RAILTRACK_NE_SW, RAILTRACK_NW_SE, ScriptBaseStation::STATION_JOIN_ADJACENT, and ScriptBaseStation::STATION_NEW.
Build rail on the given tile.
| tile | The tile to build on. | |
| rail_track | The RailTrack to build. |
| ScriptError::ERR_AREA_NOT_CLEAR | ||
| ScriptError::ERR_LAND_SLOPED_WRONG | ||
| ScriptRoad::ERR_ROAD_WORKS_IN_PROGRESS | ||
| ScriptRail::ERR_CROSSING_ON_ONEWAY_ROAD | ||
| ScriptError::ERR_ALREADY_BUILT |
Definition at line 240 of file script_rail.cpp.
References CMD_BUILD_RAILROAD_TRACK, ScriptObject::DoCommand(), EnforcePrecondition, FindFirstTrack(), ScriptObject::GetCompany(), GetCurrentRailType(), IsRailTypeAvailable(), IsValidTile(), KillFirstBit(), OWNER_DEITY, and TRACK_BIT_ALL.
| bool ScriptRail::BuildRailWaypoint | ( | TileIndex | tile | ) | [static] |
Build a rail waypoint.
| tile | Place to build the waypoint. |
| ScriptError::ERR_FLAT_LAND_REQUIRED |
Definition at line 201 of file script_rail.cpp.
References AXIS_X, AXIS_Y, CMD_BUILD_RAIL_WAYPOINT, ScriptObject::DoCommand(), EnforcePrecondition, ScriptObject::GetCompany(), GetCurrentRailType(), GetRailTracks(), IsRailTile(), IsRailTypeAvailable(), IsValidTile(), OWNER_DEITY, RAILTRACK_NE_SW, RAILTRACK_NW_SE, and STAT_CLASS_WAYP.
| bool ScriptRail::BuildSignal | ( | TileIndex | tile, | |
| TileIndex | front, | |||
| SignalType | signal | |||
| ) | [static] |
Build a signal on a tile.
| tile | The tile to build on. | |
| front | The tile in front of the signal. | |
| signal | The SignalType to build. |
| ScriptRail::ERR_UNSUITABLE_TRACK |
Definition at line 438 of file script_rail.cpp.
References CMD_BUILD_SIGNALS, ScriptMap::DistanceManhattan(), ScriptObject::DoCommand(), EnforcePrecondition, ScriptObject::GetCompany(), GetRailTracks(), INVALID_TRACK, IsPlainRailTile(), IsValidSignalType(), NUM_TRACK_DIRECTIONS, OWNER_DEITY, ScriptRailSignalData::signal_cycles, SIGNALTYPE_PBS, SIGNALTYPE_PBS_ONEWAY, SIGNALTYPE_TWOWAY, TileX(), TileY(), ScriptRailSignalData::track, and TrackToTrackBits().
| bool ScriptRail::ConvertRailType | ( | TileIndex | start_tile, | |
| TileIndex | end_tile, | |||
| ScriptRail::RailType | convert_to | |||
| ) | [static] |
Convert the tracks on all tiles within a rectangle to another RailType.
| start_tile | One corner of the rectangle. | |
| end_tile | The opposite corner of the rectangle. | |
| convert_to | The RailType you want to convert the rails to. |
| ScriptRail::ERR_UNSUITABLE_TRACK |
Definition at line 114 of file script_rail.cpp.
References CMD_CONVERT_RAIL, ScriptObject::DoCommand(), EnforcePrecondition, ScriptObject::GetCompany(), IsRailTypeAvailable(), IsValidTile(), and OWNER_DEITY.
Get the baseprice of building a rail-related object.
| railtype | the railtype that is build (on) | |
| build_type | the type of object to build |
Definition at line 487 of file script_rail.cpp.
References BT_DEPOT, BT_SIGNAL, BT_STATION, BT_TRACK, BT_WAYPOINT, GetPrice(), IsRailTypeAvailable(), and RailBuildCost().
| ScriptRail::RailType ScriptRail::GetCurrentRailType | ( | ) | [static] |
Get the current RailType set for all ScriptRail functions.
Definition at line 79 of file script_rail.cpp.
References ScriptObject::GetRailType().
Referenced by ScriptBridge::BuildBridge(), BuildNewGRFRailStation(), BuildRail(), BuildRailDepot(), BuildRailStation(), BuildRailTrack(), BuildRailWaypoint(), ScriptTunnel::BuildTunnel(), RemoveRail(), RemoveRailTrack(), and SimulateDrag().
| uint16 ScriptRail::GetMaintenanceCostFactor | ( | RailType | railtype | ) | [static] |
Get the maintenance cost factor of a railtype.
| railtype | The railtype to get the maintenance factor of. |
Definition at line 508 of file script_rail.cpp.
References GetRailTypeInfo(), IsRailTypeAvailable(), and RailtypeInfo::maintenance_multiplier.
| int32 ScriptRail::GetMaxSpeed | ( | RailType | railtype | ) | [static] |
Get the maximum speed of trains running on this railtype.
| railtype | The railtype to get the maximum speed of. |
Definition at line 501 of file script_rail.cpp.
References GetRailTypeInfo(), IsRailTypeAvailable(), and RailtypeInfo::max_speed.
| char * ScriptRail::GetName | ( | RailType | rail_type | ) | [static] |
Get the name of a rail type.
| rail_type | The rail type to get the name of. |
Definition at line 25 of file script_rail.cpp.
References GetRailTypeInfo(), and IsRailTypeAvailable().
Gets the tile in front of a rail depot.
| depot | The rail depot tile. |
Definition at line 124 of file script_rail.cpp.
References GetRailDepotDirection(), INVALID_TILE, IsRailDepotTile(), and TileOffsByDiagDir().
| ScriptRail::RailTrack ScriptRail::GetRailStationDirection | ( | TileIndex | tile | ) | [static] |
Gets the direction of a rail station tile.
| tile | The rail station tile. |
Definition at line 131 of file script_rail.cpp.
References GetRailStationTrackBits(), and IsRailStationTile().
| uint ScriptRail::GetRailTracks | ( | TileIndex | tile | ) | [static] |
Get all RailTracks on the given tile.
| tile | The tile to check. |
Definition at line 230 of file script_rail.cpp.
References GetCrossingRailBits(), GetRailStationTrack(), GetTrackBits(), IsLevelCrossingTile(), IsRailDepotTile(), IsRailStationTile(), IsRailTile(), IsRailWaypointTile(), and TrackToTrackBits().
Referenced by AreTilesConnected(), BuildRailWaypoint(), BuildSignal(), GetSignalType(), RemoveRailTrack(), and RemoveSignal().
| ScriptRail::RailType ScriptRail::GetRailType | ( | TileIndex | tile | ) | [static] |
Get the RailType that is used on a tile.
| tile | The tile to check. |
Definition at line 107 of file script_rail.cpp.
References ScriptObject::GetRailType(), ScriptTile::HasTransportType(), and ScriptTile::TRANSPORT_RAIL.
| ScriptRail::SignalType ScriptRail::GetSignalType | ( | TileIndex | tile, | |
| TileIndex | front | |||
| ) | [static] |
Get the SignalType of the signal on a tile or SIGNALTYPE_NONE if there is no signal.
| tile | The tile that might have a signal. | |
| front | The tile in front of 'tile'. |
Definition at line 408 of file script_rail.cpp.
References ScriptMap::DistanceManhattan(), GetRailTracks(), HasSignalOnTrack(), HasSignalOnTrackdir(), HasSignals(), IsTileType(), MP_RAILWAY, NUM_TRACK_DIRECTIONS, ReverseTrackdir(), SIGNALTYPE_TWOWAY, TileX(), TileY(), ScriptRailSignalData::track, and TrackToTrackBits().
Referenced by RemoveSignal().
| bool ScriptRail::IsLevelCrossingTile | ( | TileIndex | tile | ) | [static] |
Checks whether there is a road / rail crossing on a tile.
| tile | The tile to check. |
Definition at line 44 of file script_rail.cpp.
References IsValidTile().
Referenced by GetRailTracks(), IsRailTile(), and RemoveRailTrack().
| bool ScriptRail::IsRailDepotTile | ( | TileIndex | tile | ) | [static] |
Checks whether the given tile is actually a tile with a rail depot.
| tile | The tile to check. |
Definition at line 51 of file script_rail.cpp.
References IsValidTile().
Referenced by GetRailDepotFrontTile(), and GetRailTracks().
| bool ScriptRail::IsRailStationTile | ( | TileIndex | tile | ) | [static] |
Checks whether the given tile is actually a tile with a rail station.
| tile | The tile to check. |
Definition at line 58 of file script_rail.cpp.
References IsValidTile().
Referenced by GetRailStationDirection(), and GetRailTracks().
| bool ScriptRail::IsRailTile | ( | TileIndex | tile | ) | [static] |
Checks whether the given tile is actually a tile with rail that can be used to traverse a tile.
This excludes rail depots but includes stations and waypoints.
| tile | The tile to check. |
Definition at line 36 of file script_rail.cpp.
References HasStationTileRail(), IsLevelCrossingTile(), IsRailDepot(), IsStationTileBlocked(), IsTileType(), IsValidTile(), and MP_RAILWAY.
Referenced by AreTilesConnected(), BuildRailWaypoint(), and GetRailTracks().
| bool ScriptRail::IsRailTypeAvailable | ( | RailType | rail_type | ) | [static] |
Check if a given RailType is available.
| rail_type | The RailType to check for. |
Definition at line 72 of file script_rail.cpp.
References ScriptObject::GetCompany(), HasRailtypeAvail(), OWNER_DEITY, RAILTYPE_BEGIN, and RAILTYPE_END.
Referenced by ScriptBridge::BuildBridge(), BuildNewGRFRailStation(), BuildRail(), BuildRailDepot(), BuildRailStation(), BuildRailTrack(), BuildRailWaypoint(), ScriptTunnel::BuildTunnel(), ScriptEngine::CanRunOnRail(), ConvertRailType(), GetBuildCost(), GetMaintenanceCostFactor(), GetMaxSpeed(), GetName(), ScriptEngine::HasPowerOnRail(), RemoveRail(), SetCurrentRailType(), TrainCanRunOnRail(), and TrainHasPowerOnRail().
| bool ScriptRail::IsRailWaypointTile | ( | TileIndex | tile | ) | [static] |
Checks whether the given tile is actually a tile with a rail waypoint.
| tile | The tile to check. |
Definition at line 65 of file script_rail.cpp.
References IsValidTile().
Referenced by GetRailTracks(), and ScriptWaypoint::GetWaypointID().
Remove a rail connection between two tiles.
| from | The tile just before the tile to remove rail from. | |
| tile | The first tile to remove rail from. | |
| to | The tile just after the last tile to remove rail from. |
Definition at line 364 of file script_rail.cpp.
References abs(), CMD_REMOVE_RAILROAD_TRACK, DistanceManhattan(), ScriptObject::DoCommand(), EnforcePrecondition, ScriptObject::GetCompany(), GetCurrentRailType(), ScriptObject::GetRailType(), IsRailTypeAvailable(), IsValidTile(), OWNER_DEITY, SetCurrentRailType(), SimulateDrag(), TileX(), and TileY().
| bool ScriptRail::RemoveRailStationTileRectangle | ( | TileIndex | tile, | |
| TileIndex | tile2, | |||
| bool | keep_rail | |||
| ) | [static] |
Remove all rail station platform pieces within a rectangle on the map.
| tile | One corner of the rectangle to clear. | |
| tile2 | The oppposite corner. | |
| keep_rail | Whether to keep the rail after removal. |
Definition at line 221 of file script_rail.cpp.
References CMD_REMOVE_FROM_RAIL_STATION, ScriptObject::DoCommand(), EnforcePrecondition, ScriptObject::GetCompany(), IsValidTile(), and OWNER_DEITY.
Remove rail on the given tile.
| tile | The tile to remove rail from. | |
| rail_track | The RailTrack to remove. |
Definition at line 252 of file script_rail.cpp.
References CMD_REMOVE_RAILROAD_TRACK, ScriptObject::DoCommand(), EnforcePrecondition, FindFirstTrack(), ScriptObject::GetCompany(), GetCurrentRailType(), GetRailTracks(), IsLevelCrossingTile(), IsPlainRailTile(), IsValidTile(), KillFirstBit(), and OWNER_DEITY.
| bool ScriptRail::RemoveRailWaypointTileRectangle | ( | TileIndex | tile, | |
| TileIndex | tile2, | |||
| bool | keep_rail | |||
| ) | [static] |
Remove all rail waypoint pieces within a rectangle on the map.
| tile | One corner of the rectangle to clear. | |
| tile2 | The oppposite corner. | |
| keep_rail | Whether to keep the rail after removal. |
Definition at line 212 of file script_rail.cpp.
References CMD_REMOVE_FROM_RAIL_WAYPOINT, ScriptObject::DoCommand(), EnforcePrecondition, ScriptObject::GetCompany(), IsValidTile(), and OWNER_DEITY.
Remove a signal.
| tile | The tile to remove the signal from. | |
| front | The tile in front of the signal. |
Definition at line 468 of file script_rail.cpp.
References CMD_REMOVE_SIGNALS, ScriptMap::DistanceManhattan(), ScriptObject::DoCommand(), EnforcePrecondition, ScriptObject::GetCompany(), GetRailTracks(), GetSignalType(), INVALID_TRACK, NUM_TRACK_DIRECTIONS, OWNER_DEITY, SIGNALTYPE_NONE, TileX(), TileY(), ScriptRailSignalData::track, and TrackToTrackBits().
| void ScriptRail::SetCurrentRailType | ( | RailType | rail_type | ) | [static] |
Set the RailType for all further ScriptRail functions.
| rail_type | The RailType to set. |
Definition at line 84 of file script_rail.cpp.
References IsRailTypeAvailable(), and ScriptObject::SetRailType().
Referenced by RemoveRail().
| bool ScriptRail::TrainCanRunOnRail | ( | ScriptRail::RailType | engine_rail_type, | |
| ScriptRail::RailType | track_rail_type | |||
| ) | [static] |
Check if a train build for a rail type can run on another rail type.
| engine_rail_type | The rail type the train is build for. | |
| track_rail_type | The type you want to check. |
Definition at line 91 of file script_rail.cpp.
References IsCompatibleRail(), and IsRailTypeAvailable().
| bool ScriptRail::TrainHasPowerOnRail | ( | ScriptRail::RailType | engine_rail_type, | |
| ScriptRail::RailType | track_rail_type | |||
| ) | [static] |
Check if a train build for a rail type has power on another rail type.
| engine_rail_type | The rail type the train is build for. | |
| track_rail_type | The type you want to check. |
Definition at line 99 of file script_rail.cpp.
References HasPowerOnRail(), and IsRailTypeAvailable().
1.7.1