00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef ASTARNODE_H_INCLUDED
00017 #define ASTARNODE_H_INCLUDED
00018
00019 #include "pathutils.hpp"
00020 #include <set>
00021
00022 struct a_star_node
00023 {
00024 public:
00025 double g, h;
00026 gamemap::location loc;
00027 a_star_node* nodeParent;
00028 bool isInCloseList;
00029
00030 void initNode(gamemap::location const &pos, gamemap::location const &dst,
00031 double cost, a_star_node *parent, std::set<gamemap::location> const *teleports);
00032
00033 inline double heuristic(const gamemap::location& src, const gamemap::location& dst)
00034 {
00035 return distance_between(src, dst);
00036 }
00037 };
00038
00039 class a_star_world
00040 {
00041 class poss_a_star_node;
00042 poss_a_star_node *pool_;
00043 typedef std::vector<a_star_node*> vect_a_star_node;
00044 vect_a_star_node vectAStarNode_;
00045 size_t width_, nbNode_;
00046
00047 public:
00048 void resize_IFN(size_t parWidth, size_t parHeight);
00049 void clear();
00050 a_star_node* getNodeFromLocation(gamemap::location const &loc, bool& isCreated);
00051 a_star_world();
00052 ~a_star_world();
00053 };
00054
00055 #endif
00056