TDME2  1.9.200
FlowMapCell.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <tdme/tdme.h>
4 #include <tdme/math/Vector3.h>
5 
7 
8 /**
9  * Flow map cell
10  * @author Andreas Drewke
11  */
13  friend class PathFinding;
14  friend class FlowMap;
15 public:
16  // forbid class copy
18 
19  /**
20  * Default constructor
21  */
23  }
24 
25  /**
26  * Private constructor
27  * @param position position
28  * @param walkable walkable
29  * @param direction direction
30  * @param pathNodeIdx path node index
31  */
37  missingNeighborCell(false) {
38  //
39  }
40 
41  /**
42  * Private constructor
43  * @param position position
44  * @param walkable walkable
45  * @param direction direction
46  * @param pathNodeIdx path node index
47  * @param missingNeighborCell missing neighbor cell
48  */
55  //
56  }
57 
58  /**
59  * @return cell position
60  */
61  inline const Vector3& getPosition() const {
62  return position;
63  }
64 
65  /**
66  * @return if cell is walkable
67  */
68  inline bool isWalkable() const {
69  return walkable;
70  }
71 
72  /**
73  * @return cell movement direction
74  */
75  inline const Vector3& getDirection() const {
76  return direction;
77  }
78 
79  /**
80  * Get path node index
81  * @return path node index
82  */
83  inline int getPathNodeIdx() {
84  return pathNodeIdx;
85  }
86 
87  /**
88  * @return has missing neighbor cell
89  */
90  inline bool hasMissingNeighborCell() {
91  return missingNeighborCell;
92  }
93 
94  /**
95  * @return cloned flow map cell
96  */
97  inline FlowMapCell* clone() {
98  return new FlowMapCell(
99  position,
100  walkable,
101  direction,
102  pathNodeIdx,
104  );
105  }
106 
107 private:
109  bool walkable;
113 
114  /**
115  * Set path node index
116  * @param pathNodeIdx path node index
117  */
118  inline void setPathNodeIdx(int pathNodeIdx) {
119  this->pathNodeIdx = pathNodeIdx;
120  }
121 
122  /**
123  * Set movement direction
124  * @param cell movement direction
125  */
126  inline void setDirection(const Vector3& direction) {
127  this->direction = direction;
128  }
129 
130  /**
131  * Set has missing neighbor cell
132  * @param missingNeighborCell missing neighbor cell
133  */
135  this->missingNeighborCell = missingNeighborCell;
136  }
137 
138 };
Vector3 class representing vector3 mathematical structure and operations with x, y,...
Definition: Vector3.h:20
void setPathNodeIdx(int pathNodeIdx)
Set path node index.
Definition: FlowMapCell.h:118
void setMissingNeighborCell(bool missingNeighborCell)
Set has missing neighbor cell.
Definition: FlowMapCell.h:134
FlowMapCell(const Vector3 &position, bool walkable, const Vector3 &direction, int pathNodeIdx)
Private constructor.
Definition: FlowMapCell.h:32
const Vector3 & getDirection() const
Definition: FlowMapCell.h:75
void setDirection(const Vector3 &direction)
Set movement direction.
Definition: FlowMapCell.h:126
const Vector3 & getPosition() const
Definition: FlowMapCell.h:61
FlowMapCell()
Default constructor.
Definition: FlowMapCell.h:22
FlowMapCell(const Vector3 &position, bool walkable, const Vector3 &direction, int pathNodeIdx, bool missingNeighborCell)
Private constructor.
Definition: FlowMapCell.h:49
int getPathNodeIdx()
Get path node index.
Definition: FlowMapCell.h:83
Path finding class.
Definition: PathFinding.h:51
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6