aboutsummaryrefslogtreecommitdiff
path: root/src/game/Path.h
diff options
context:
space:
mode:
authormaximius <none@none>2009-10-17 15:51:44 -0700
committermaximius <none@none>2009-10-17 15:51:44 -0700
commite585187b248f48b3c6e9247b49fa07c6565d65e5 (patch)
tree637c5b7ddacf41040bef4ea4f75a97da64c6a9bc /src/game/Path.h
parent26b5e033ffde3d161382fc9addbfa99738379641 (diff)
*Backed out changeset 3be01fb200a5
--HG-- branch : trunk
Diffstat (limited to 'src/game/Path.h')
-rw-r--r--src/game/Path.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/game/Path.h b/src/game/Path.h
index 8024a03382b..2fd6723b01c 100644
--- a/src/game/Path.h
+++ b/src/game/Path.h
@@ -17,10 +17,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#ifndef TRINITYCORE_PATH_H
#define TRINITYCORE_PATH_H
+
#include "Common.h"
#include <vector>
+
class Path
{
public:
@@ -28,10 +31,12 @@ class Path
{
float x,y,z;
};
+
void SetLength(const unsigned int sz)
{
i_nodes.resize( sz );
}
+
unsigned int Size() const { return i_nodes.size(); }
bool Empty() const { return i_nodes.empty(); }
void Resize(unsigned int sz) { i_nodes.resize(sz); }
@@ -50,6 +55,7 @@ class Path
}
return len;
}
+
float GetPassedLength(uint32 curnode, float x, float y, float z)
{
float len = 0, xd, yd, zd;
@@ -60,6 +66,7 @@ class Path
zd = i_nodes[ idx ].z - i_nodes[ idx-1 ].z;
len += sqrtf( xd*xd + yd*yd + zd*zd );
}
+
if(curnode > 0)
{
xd = x - i_nodes[curnode-1].x;
@@ -67,10 +74,13 @@ class Path
zd = z - i_nodes[curnode-1].z;
len += sqrtf( xd*xd + yd*yd + zd*zd );
}
+
return len;
}
+
PathNode& operator[](const unsigned int idx) { return i_nodes[idx]; }
const PathNode& operator()(const unsigned int idx) const { return i_nodes[idx]; }
+
protected:
std::vector<PathNode> i_nodes;
};