Zappy Server
C++ game server: world, rules, scheduler, network
Loading...
Searching...
No Matches
Orientation.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <ostream>
4
10
enum class
Orientation
{
N
= 1,
E
= 2,
S
= 3,
W
= 4 };
11
12
inline
Orientation
turnRight
(
Orientation
o)
13
{
14
switch
(o) {
15
case
Orientation::N:
16
return
Orientation::E;
17
case
Orientation::E:
18
return
Orientation::S;
19
case
Orientation::S:
20
return
Orientation::W;
21
case
Orientation::W:
22
return
Orientation::N;
23
}
24
return
o;
25
}
26
27
inline
Orientation
turnLeft
(
Orientation
o)
28
{
29
switch
(o) {
30
case
Orientation::N:
31
return
Orientation::W;
32
case
Orientation::W:
33
return
Orientation::S;
34
case
Orientation::S:
35
return
Orientation::E;
36
case
Orientation::E:
37
return
Orientation::N;
38
}
39
return
o;
40
}
41
42
inline
std::ostream&
operator<<
(std::ostream& os,
Orientation
orientation)
43
{
44
switch
(orientation) {
45
case
Orientation::N:
46
return
os <<
"North"
;
47
case
Orientation::E:
48
return
os <<
"East"
;
49
case
Orientation::S:
50
return
os <<
"South"
;
51
case
Orientation::W:
52
return
os <<
"West"
;
53
}
54
return
os <<
"Unknown"
;
55
}
turnRight
Orientation turnRight(Orientation o)
Definition
Orientation.hpp:12
Orientation
Orientation
Orientation::E
@ E
Orientation::S
@ S
Orientation::W
@ W
Orientation::N
@ N
operator<<
std::ostream & operator<<(std::ostream &os, Orientation orientation)
Definition
Orientation.hpp:42
turnLeft
Orientation turnLeft(Orientation o)
Definition
Orientation.hpp:27
server
src
core
data
Orientation.hpp
Generated by
1.9.8