00001 /***************************************************************************************************/ 00002 /***************************************************************************************************/ 00008 /***************************************************************************************************/ 00009 /***************************************************************************************************/ 00010 #ifndef GAME_GRAPH_H 00011 #define GAME_GRAPH_H 00012 00013 /*------------------------------------ Prototypes ---------------------------------------------*/ 00014 class cPortal; 00015 class cA_Star_Point; 00016 class cParalell_Portal; 00017 00018 /*------------------------------------ Includes ---------------------------------------------*/ 00019 #include "a_star.h" 00020 #include "game_bsp.h" 00021 00022 00023 /*------------------------------------- Classes ---------------------------------------------*/ 00024 00025 00026 /*************************************************************************************************/ 00028 00031 class cA_Star_Point : public cA_Star_Node 00032 { 00033 public: 00035 00037 cA_Star_Point( cSquare_Area * area , cPoint2D& p); 00038 00040 float Get_Cost( cA_Star_Node * destination); 00041 00043 float Get_Estimated_Cost( cA_Star_Node * destination); 00044 00046 void Get_List_Neighbors( cList_A_Star_Nodes & voisinage ); 00047 00048 private: 00049 cSquare_Area * Area; 00050 00051 }; 00052 00053 00054 00055 /*************************************************************************************************/ 00057 00060 class cPortal : public cA_Star_Node 00061 { 00062 friend std::ostream & operator<<(std::ostream &os, const cPortal &ex); 00063 public: 00065 00068 cPortal(int id); 00069 00071 00074 cPortal(cHV_Seg & seg , cSquare_Area * area , int id); 00075 00077 void Add_Area( cSquare_Area * new_area); 00078 00080 00081 void Remove_Voisin( cA_Star_Node * node); 00082 00084 inline int Get_Id() const { return Id; }; 00086 float Get_Cost( cA_Star_Node * destination); 00088 float Get_Estimated_Cost( cA_Star_Node * destination); 00090 void Get_List_Neighbors( cList_A_Star_Nodes & voisinage ); 00092 bool Is_Similar( cPortal & portal); 00094 void Add_Voisin( cA_Star_Node * node); 00095 00096 cSquare_Area * Area1; 00097 cSquare_Area * Area2; 00098 cHV_Seg Segment; 00099 cList_A_Star_Nodes Voisinage; 00100 00101 protected: 00102 int Id; 00103 00104 00105 }; 00106 00107 00108 00109 00110 00111 /*************************************************************************************************/ 00113 00126 class cParalell_Portal : public cPortal 00127 { 00128 public: 00130 00133 cParalell_Portal( cPoint2D & pos , int id,cSquare_Area * area):cPortal(id) 00134 { 00135 //seg.Get_Middle(Position); 00136 //Segment = seg 00137 Segment.Set(pos,pos); 00138 Position = pos; 00139 Area1=area; 00140 Area2=area; 00141 } 00142 }; 00143 00144 00145 00146 #endif