From c3e32345e53650a1c231f4e1a41d40c97955b893 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 26 Sep 2014 00:58:27 +0200 Subject: Collision rework --- src/model/Direction.hpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/model/Direction.hpp') 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(); + } +} + } } -- cgit v1.2.3