(svn r12870) -Codechange: remove some magic numbers from u.ship.state handling

This commit is contained in:
smatz
2008-04-24 13:05:51 +00:00
parent 5ac07a2c34
commit 345f160978
3 changed files with 25 additions and 13 deletions

View File

@@ -167,6 +167,22 @@ static inline DiagDirection AxisToDiagDir(Axis a)
return (DiagDirection)(2 - a);
}
/**
* Converts an Axis to a Direction
*
* This function returns the Direction which
* belongs to the axis. As 2 directions are mapped to an axis
* this function returns the one which points to south,
* either south-west (on X axis) or south-east (on Y axis)
*
* @param a The axis
* @return The direction pointed to south
*/
static inline Direction AxisToDirection(Axis a)
{
return (Direction)(5 - 2 * a);
}
/**
* Convert an axis and a flag for north/south into a DiagDirection
* @param xy axis to convert