RTS2D
include/algorithm/Pathfinding.h
00001 #ifndef PATHFINDING_H
00002 #include <vector>
00003 #include "Unit.h"
00004 #include "Building.h"
00005 #include "Define.h"
00006 #include "Graph.h"
00007 #include "Mymath.h"
00008 #define PATHFINDING_H
00009 
00013 class Pathfinding {
00014 public:
00015     Pathfinding(Graph* graph);
00016     virtual ~Pathfinding();
00017     std::vector<std::pair<float,float>> bfsPathfinding(float sx, float sy, float tx, float ty);
00018     std::vector<std::pair<float,float>> astarPathfinding(float sx, float sy, float tx, float ty);
00019     std::vector<std::pair<float,float>> dijkstraPathfinding(float sx, float sy, float tx, float ty);
00020     std::vector<std::pair<int,int>> getPath(Node* s, Node* t);
00021     std::vector<std::pair<float,float>> transformPath(std::vector<std::pair<int,int>> path, float tx, float ty);
00022     std::vector<std::pair<float,float>> getWalkingPath(std::vector<std::pair<float,float>> pixelPath);
00023     std::set<int> getZE(Unit* unit);
00024     std::set<int> getZE(Building* building);
00025     std::set<int> getZE(float px, float py);
00026     bool isInSameZE(std::set<int> ze1, std::set<int> ze2);
00027     std::pair<float,float> findNearestTile(float tx, float ty, std::set<int> zones);
00028 
00029 protected:
00030 private:
00031     Graph* graph_;
00032 };
00033 
00034 #endif // PATHFINDING_H
 Todos Classes Funções