diff options
Diffstat (limited to 'backend')
-rw-r--r-- | backend/Location.cpp | 4 | ||||
-rw-r--r-- | backend/Location.h | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/backend/Location.cpp b/backend/Location.cpp index c036c7b..eadbef2 100644 --- a/backend/Location.cpp +++ b/backend/Location.cpp @@ -5,6 +5,10 @@ #include "Object.h" #include "util.h" +Direction operator - (const Direction & rhs) { + return static_cast<Direction>((rhs + 2) % 4); +} + Direction random_direction() { return DIRECTIONS[RNG::get().rand_int(4)]; } diff --git a/backend/Location.h b/backend/Location.h index d29c117..6f701ad 100644 --- a/backend/Location.h +++ b/backend/Location.h @@ -15,6 +15,7 @@ enum Direction { WEST = 3, }; static constexpr const Direction DIRECTIONS[] = { NORTH, EAST, SOUTH, WEST }; +Direction operator - (const Direction &); Direction random_direction(); Direction random_direction(const Location &); |