BWAPI
|
00001 #ifndef THREATAWAREPATHFINDER_H 00002 #define THREATAWAREPATHFINDER_H 00003 #include "InformationManagerAgent.h" 00004 #include "UnitModel.h" 00005 #include "BWAPI.h" 00006 #include "BWTA.h" 00007 #include <windows.h> 00008 using namespace BWAPI; 00009 using namespace BWTA; 00010 00011 class MapNode 00012 { 00013 public: 00014 00015 MapNode *parent; 00016 MapNode *child; 00017 00018 float g; 00019 int h; 00020 int f; 00021 TilePosition p; 00022 00023 MapNode() : 00024 parent( 0 ), 00025 child( 0 ), 00026 g( 900.0 ), 00027 h( 0 ), 00028 f( 0 ) 00029 { 00030 } 00031 MapNode(TilePosition s) : 00032 parent( 0 ), 00033 child( 0 ), 00034 g( 900.0 ), 00035 h( 0 ), 00036 f( 0 ) 00037 { 00038 p = TilePosition(s.x(),s.y()); 00039 } 00040 }; 00041 00042 00043 class AgentPool; 00044 00045 class ThreatAwarePathFinder { 00046 public: 00047 ThreatAwarePathFinder::ThreatAwarePathFinder(InformationManagerAgent* im, AgentPool* p); 00048 std::set<MapNode*> ThreatAwarePathFinder::getNeighbours(MapNode* p, int precision); 00049 std::set<MapNode*> ThreatAwarePathFinder::pathFind(TilePosition s, TilePosition g, int precision); 00050 std::set<MapNode*> ThreatAwarePathFinder::gaussianPathFind(TilePosition s, TilePosition g, int precision); 00051 00052 bool ThreatAwarePathFinder::contains(std::set<MapNode*> s, MapNode* g); 00053 bool ThreatAwarePathFinder::remove(std::set<MapNode*> s, MapNode* g); 00054 MapNode* ThreatAwarePathFinder::best(std::set<MapNode*> s); 00055 void ThreatAwarePathFinder::drawGrid(); 00056 std::vector<MapNode*> path; 00057 bool pathFound; 00058 bool findingPath; 00059 private: 00060 InformationManagerAgent* informationManager; 00061 AgentPool* agentPool; 00062 MapNode* map[256][256]; 00063 std::set<MapNode*> population; 00064 00065 }; 00066 00067 00068 00069 00070 00071 00072 00073 00074 #endif