|
OpenTTD Source 20251116-master-g21329071df
|
Generic road related functions. More...
#include "stdafx.h"#include "rail_map.h"#include "road_map.h"#include "water_map.h"#include "genworld.h"#include "company_func.h"#include "company_base.h"#include "engine_base.h"#include "timer/timer_game_calendar.h"#include "landscape.h"#include "road.h"#include "road_func.h"#include "roadveh.h"#include "safeguards.h"Go to the source code of this file.
Functions | |
| static bool | IsPossibleCrossing (const TileIndex tile, Axis ax) |
| Return if the tile is a valid tile for a crossing. | |
| RoadBits | CleanUpRoadBits (const TileIndex tile, RoadBits org_rb) |
| Clean up unnecessary RoadBits of a planned tile. | |
| bool | HasRoadTypeAvail (const CompanyID company, RoadType roadtype) |
| Finds out, whether given company has a given RoadType available for construction. | |
| bool | HasAnyRoadTypesAvail (CompanyID company, RoadTramType rtt) |
| Test if any buildable RoadType is available for a company. | |
| bool | ValParamRoadType (RoadType roadtype) |
| Validate functions for rail building. | |
| RoadTypes | AddDateIntroducedRoadTypes (RoadTypes current, TimerGameCalendar::Date date) |
| Add the road types that are to be introduced at the given date. | |
| RoadTypes | GetCompanyRoadTypes (CompanyID company, bool introduces) |
| Get the road types the given company can build. | |
| RoadTypes | GetRoadTypes (bool introduces) |
| Get list of road types, regardless of company availability. | |
| RoadType | GetRoadTypeByLabel (RoadTypeLabel label, bool allow_alternate_labels) |
| Get the road type for a given label. | |
Generic road related functions.
Definition in file road.cpp.
| RoadTypes AddDateIntroducedRoadTypes | ( | RoadTypes | current, |
| TimerGameCalendar::Date | date | ||
| ) |
Add the road types that are to be introduced at the given date.
| rt | Roadtype |
| current | The currently available roadtypes. |
| date | The date for the introduction comparisons. |
Definition at line 177 of file road.cpp.
References AddDateIntroducedRoadTypes(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::All(), GetRoadTypeInfo(), RoadTypeInfo::introduces_roadtypes, RoadTypeInfo::introduction_date, RoadTypeInfo::introduction_required_roadtypes, IsInsideMM(), RoadTypeInfo::label, TimerGameConst< struct Calendar >::MAX_DATE, ROADTYPE_BEGIN, ROADTYPE_END, and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Set().
Referenced by AddDateIntroducedRoadTypes(), GetCompanyRoadTypes(), GetRoadTypes(), and NewVehicleAvailable().
Clean up unnecessary RoadBits of a planned tile.
| tile | current tile |
| org_rb | planned RoadBits |
Definition at line 59 of file road.cpp.
References DIAGDIR_BEGIN, DIAGDIR_END, DiagDirToAxis(), DiagDirToRoadBits(), GetAnyRoadBits(), GetTileType(), IsNormalRoadTile(), IsPossibleCrossing(), IsValidTile(), IsWater(), MirrorRoadBits(), MP_CLEAR, MP_RAILWAY, MP_ROAD, MP_STATION, MP_TREES, MP_TUNNELBRIDGE, MP_WATER, ROAD_NONE, RTT_ROAD, RTT_TRAM, and TileAddByDiagDir().
Referenced by GrowTownInTile().
Get the road types the given company can build.
| company | the company to get the road types for. |
| introduces | If true, include road types introduced by other road types |
Definition at line 210 of file road.cpp.
References _settings_game, AddDateIntroducedRoadTypes(), EngineInfo::climates, TimerGameCalendar::date, TimerGameConst< struct Calendar >::DAYS_IN_YEAR, GameSettings::game_creation, GetRoadTypeInfo(), RoadTypeInfo::introduces_roadtypes, Engine::IterateType(), GameCreationSettings::landscape, RoadVehicleInfo::roadtype, ROADTYPE_END, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and VEH_ROAD.
Referenced by AfterLoadGame(), DisableEngineForCompany(), DoStartupNewCompany(), EnableEngineForCompany(), and StartupEngines().
| RoadType GetRoadTypeByLabel | ( | RoadTypeLabel | label, |
| bool | allow_alternate_labels | ||
| ) |
Get the road type for a given label.
| label | the roadtype label. |
| allow_alternate_labels | Search in the alternate label lists as well. |
Definition at line 265 of file road.cpp.
References RoadTypeInfo::alternate_labels, FlatSet< Tkey, Tcompare >::contains(), INVALID_ROADTYPE, RoadTypeInfo::label, and ROADTYPE_END.
Referenced by AfterLoadGRFs(), ConvertRoadTypes(), RoadTypeResolverObject::GetFeature(), GetRoadTypeTranslation(), and RoadTypeChangeInfo().
| RoadTypes GetRoadTypes | ( | bool | introduces | ) |
Get list of road types, regardless of company availability.
| introduces | If true, include road types introduced by other road types |
Definition at line 238 of file road.cpp.
References _settings_game, AddDateIntroducedRoadTypes(), EngineInfo::climates, GameSettings::game_creation, GetRoadTypeInfo(), RoadTypeInfo::introduces_roadtypes, Engine::IterateType(), GameCreationSettings::landscape, TimerGameConst< struct Calendar >::MAX_DATE, RoadVehicleInfo::roadtype, ROADTYPE_END, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and VEH_ROAD.
Referenced by ScenarioEditorToolbarWindow::OnPaint(), and BuildRoadToolbarWindow::RoadTramToolbarGlobalHotkeys().
| bool HasAnyRoadTypesAvail | ( | CompanyID | company, |
| RoadTramType | rtt | ||
| ) |
Test if any buildable RoadType is available for a company.
| company | the company in question |
Definition at line 152 of file road.cpp.
References _roadtypes_hidden_mask, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Any(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::Get(), GetMaskForRoadTramType(), and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Reset().
Referenced by CanBuildVehicleInfrastructure().
Finds out, whether given company has a given RoadType available for construction.
| company | ID of company |
| roadtypet | RoadType to test |
Definition at line 123 of file road.cpp.
References _generating_world, _roadtypes_hidden_mask, Company::avail_roadtypes, TimerGameCalendar::date, RoadTypeInfo::flags, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::GetIfValid(), GetRoadTypeInfo(), Hidden, RoadTypeInfo::introduction_date, IsInsideMM(), RoadTypeInfo::label, TimerGameConst< struct Calendar >::MAX_DATE, OWNER_DEITY, OWNER_TOWN, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Reset(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and TownBuild.
Referenced by ValParamRoadType().
Return if the tile is a valid tile for a crossing.
| tile | the current tile |
| ax | the axis of the road over the rail |
Definition at line 45 of file road.cpp.
References AXIS_X, GetFoundationSlope(), GetRailTileType(), GetTrackBits(), IsTileType(), MP_RAILWAY, RAIL_TILE_NORMAL, SLOPE_FLAT, TRACK_BIT_X, and TRACK_BIT_Y.
Referenced by CleanUpRoadBits().
| bool ValParamRoadType | ( | RoadType | roadtype | ) |
Validate functions for rail building.
| roadtype | road type to check. |
Definition at line 164 of file road.cpp.
References _current_company, HasRoadTypeAvail(), and ROADTYPE_END.
Referenced by CmdBuildBridge(), CmdBuildLongRoad(), CmdBuildRoad(), CmdBuildRoadDepot(), CmdBuildRoadStop(), CmdBuildTunnel(), CmdConvertRoad(), CmdRemoveLongRoad(), BuildRoadToolbarWindow::OnInvalidateData(), and ShowBuildRoadToolbar().