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;
117 if (c ==
nullptr)
return false;
122 static RoadTypes GetMaskForRoadTramType(RoadTramType rtt)
162 if (rti->
label == 0)
continue;
172 if ((rts & required) != required)
continue;
248 if (rti->
label == label)
return r;
251 if (allow_alternate_labels) {
288 if (e->company_avail != (CompanyMask)-1)
continue;
296 return known_roadtypes;
320 if (!
HasBit(e->company_avail, company))
continue;
static TileType GetTileType(TileIndex tile)
Get the tiletype of a given tile.
Owner
Enum for all companies/owners.
RoadType GetRoadTypeByLabel(RoadTypeLabel label, bool allow_alternate_labels)
Get the road type for a given label.
VehicleSettings vehicle
options for vehicles
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition of stuff that is very close to a company, like the company struct itself.
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
static const int DAYS_IN_YEAR
days per year
byte landscape
the landscape we're currently in
bool CanBuildRoadTypeInfrastructure(RoadType roadtype, CompanyID company)
Check whether we can build infrastructure for the given RoadType.
RoadTypes _roadtypes_type
Bitmap of road/tram types.
Functions related to roads.
RoadBits GetAnyRoadBits(TileIndex tile, RoadTramType rtt, bool straight_tunnel_bridge_entrance)
Returns the RoadBits on an arbitrary tile Special behaviour:
static bool IsWater(TileIndex t)
Is it a plain water tile?
static Titem * Get(size_t index)
Returns Titem with given index.
Functions related to dates.
RoadTypes
The different roadtypes we support, but then a bitmask of them.
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
A tile with road (or tram tracks)
bool HasRoadTypeAvail(const CompanyID company, RoadType roadtype)
Finds out, whether given company has a given RoadType available for construction. ...
A town owns the tile, or a town is expanding.
RoadTypes GetCompanyRoadTypes(CompanyID company, bool introduces)
Get the road types the given company can build.
static TileIndex TileAddByDiagDir(TileIndex tile, DiagDirection dir)
Adds a DiagDir to a tile.
flag for invalid roadtype
Functions related to world/map generation.
RoadType
The different roadtypes we support.
static RoadVehicle * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
RoadType roadtype
Road type.
static bool IsValidTile(TileIndex tile)
Checks if a tile is valid.
static bool IsInsideMM(const T x, const size_t min, const size_t max)
Checks if a value is in an interval.
static const RoadTypeInfo * GetRoadTypeInfo(RoadType roadtype)
Returns a pointer to the Roadtype information for a given roadtype.
static RoadBits DiagDirToRoadBits(DiagDirection d)
Create the road-part which belongs to the given DiagDirection.
bool ValParamRoadType(RoadType roadtype)
Validate functions for rail building.
Information about a vehicle.
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
RoadTypes AddDateIntroducedRoadTypes(RoadTypes current, Date date)
Add the road types that are to be introduced at the given date.
UnitID max_roadveh
max trucks in game per company
ClientSettings _settings_client
The current settings for this game.
Map accessors for water tiles.
Definition of base types and functions in a cross-platform compatible way.
A number of safeguards to prevent using unsafe methods.
RoadBits
Enumeration for the road parts on a tile.
RoadBits CleanUpRoadBits(const TileIndex tile, RoadBits org_rb)
Clean up unnecessary RoadBits of a planned tile.
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.
static RailTileType GetRailTileType(TileIndex t)
Returns the RailTileType (normal with or without signals, waypoint or depot).
RoadTypes ExistingRoadTypes(CompanyID c)
Returns the available RoadSubTypes for the provided RoadType If the given company is valid then will ...
static TrackBits GetTrackBits(TileIndex tile)
Gets the track bits of the given tile.
static Axis DiagDirToAxis(DiagDirection d)
Convert a DiagDirection to the axis.
Slope GetFoundationSlope(TileIndex tile, int *z)
Get slope of a tile on top of a (possible) foundation If a tile does not have a foundation, the function returns the same as GetTileSlope.
Functions related to companies.
static bool HasPowerOnRoad(RoadType enginetype, RoadType tiletype)
Checks if an engine of the given RoadType got power on a tile with a given RoadType.
bool _generating_world
Whether we are generating the map or not.
static bool IsNormalRoadTile(TileIndex t)
Return whether a tile is a normal road tile.
Information about a road vehicle.
GUISettings gui
settings related to the GUI
Tunnel entry/exit and bridge heads.
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
static RoadBits MirrorRoadBits(RoadBits r)
Calculate the mirrored RoadBits.
uint32 TileIndex
The index/ID of a Tile.
Date introduction_date
Introduction date.
RoadTypes avail_roadtypes
Road types available to this company.
Normal rail tile without signals.
#define MAX_DAY
The number of days till the last day.
Functions related to OTTD's landscape.
CompanyID _current_company
Company currently doing an action.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
int32 Date
The type to store our dates in.
bool disable_unsuitable_building
disable infrastructure building when no suitable vehicles are available
RoadTypes introduction_required_roadtypes
Bitmask of roadtypes that are required for this roadtype to be introduced at a given introduction_dat...
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
DiagDirection
Enumeration for diagonal directions.
GameCreationSettings game_creation
settings used during the creation of a game (map)
A tile without any structures, i.e. grass, rocks, farm fields etc.
RoadTypes introduces_roadtypes
Bitmask of which other roadtypes are introduced when this roadtype is introduced. ...
RoadTypeLabelList alternate_labels
Road type labels this type provides in addition to the main label.
RoadTypes GetRoadTypes(bool introduces)
Get list of road types, regardless of company availability.
byte climates
Climates supported by the engine.
Date _date
Current date in days (day counter)
The object is owned by a superuser / goal script.
Hides the direct accesses to the map array with map accessors.
Axis
Allow incrementing of DiagDirDiff variables.
RoadTypeLabel label
Unique 32 bit road type identifier.
static Pool::IterateWrapper< Engine > IterateType(VehicleType vt, size_t from=0)
Returns an iterable ensemble of all valid engines of the given type.