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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user