|
OpenTTD
|
Implementation of rail specific functions. More...
#include "stdafx.h"#include "station_map.h"#include "tunnelbridge_map.h"#include "date_func.h"#include "company_func.h"#include "company_base.h"#include "engine_base.h"#include "safeguards.h"Go to the source code of this file.
Functions | |
| RailType | GetTileRailType (TileIndex tile) |
| Return the rail type of tile, or INVALID_RAILTYPE if this is no rail tile. | |
| bool | HasRailtypeAvail (const CompanyID company, const RailType railtype) |
| Finds out if a company has a certain railtype available. | |
| bool | ValParamRailtype (const RailType rail) |
| Validate functions for rail building. | |
| RailType | GetBestRailtype (const CompanyID company) |
| Returns the "best" railtype a company can build. | |
| RailTypes | AddDateIntroducedRailTypes (RailTypes current, Date date) |
| Add the rail types that are to be introduced at the given date. | |
| RailTypes | GetCompanyRailtypes (CompanyID company) |
| Get the rail types the given company can build. | |
| RailType | GetRailTypeByLabel (RailTypeLabel label, bool allow_alternate_labels) |
| Get the rail type for a given label. | |
Variables | |
| const byte | _signal_along_trackdir [TRACKDIR_END] |
| const byte | _signal_against_trackdir [TRACKDIR_END] |
| const byte | _signal_on_track [] |
| const TrackdirBits | _exitdir_reaches_trackdirs [] |
| const Trackdir | _next_trackdir [TRACKDIR_END] |
| const TrackdirBits | _track_crosses_trackdirs [TRACK_END] |
| const TrackBits | _track_crosses_tracks [] |
| const DiagDirection | _trackdir_to_exitdir [TRACKDIR_END] |
| const Trackdir | _track_exitdir_to_trackdir [][DIAGDIR_END] |
| const Trackdir | _track_enterdir_to_trackdir [][DIAGDIR_END] |
| const Trackdir | _track_direction_to_trackdir [][DIR_END] |
| const Trackdir | _dir_to_diag_trackdir [] |
| const TrackBits | _corner_to_trackbits [] |
| const TrackdirBits | _uphill_trackdirs [] |
Implementation of rail specific functions.
Definition in file rail.cpp.
Add the rail types that are to be introduced at the given date.
| current | The currently available railtypes. |
| date | The date for the introduction comparisons. |
Definition at line 225 of file rail.cpp.
References AddDateIntroducedRailTypes(), GetRailTypeInfo(), RailtypeInfo::introduces_railtypes, RailtypeInfo::introduction_date, RailtypeInfo::introduction_required_railtypes, IsInsideMM(), RailtypeInfo::label, MAX_DAY, RAILTYPE_BEGIN, and RAILTYPE_END.
Referenced by AcceptEnginePreview(), AddDateIntroducedRailTypes(), EnginesDailyLoop(), GetCompanyRailtypes(), GetRailTypeDropDownList(), and NewVehicleAvailable().
Returns the "best" railtype a company can build.
As the AI doesn't know what the BEST one is, we have our own priority list here. When adding new railtypes, modify this function
| company | the company "in action" |
Definition at line 210 of file rail.cpp.
References HasRailtypeAvail(), RAILTYPE_ELECTRIC, RAILTYPE_MAGLEV, RAILTYPE_MONO, and RAILTYPE_RAIL.
Referenced by SetDefaultRailGui().
Get the rail types the given company can build.
| c | the company to get the rail types for. |
Definition at line 257 of file rail.cpp.
References _date, _settings_game, AddDateIntroducedRailTypes(), EngineInfo::climates, Engine::company_avail, DAYS_IN_YEAR, GameSettings::game_creation, GetRailTypeInfo(), HasBit(), Engine::intro_date, RailtypeInfo::introduces_railtypes, GameCreationSettings::landscape, RAILTYPE_END, RAILTYPES_NONE, RAILVEH_WAGON, and VEH_TRAIN.
Referenced by AfterLoadGame(), DoStartupNewCompany(), SettingsDisableElrail(), and StartupEngines().
| RailType GetRailTypeByLabel | ( | RailTypeLabel | label, |
| bool | allow_alternate_labels | ||
| ) |
Get the rail type for a given label.
| label | the railtype label. |
| allow_alternate_labels | Search in the alternate label lists as well. |
Definition at line 285 of file rail.cpp.
References RailtypeInfo::alternate_labels, SmallVector< T, S >::Contains(), GetRailTypeInfo(), INVALID_RAILTYPE, RailtypeInfo::label, RAILTYPE_BEGIN, and RAILTYPE_END.
Referenced by AfterLoadGRFs(), and RailTypeChangeInfo().
Finds out if a company has a certain railtype available.
| company | the company in question |
| railtype | requested RailType |
Definition at line 188 of file rail.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), and HasBit().
Referenced by GetBestRailtype(), SetDefaultRailGui(), and ValParamRailtype().
| bool ValParamRailtype | ( | const RailType | rail | ) |
Validate functions for rail building.
| rail | the railtype to check. |
Definition at line 198 of file rail.cpp.
References _current_company, HasRailtypeAvail(), and RAILTYPE_END.
Referenced by CmdBuildBridge(), CmdBuildRailStation(), CmdBuildSingleRail(), CmdBuildTrainDepot(), CmdBuildTunnel(), CmdConvertRail(), CmdRailTrackHelper(), and ShowBuildRailToolbar().
| const TrackBits _corner_to_trackbits[] |
| const Trackdir _dir_to_diag_trackdir[] |
| const TrackdirBits _exitdir_reaches_trackdirs[] |
| const Trackdir _next_trackdir[TRACKDIR_END] |
| const byte _signal_against_trackdir[TRACKDIR_END] |
| const byte _signal_along_trackdir[TRACKDIR_END] |
| const byte _signal_on_track[] |
| const TrackdirBits _track_crosses_trackdirs[TRACK_END] |
| const TrackBits _track_crosses_tracks[] |
| const Trackdir _track_enterdir_to_trackdir[][DIAGDIR_END] |
| const Trackdir _track_exitdir_to_trackdir[][DIAGDIR_END] |
| const DiagDirection _trackdir_to_exitdir[TRACKDIR_END] |
1.8.1.2