1 #pragma once
2 
3 #include <list>
4 #include "math/Vector3.h"
5 
6 namespace routing
7 {
8 	/**
9 	 * enum of rendering directions
10 	 * @todo perhaps it would be better to have an extended enum/class
11 	 * for direction which provides the rotate arrow, the order here is
12 	 * another than the one in routing data
13 	 */
14 	enum EDirection
15 	{
16 		DIR_WEST, DIR_NORTHWEST, DIR_NORTH, DIR_NORTHEAST, DIR_EAST, DIR_SOUTHEAST, DIR_SOUTH, DIR_SOUTHWEST,
17 
18 		MAX_DIRECTIONS
19 	};
20 
21 	/**
22 	 * @brief ++ operator for EDirection enum
23 	 */
24 	inline routing::EDirection operator++ (routing::EDirection &rs, int)
25 	{
26 		return rs = (routing::EDirection) (rs + 1);
27 	}
28 
29 	/**
30 	 * @brief connectivity states
31 	 */
32 	enum EConnectionState
33 	{
34 		CON_DISABLE, CON_CROUCHABLE, CON_WALKABLE, MAX_CONNECTIONSTATES
35 	};
36 
37 	/**
38 	 * @brief accessibility states
39 	 */
40 	enum EAccessState
41 	{
42 		ACC_DISABLED, ACC_CROUCH, ACC_STAND, MAX_ACCESSSTATE
43 	};
44 
45 	// TODO: Whatever there is in the lump
46 	class RoutingLumpEntry
47 	{
48 		private:
49 			Vector3 _origin;
50 			int _level;
51 			EConnectionState _connectionStates[MAX_DIRECTIONS];
52 			EAccessState _accessState;
53 		public:
54 			RoutingLumpEntry (Vector3 origin, int level);
55 			RoutingLumpEntry (const RoutingLumpEntry &other);
56 
getOrigin(void)57 			const Vector3& getOrigin (void) const {
58 				return _origin;
59 			}
60 
61 			EConnectionState getConnectionState (const EDirection direction) const;
62 			/**
63 			 * @brief setter method for connection state
64 			 * @param direction direction to change connection state for
65 			 * @param connectionState connection state to set
66 			 */
setConnectionState(const EDirection direction,const EConnectionState connectionState)67 			void setConnectionState (const EDirection direction, const EConnectionState connectionState)
68 			{
69 				_connectionStates[direction] = connectionState;
70 			}
getAccessState(void)71 			EAccessState getAccessState (void) const
72 			{
73 				return _accessState;
74 			}
setAccessState(const EAccessState accessState)75 			void setAccessState (const EAccessState accessState) {
76 				_accessState = accessState;
77 			}
78 
getLevel(void)79 			int getLevel (void) const {
80 				return _level;
81 			}
82 	};
83 
84 	typedef std::list<RoutingLumpEntry> RoutingLumpEntries;
85 
86 	class RoutingLump
87 	{
88 		private:
89 			RoutingLumpEntries _entries;
90 
91 		public:
92 			RoutingLump ();
93 
94 			virtual ~RoutingLump ();
95 
96 			RoutingLumpEntries& getEntries ();
97 
98 			/**@todo check whether this function should be private */
99 			void add (const RoutingLumpEntry& dataEntry);
100 	};
101 }
102