forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cube_direction.h
45 lines (37 loc) · 1.05 KB
/
cube_direction.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef CATA_SRC_CUBE_DIRECTION_H
#define CATA_SRC_CUBE_DIRECTION_H
#include <functional>
#include "enum_traits.h"
namespace om_direction
{
enum class type : int;
} // namespace om_direction
// We have other direction enums, but for this purpose we need to have one for
// the six rectilinear directions. These correspond to the faces of a cube, so
// I've called it cube_direction
enum class cube_direction : int {
north,
east,
south,
west,
above,
below,
last
};
template<>
struct enum_traits<cube_direction> {
static constexpr cube_direction last = cube_direction::last;
};
namespace std
{
template <> struct hash<cube_direction> {
std::size_t operator()( const cube_direction &d ) const {
return static_cast<std::size_t>( d );
}
};
} // namespace std
cube_direction operator+( cube_direction, om_direction::type );
cube_direction operator+( cube_direction, int i );
cube_direction operator-( cube_direction, om_direction::type );
cube_direction operator-( cube_direction, int i );
#endif // CATA_SRC_CUBE_DIRECTION_H