diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-09-26 00:58:27 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-09-26 00:58:27 +0200 |
commit | c3e32345e53650a1c231f4e1a41d40c97955b893 (patch) | |
tree | 93b22aedbe355173510a04eafec9f14d7c4c3e0f /src/model/Direction.hpp | |
parent | 8b4ca336ce68cc17573115dd07eb1bfc6521b298 (diff) | |
download | rpgedit-c3e32345e53650a1c231f4e1a41d40c97955b893.tar rpgedit-c3e32345e53650a1c231f4e1a41d40c97955b893.zip |
Collision rework
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(); + } +} + } } |