#include "core/bitmath_func.hpp"
#include "road_type.h"
#include "direction_func.h"
#include "company_type.h"
Go to the source code of this file.
Functions | |
static bool | IsValidRoadType (RoadType rt) |
Whether the given roadtype is valid. | |
static bool | AreValidRoadTypes (RoadTypes rts) |
Are the given bits pointing to valid roadtypes? | |
static RoadTypes | RoadTypeToRoadTypes (RoadType rt) |
Maps a RoadType to the corresponding RoadTypes value. | |
static RoadTypes | ComplementRoadTypes (RoadTypes r) |
Returns the RoadTypes which are not present in the given RoadTypes. | |
static RoadBits | ComplementRoadBits (RoadBits r) |
Calculate the complement of a RoadBits value. | |
static RoadBits | MirrorRoadBits (RoadBits r) |
Calculate the mirrored RoadBits. | |
static RoadBits | RotateRoadBits (RoadBits r, DiagDirDiff rot) |
Calculate rotated RoadBits. | |
static bool | IsStraightRoad (RoadBits r) |
Check if we've got a straight road. | |
static RoadBits | DiagDirToRoadBits (DiagDirection d) |
Create the road-part which belongs to the given DiagDirection. | |
static RoadBits | AxisToRoadBits (Axis a) |
Create the road-part which belongs to the given Axis. | |
bool | HasRoadTypesAvail (const CompanyID company, const RoadTypes rts) |
Finds out, whether given company has all given RoadTypes available. | |
bool | ValParamRoadType (const RoadType rt) |
Validate functions for rail building. | |
RoadTypes | GetCompanyRoadtypes (const CompanyID company) |
Get the road types the given company can build. | |
void | UpdateLevelCrossing (TileIndex tile, bool sound=true) |
Sets correct crossing state. |
Definition in file road_func.h.
static bool AreValidRoadTypes | ( | RoadTypes | rts | ) | [inline, static] |
Are the given bits pointing to valid roadtypes?
rts | the roadtypes to check for validness |
Definition at line 28 of file road_func.h.
References HasBit(), ROADTYPE_ROAD, and ROADTYPE_TRAM.
Referenced by CmdBuildBridge(), CmdBuildRoadStop(), and CmdBuildTunnel().
Create the road-part which belongs to the given Axis.
This function returns a RoadBits value which belongs to the given Axis.
a | The Axis |
Definition at line 137 of file road_func.h.
References AXIS_X, ROAD_X, and ROAD_Y.
Referenced by CmdBuildRoad(), GetAnyRoadBits(), and RoadFindPathToDest().
Calculate the complement of a RoadBits value.
Simply flips all bits in the RoadBits value to get the complement of the RoadBits.
r | The given RoadBits value |
Definition at line 68 of file road_func.h.
References ROAD_ALL.
Referenced by CmdBuildRoad(), and RemoveRoad().
Returns the RoadTypes which are not present in the given RoadTypes.
This function returns the complement of a given RoadTypes.
r | The given RoadTypes |
Definition at line 53 of file road_func.h.
References ROADTYPES_ALL.
Referenced by RemoveRoad().
static RoadBits DiagDirToRoadBits | ( | DiagDirection | d | ) | [inline, static] |
Create the road-part which belongs to the given DiagDirection.
This function returns a RoadBits value which belongs to the given DiagDirection.
d | The DiagDirection |
Definition at line 123 of file road_func.h.
References ROAD_NW.
Referenced by AIBridge::_BuildBridgeRoad1(), AIBridge::_BuildBridgeRoad2(), AITunnel::_BuildTunnelRoad1(), AITunnel::_BuildTunnelRoad2(), CleanUpRoadBits(), CmdBuildRoad(), CmdRemoveRoadStop(), GetAnyRoadBits(), GetTownRoadGridElement(), GrowTownAtRoad(), GrowTownInTile(), GrowTownWithBridge(), IsNeighborRoadTile(), and RoadFindPathToDest().
Get the road types the given company can build.
company | the company to get the roadtypes for. |
Definition at line 98 of file road.cpp.
References _date, _settings_game, EngineInfo::climates, DAYS_IN_YEAR, EF_ROAD_TRAM, GameSettings::game_creation, HasBit(), GameCreationSettings::landscape, EngineInfo::misc_flags, ROADTYPE_ROAD, ROADTYPE_TRAM, ROADTYPES_NONE, and SetBit().
Referenced by DoStartupNewCompany().
Finds out, whether given company has all given RoadTypes available.
company | ID of company | |
rts | RoadTypes to test |
Definition at line 80 of file road.cpp.
References IsGeneratingWorld(), OWNER_TOWN, and ROADTYPES_ROAD.
Referenced by CmdBuildBridge(), CmdBuildRoadStop(), CmdBuildTunnel(), AIRoad::IsRoadTypeAvailable(), and ValParamRoadType().
static bool IsStraightRoad | ( | RoadBits | r | ) | [inline, static] |
Check if we've got a straight road.
r | The given RoadBits |
Definition at line 109 of file road_func.h.
References ROAD_X, and ROAD_Y.
Referenced by CheckRoadSlope(), CmdBuildRoad(), and RemoveRoad().
static bool IsValidRoadType | ( | RoadType | rt | ) | [inline, static] |
Whether the given roadtype is valid.
rt | the roadtype to check for validness |
Definition at line 18 of file road_func.h.
References ROADTYPE_ROAD, and ROADTYPE_TRAM.
Referenced by CmdBuildLongRoad(), CmdBuildRoad(), CmdBuildRoadDepot(), CmdRemoveLongRoad(), and CmdRemoveRoad().
Calculate the mirrored RoadBits.
Simply move the bits to their new position.
r | The given RoadBits value |
Definition at line 81 of file road_func.h.
References GB().
Referenced by CheckRoadSlope(), CleanUpRoadBits(), CmdBuildRoad(), and RemoveRoad().
Maps a RoadType to the corresponding RoadTypes value.
rt | the roadtype to get the roadtypes from |
Definition at line 39 of file road_func.h.
Referenced by AIRoad::_BuildRoadStationInternal(), AfterLoadVehicles(), AIBridge::BuildBridge(), AITunnel::BuildTunnel(), CmdBuildRoad(), CmdBuildRoadVeh(), AIRoad::GetNeighbourRoadCount(), AIStation::HasRoadType(), AIRoad::IsDriveThroughRoadStationTile(), AIRoad::IsRoadDepotTile(), AIRoad::IsRoadStationTile(), AIRoad::IsRoadTypeAvailable(), RemoveRoad(), and ValParamRoadType().
static RoadBits RotateRoadBits | ( | RoadBits | r, | |
DiagDirDiff | rot | |||
) | [inline, static] |
Calculate rotated RoadBits.
Move the Roadbits clockwise til they are in their final position.
r | The given RoadBits value | |
rot | The given Rotation angle |
Definition at line 95 of file road_func.h.
References GB().
void UpdateLevelCrossing | ( | TileIndex | tile, | |
bool | sound | |||
) |
Sets correct crossing state.
tile | tile to update | |
sound | should we play sound? |
Definition at line 1706 of file train_cmd.cpp.
References GetCrossingReservation(), HasVehicleOnPos(), MarkTileDirtyByTile(), TrainApproachingCrossing(), and TrainOnTileEnum().
Referenced by CmdBuildRoad(), CmdBuildSingleRail(), DeleteLastWagon(), and UnreserveRailTrack().
bool ValParamRoadType | ( | const RoadType | rt | ) |
Validate functions for rail building.
rt | road type to check. |
Definition at line 93 of file road.cpp.
References HasRoadTypesAvail(), and RoadTypeToRoadTypes().
Referenced by CmdBuildLongRoad(), CmdBuildRoad(), and CmdBuildRoadDepot().