00001 00002 #ifndef CAJUN_WORK_LIST_H 00003 #define CAJUN_WORK_LIST_H 00004 00005 #include "util.H" 00006 #include "search_grid.H" 00007 #include "map_grid.H" 00008 00009 #include <cassert> 00010 #include <iostream> 00011 00012 00013 namespace cajun 00014 { 00015 00016 struct work_info_t 00017 { 00018 float hcost; // 1/11/06 [AL]: Heuristic cost 00019 float cost; 00020 search_grid_t::iterator_t scell; 00021 00022 int map_px; 00023 int map_py; 00024 map_grid_t::iterator_t mcell; 00025 00026 bool operator< (work_info_t const &v_) const 00027 // 1/11/06 [AL]: Compare using Heuristic cost 00028 // was comparing cost 00029 { 00030 // Assertion useful to catch situation where hcost may 00031 // not have been set. Its expected to be set in the worklist 00032 // class. 00033 assert (hcost >= cost); 00034 return v_.hcost < hcost; 00035 } 00036 }; 00037 00039 typedef work_info_t work_data_t; 00040 class work_list_interface_t 00041 { 00042 public: 00043 work_list_interface_t () {}; 00044 virtual ~work_list_interface_t () {}; 00045 00046 virtual void clear () = 0; 00047 virtual bool empty () const = 0; 00048 virtual void add (work_data_t &wi_) = 0; 00049 virtual void init_traverse () = 0; 00050 virtual work_data_t *get () =0; 00051 virtual void remove (work_data_t const &wi_) = 0; 00052 00053 public: 00054 void set_vehicle_position (float vx, float vy) 00055 { 00056 m_vehicle_x = vx; 00057 m_vehicle_y = vy; 00058 } 00059 protected: 00060 float m_vehicle_x; 00061 float m_vehicle_y; 00062 00063 00064 00065 }; 00066 00067 }; 00068 00069 00070 00071 #endif
1.6.1