1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Add direction_next and direction_prev helpers

This commit is contained in:
Richard Fine
2019-08-26 18:50:50 +01:00
parent 9123fa74d3
commit caa6ad71c7

View File

@@ -288,6 +288,22 @@ constexpr Direction ALL_DIRECTIONS[] = { 0, 1, 2, 3 };
return dir < 4;
}
/**
* Given a direction, return the next cardinal direction, wrapping around if necessary. (TODO: Figure out if this is CW or CCW)
*/
[[maybe_unused]] static constexpr Direction direction_next(Direction dir)
{
return (dir + 1) & 0x03;
}
/**
* Given a direction, return the previous cardinal direction, wrapping around if necessary. (TODO: Figure out if this is CW or CCW)
*/
[[maybe_unused]] static constexpr Direction direction_prev(Direction dir)
{
return (dir - 1) & 0x03;
}
struct CoordsXYZD : public CoordsXYZ
{
Direction direction = 0;