Simplify and cleanup Transport system. Author: Vladimir.
--HG-- branch : trunk
This commit is contained in:
@@ -205,22 +205,22 @@ struct keyFrame
|
||||
|
||||
bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
|
||||
{
|
||||
TransportPath path;
|
||||
objmgr.GetTransportPathNodes(pathid, path);
|
||||
|
||||
if (path.Empty())
|
||||
if (pathid >= sTaxiPathNodesByPath.size())
|
||||
return false;
|
||||
|
||||
TaxiPathNodeList const& path = sTaxiPathNodesByPath[pathid];
|
||||
|
||||
std::vector<keyFrame> keyFrames;
|
||||
int mapChange = 0;
|
||||
mapids.clear();
|
||||
for (size_t i = 1; i < path.Size() - 1; ++i)
|
||||
for (size_t i = 1; i < path.size() - 1; ++i)
|
||||
{
|
||||
if (mapChange == 0)
|
||||
{
|
||||
if ((path[i].mapid == path[i+1].mapid))
|
||||
TaxiPathNodeEntry const* node_i = path[i];
|
||||
if (node_i->mapid == path[i+1]->mapid)
|
||||
{
|
||||
keyFrame k(path[i].x, path[i].y, path[i].z, path[i].mapid, path[i].actionFlag, path[i].delay);
|
||||
keyFrame k(node_i->x, node_i->y, node_i->z, node_i->mapid, node_i->actionFlag, node_i->delay);
|
||||
keyFrames.push_back(k);
|
||||
mapids.insert(k.mapid);
|
||||
}
|
||||
|
||||
@@ -27,35 +27,6 @@
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
class TransportPath
|
||||
{
|
||||
public:
|
||||
struct PathNode
|
||||
{
|
||||
uint32 mapid;
|
||||
float x,y,z;
|
||||
uint32 actionFlag;
|
||||
uint32 delay;
|
||||
};
|
||||
|
||||
void SetLength(const unsigned int sz)
|
||||
{
|
||||
i_nodes.resize(sz);
|
||||
}
|
||||
|
||||
unsigned int Size(void) const { return i_nodes.size(); }
|
||||
bool Empty(void) const { return i_nodes.empty(); }
|
||||
void Resize(unsigned int sz) { i_nodes.resize(sz); }
|
||||
void Clear(void) { i_nodes.clear(); }
|
||||
PathNode* GetNodes(void) { return static_cast<PathNode *>(&i_nodes[0]); }
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
class Transport : public GameObject
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user