OpenTTD Source
20241108-master-g80f628063a
|
Implementation of rail specific functions. More...
#include "stdafx.h"
#include "station_map.h"
#include "tunnelbridge_map.h"
#include "timer/timer_game_calendar.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 (Tile 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 buildable railtype available. More... | |
bool | HasAnyRailTypesAvail (const CompanyID company) |
Test if any buildable railtype is available for a company. More... | |
bool | ValParamRailType (const RailType rail) |
Validate functions for rail building. More... | |
RailTypes | AddDateIntroducedRailTypes (RailTypes current, TimerGameCalendar::Date date) |
Add the rail types that are to be introduced at the given date. More... | |
RailTypes | GetCompanyRailTypes (CompanyID company, bool introduces) |
Get the rail types the given company can build. More... | |
RailTypes | GetRailTypes (bool introduces) |
Get list of rail types, regardless of company availability. More... | |
RailType | GetRailTypeByLabel (RailTypeLabel label, bool allow_alternate_labels) |
Get the rail type for a given label. More... | |
Variables | |
const uint8_t | _signal_along_trackdir [TRACKDIR_END] |
const uint8_t | _signal_against_trackdir [TRACKDIR_END] |
const uint8_t | _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 218 of file rail.cpp.
References GetRailTypeInfo(), RailTypeInfo::introduces_railtypes, RailTypeInfo::introduction_date, RailTypeInfo::introduction_required_railtypes, IsInsideMM(), RailTypeInfo::label, TimerGameConst< struct Calendar >::MAX_DATE, RAILTYPE_BEGIN, and RAILTYPE_END.
Referenced by GetCompanyRailTypes(), GetRailTypes(), and NewVehicleAvailable().
Get the rail types the given company can build.
company | the company to get the rail types for. |
introduces | If true, include rail types introduced by other rail types |
Definition at line 251 of file rail.cpp.
References _settings_game, AddDateIntroducedRailTypes(), EngineInfo::climates, TimerGameCalendar::date, TimerGameConst< struct Calendar >::DAYS_IN_YEAR, GameSettings::game_creation, GetRailTypeInfo(), HasBit(), RailTypeInfo::introduces_railtypes, Engine::IterateType(), GameCreationSettings::landscape, RailVehicleInfo::railtype, RAILTYPE_END, RAILTYPES_NONE, RAILVEH_WAGON, SetBit(), and VEH_TRAIN.
Referenced by DisableEngineForCompany(), EnableEngineForCompany(), and GetRailTypeDropDownList().
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 311 of file rail.cpp.
References RailTypeInfo::alternate_labels, GetRailTypeInfo(), INVALID_RAILTYPE, RailTypeInfo::label, RAILTYPE_BEGIN, and RAILTYPE_END.
Referenced by GetRailTypeTranslation().
RailTypes GetRailTypes | ( | bool | introduces | ) |
Get list of rail types, regardless of company availability.
introduces | If true, include rail types introduced by other rail types |
Definition at line 282 of file rail.cpp.
References _settings_game, AddDateIntroducedRailTypes(), EngineInfo::climates, GameSettings::game_creation, GetRailTypeInfo(), HasBit(), RailTypeInfo::introduces_railtypes, Engine::IterateType(), GameCreationSettings::landscape, TimerGameConst< struct Calendar >::MAX_DATE, RailVehicleInfo::railtype, RAILTYPE_END, RAILTYPES_NONE, RAILVEH_WAGON, SetBit(), and VEH_TRAIN.
Referenced by GetRailTypeDropDownList().
bool HasAnyRailTypesAvail | ( | const CompanyID | company | ) |
Test if any buildable railtype is available for a company.
company | the company in question |
Definition at line 196 of file rail.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get().
Referenced by CanBuildVehicleInfrastructure().
Finds out if a company has a certain buildable railtype available.
company | the company in question |
railtype | requested RailType |
Definition at line 186 of file rail.cpp.
References HasBit().
Referenced by ValParamRailType().
bool ValParamRailType | ( | const RailType | rail | ) |
Validate functions for rail building.
rail | the railtype to check. |
Definition at line 206 of file rail.cpp.
References _current_company, HasRailTypeAvail(), and RAILTYPE_END.
Referenced by CmdBuildBridge(), CmdBuildSingleRail(), CmdBuildTrainDepot(), CmdBuildTunnel(), CmdConvertRail(), CmdRailTrackHelper(), BuildRailToolbarWindow::OnInvalidateData(), and ShowBuildRailToolbar().
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |