57 if (org_rb & target_rb) {
58 bool connective =
false;
79 connective = (neighbor_rb & mirrored_rb) !=
ROAD_NONE;
89 connective = !
IsWater(neighbor_tile);
98 if (!connective) org_rb ^= target_rb;
115 if (rti->
label == 0)
return false;
128 if (c ==
nullptr)
return false;
133static RoadTypes GetMaskForRoadTramType(RoadTramType rtt)
173 if (rti->
label == 0)
continue;
183 if ((rts & required) != required)
continue;
261 if (rti->
label == label)
return r;
264 if (allow_alternate_labels) {
debug_inline constexpr bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
constexpr T SetBit(T &x, const uint8_t y)
Set a bit in a variable.
RoadTypeLabel label
Unique 32 bit road type identifier.
RoadTypeLabelList alternate_labels
Road type labels this type provides in addition to the main label.
RoadTypes introduces_roadtypes
Bitmask of which other roadtypes are introduced when this roadtype is introduced.
TimerGameCalendar::Date introduction_date
Introduction date.
RoadTypeFlags flags
Bit mask of road type flags.
RoadTypes introduction_required_roadtypes
Bitmask of roadtypes that are required for this roadtype to be introduced at a given introduction_dat...
static Date date
Current date in days (day counter).
static constexpr TimerGame< struct Calendar >::Date MAX_DATE
The date of the last day of the max year.
static constexpr int DAYS_IN_YEAR
days per year
Definition of stuff that is very close to a company, like the company struct itself.
CompanyID _current_company
Company currently doing an action.
Functions related to companies.
Owner
Enum for all companies/owners.
@ OWNER_DEITY
The object is owned by a superuser / goal script.
@ OWNER_TOWN
A town owns the tile, or a town is expanding.
Axis DiagDirToAxis(DiagDirection d)
Convert a DiagDirection to the axis.
Axis
Allow incrementing of DiagDirDiff variables.
DiagDirection
Enumeration for diagonal directions.
@ DIAGDIR_END
Used for iterations.
@ DIAGDIR_BEGIN
Used for iterations.
bool _generating_world
Whether we are generating the map or not.
Functions related to world/map generation.
std::tuple< Slope, int > GetFoundationSlope(TileIndex tile)
Get slope of a tile on top of a (possible) foundation If a tile does not have a foundation,...
Functions related to OTTD's landscape.
TileIndex TileAddByDiagDir(TileIndex tile, DiagDirection dir)
Adds a DiagDir to a tile.
constexpr bool IsInsideMM(const T x, const size_t min, const size_t max) noexcept
Checks if a value is in an interval.
Hides the direct accesses to the map array with map accessors.
static debug_inline RailTileType GetRailTileType(Tile t)
Returns the RailTileType (normal with or without signals, waypoint or depot).
TrackBits GetTrackBits(Tile tile)
Gets the track bits of the given tile.
@ RAIL_TILE_NORMAL
Normal rail tile without signals.
RoadBits CleanUpRoadBits(const TileIndex tile, RoadBits org_rb)
Clean up unnecessary RoadBits of a planned tile.
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.
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.
bool HasAnyRoadTypesAvail(CompanyID company, RoadTramType rtt)
Test if any buildable RoadType is available for a company.
static bool IsPossibleCrossing(const TileIndex tile, Axis ax)
Return if the tile is a valid tile for a crossing.
bool HasRoadTypeAvail(const CompanyID company, RoadType roadtype)
Finds out, whether given company has a given RoadType available for construction.
RoadType GetRoadTypeByLabel(RoadTypeLabel label, bool allow_alternate_labels)
Get the road type for a given label.
RoadTypes _roadtypes_type
Bitmap of road/tram types.
@ ROTFB_HIDDEN
Value for hidden from construction.
@ ROTFB_TOWN_BUILD
Value for allowing towns to build this roadtype.
const RoadTypeInfo * GetRoadTypeInfo(RoadType roadtype)
Returns a pointer to the Roadtype information for a given roadtype.
Functions related to roads.
RoadBits MirrorRoadBits(RoadBits r)
Calculate the mirrored RoadBits.
RoadBits DiagDirToRoadBits(DiagDirection d)
Create the road-part which belongs to the given DiagDirection.
RoadBits GetAnyRoadBits(Tile tile, RoadTramType rtt, bool straight_tunnel_bridge_entrance)
Returns the RoadBits on an arbitrary tile Special behaviour:
static debug_inline bool IsNormalRoadTile(Tile t)
Return whether a tile is a normal road tile.
RoadBits
Enumeration for the road parts on a tile.
@ ROAD_NONE
No road-part is build.
RoadTypes
The different roadtypes we support, but then a bitmask of them.
@ ROADTYPES_NONE
No roadtypes.
RoadType
The different roadtypes we support.
@ INVALID_ROADTYPE
flag for invalid roadtype
@ ROADTYPE_END
Used for iterations.
@ ROADTYPE_BEGIN
Used for iterations.
A number of safeguards to prevent using unsafe methods.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition of base types and functions in a cross-platform compatible way.
RoadTypes avail_roadtypes
Road types available to this company.
Information about a vehicle.
uint8_t climates
Climates supported by the engine.
static Pool::IterateWrapperFiltered< Engine, EngineTypeFilter > IterateType(VehicleType vt, size_t from=0)
Returns an iterable ensemble of all valid engines of the given type.
uint8_t landscape
the landscape we're currently in
GameCreationSettings game_creation
settings used during the creation of a game (map)
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
static Titem * Get(size_t index)
Returns Titem with given index.
Information about a road vehicle.
RoadType roadtype
Road type.
static debug_inline TileType GetTileType(Tile tile)
Get the tiletype of a given tile.
bool IsValidTile(Tile tile)
Checks if a tile is valid.
static debug_inline bool IsTileType(Tile tile, TileType type)
Checks if a tile is a given tiletype.
@ MP_TREES
Tile got trees.
@ MP_ROAD
A tile with road (or tram tracks)
@ MP_STATION
A tile of a station.
@ MP_TUNNELBRIDGE
Tunnel entry/exit and bridge heads.
@ MP_CLEAR
A tile without any structures, i.e. grass, rocks, farm fields etc.
Definition of the game-calendar-timer.
@ TRACK_BIT_Y
Y-axis track.
@ TRACK_BIT_X
X-axis track.
@ VEH_ROAD
Road vehicle type.
Map accessors for water tiles.
bool IsWater(Tile t)
Is it a plain water tile?