00001 #ifndef MON_PATHFIND_H
00002 #define MON_PATHFIND_H
00003
00004 class monster;
00005
00006 int mons_tracking_range(const monster* mon);
00007
00008 class monster_pathfind
00009 {
00010 public:
00011 monster_pathfind();
00012 virtual ~monster_pathfind();
00013
00014
00015 void set_range(int r);
00016 coord_def next_pos(const coord_def &p) const;
00017 bool init_pathfind(const monster* mon, coord_def dest,
00018 bool diag = true, bool msg = false,
00019 bool pass_unmapped = false);
00020 bool init_pathfind(coord_def src, coord_def dest,
00021 bool diag = true, bool msg = false);
00022 bool start_pathfind(bool msg = false);
00023 std::vector<coord_def> backtrack(void);
00024 std::vector<coord_def> calc_waypoints(void);
00025
00026 protected:
00027
00028 bool calc_path_to_neighbours(void);
00029 bool traversable(const coord_def& p);
00030 int travel_cost(coord_def npos);
00031 bool mons_traversable(const coord_def& p);
00032 int mons_travel_cost(coord_def npos);
00033 int estimated_cost(coord_def npos);
00034 void add_new_pos(coord_def pos, int total);
00035 void update_pos(coord_def pos, int total);
00036 bool get_best_position(void);
00037
00038
00039
00040 const monster* mons;
00041
00042
00043 coord_def start, target, pos;
00044
00045
00046 bool allow_diagonals;
00047
00048
00049
00050
00051 bool traverse_unmapped;
00052
00053
00054 int range;
00055
00056
00057 int min_length;
00058 int max_length;
00059
00060
00061 int dist[GXM][GYM];
00062
00063 int prev[GXM][GYM];
00064
00065 FixedVector<std::vector<coord_def>, GXM * GYM> hash;
00066 };
00067
00068 #endif