00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _OPENCITY_AGENTPOLICE_H_
00022 #define _OPENCITY_AGENTPOLICE_H_ 1
00023
00024 #include "agent.h"
00025 #include <vector>
00026
00027
00028 class Destination;
00029
00030
00034 class AgentPolice : public Agent
00035 {
00036 public:
00037 typedef enum
00038 {
00039 POLICE_LOOK,
00040 POLICE_PURSUE,
00041 POLICE_LOST_PURSUE,
00042 POLICE_COLLABORATE
00043 } police_state_t;
00044
00045 AgentPolice(Kernel& kernel, Environment& env, int x, int y);
00046 virtual ~AgentPolice();
00047
00048 virtual void processMessage();
00049 virtual void born();
00050 virtual void live();
00051 virtual void die();
00052 virtual void output(std::ostream& os) const;
00053
00054 protected:
00055 police_state_t m_state;
00056 unsigned int m_sleep;
00057 unsigned int m_pursue;
00058 unsigned int m_lost_pursue;
00059
00060 Agent* SeeBadGuy(direction_t dir);
00061 void Look();
00062 void Pursue();
00063 void Collaborate();
00064 void SetState(police_state_t state);
00065 void NoticePursue(Agent *agent);
00066 Agent* FindBadGuy(bool test_backward=true);
00067 void LostPursue();
00068 Agent* IsNearBadGuy();
00069
00070
00071 unsigned int m_index;
00072 std::vector<Destination> m_path;
00073 typedef std::vector<Destination>::iterator m_path_it;
00074
00075 private:
00076
00077
00078
00079 void followPath();
00080 };
00081
00082 #endif
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113