src/direction_func.h
changeset 9045 2e2f3fc16905
parent 8100 6bc08f98ec16
equal deleted inserted replaced
9044:d01d22d12fce 9045:2e2f3fc16905
   166 {
   166 {
   167 	return (DiagDirection)(2 - a);
   167 	return (DiagDirection)(2 - a);
   168 }
   168 }
   169 
   169 
   170 /**
   170 /**
       
   171  * Converts an Axis to a Direction
       
   172  *
       
   173  * This function returns the Direction which
       
   174  * belongs to the axis. As 2 directions are mapped to an axis
       
   175  * this function returns the one which points to south,
       
   176  * either south-west (on X axis) or south-east (on Y axis)
       
   177  *
       
   178  * @param a The axis
       
   179  * @return The direction pointed to south
       
   180  */
       
   181 static inline Direction AxisToDirection(Axis a)
       
   182 {
       
   183 	return (Direction)(5 - 2 * a);
       
   184 }
       
   185 
       
   186 /**
   171  * Convert an axis and a flag for north/south into a DiagDirection
   187  * Convert an axis and a flag for north/south into a DiagDirection
   172  * @param xy axis to convert
   188  * @param xy axis to convert
   173  * @param ns north -> 0, south -> 1
   189  * @param ns north -> 0, south -> 1
   174  * @return the desired DiagDirection
   190  * @return the desired DiagDirection
   175  */
   191  */