MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / directionToVector

Method directionToVector

src/Battlescape/Pathfinding.cpp:488–496  ·  view source on GitHub ↗

* Converts direction to a vector. Direction starts north = 0 and goes clockwise. * @param direction Source direction. * @param vector Pointer to a position (which acts as a vector). */

Source from the content-addressed store, hash-verified

486 * @param vector Pointer to a position (which acts as a vector).
487 */
488void Pathfinding::directionToVector(const int direction, Position *vector)
489{
490 int x[10] = {0, 1, 1, 1, 0, -1, -1, -1,0,0};
491 int y[10] = {-1, -1, 0, 1, 1, 1, 0, -1,0,0};
492 int z[10] = {0, 0, 0, 0, 0, 0, 0, 0, 1, -1};
493 vector->x = x[direction];
494 vector->y = y[direction];
495 vector->z = z[direction];
496}
497
498/**
499 * Converts direction to a vector. Direction starts north = 0 and goes clockwise.

Callers 3

placeUnitNearPositionMethod · 0.80
wayPointActionMethod · 0.80
performMeleeAttackMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected