10#ifndef DIRECTION_FUNC_H
11#define DIRECTION_FUNC_H
74 return static_cast<DirDiff>((
static_cast<uint
>(d0) -
static_cast<uint
>(d1)) % 8);
91 return static_cast<DirDiff>((
static_cast<uint
>(d) +
static_cast<uint
>(delta)) % 8);
108 return static_cast<Direction>((
static_cast<uint
>(d) +
static_cast<uint
>(delta)) % 8);
153 return static_cast<DiagDirection>((
static_cast<uint
>(d) +
static_cast<uint
>(delta)) % 4);
200 return (
Axis)(a ^ 1);
217 return (
Axis)(d & 1);
276 return (dir & 1) != 0;
DirDiff DirDifference(Direction d0, Direction d1)
Calculate the difference between two directions.
bool IsValidAxis(Axis d)
Checks if an integer value is a valid Axis.
Direction DiagDirToDir(DiagDirection dir)
Convert a DiagDirection to a Direction.
DiagDirection ReverseDiagDir(DiagDirection d)
Returns the reverse direction of the given DiagDirection.
Direction ReverseDir(Direction d)
Return the reverse of a direction.
bool IsValidDiagDirection(DiagDirection d)
Checks if an integer value is a valid DiagDirection.
Direction ChangeDir(Direction d, DirDiff delta)
Change a direction by a given difference.
DiagDirection AxisToDiagDir(Axis a)
Converts an Axis to a DiagDirection.
DiagDirection ChangeDiagDir(DiagDirection d, DiagDirDiff delta)
Applies a difference on a DiagDirection.
bool IsValidDirection(Direction d)
Checks if an integer value is a valid Direction.
Direction AxisToDirection(Axis a)
Converts an Axis to a Direction.
Axis OtherAxis(Axis a)
Select the other axis as provided.
bool IsDiagonalDirection(Direction dir)
Checks if a given Direction is diagonal.
DirDiff ChangeDirDiff(DirDiff d, DirDiff delta)
Applies two differences together.
Axis DiagDirToAxis(DiagDirection d)
Convert a DiagDirection to the axis.
DiagDirDiff DiagDirDifference(DiagDirection d0, DiagDirection d1)
Calculate the difference between two DiagDirection values.
DiagDirection XYNSToDiagDir(Axis xy, uint ns)
Convert an axis and a flag for north/south into a DiagDirection.
DiagDirection DirToDiagDir(Direction dir)
Convert a Direction to a DiagDirection.
Different types to 'show' directions.
Direction
Defines the 8 directions on the map.
@ DIR_END
Used to iterate.
Axis
Allow incrementing of DiagDirDiff variables.
@ AXIS_END
Used for iterations.
DiagDirection
Enumeration for diagonal directions.
@ DIAGDIR_END
Used for iterations.
DiagDirDiff
Enumeration for the difference between to DiagDirection.
DirDiff
Allow incrementing of Direction variables.