diff options
Diffstat (limited to 'src/model/Direction.hpp')
-rw-r--r-- | src/model/Direction.hpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/model/Direction.hpp b/src/model/Direction.hpp index db288f6..e817170 100644 --- a/src/model/Direction.hpp +++ b/src/model/Direction.hpp @@ -31,13 +31,32 @@ namespace RPGEdit { namespace Model { -enum Direction { +enum class Direction { NORTH, EAST, SOUTH, - WEST, + WEST }; +static inline Direction operator-(Direction dir) { + switch (dir) { + case Direction::NORTH: + return Direction::SOUTH; + + case Direction::EAST: + return Direction::WEST; + + case Direction::SOUTH: + return Direction::NORTH; + + case Direction::WEST: + return Direction::EAST; + + default: + __builtin_unreachable(); + } +} + } } |