| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#ifndef _OPENCITY_AGENTPOLICE_H_ |
| 22 |
#define _OPENCITY_AGENTPOLICE_H_ 1 |
| 23 |
|
| 24 |
#include "agent.h" |
| 25 |
#include <vector> |
| 26 |
|
| 27 |
|
| 28 |
class Destination; |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
class AgentPolice : public Agent |
| 35 |
{ |
| 36 |
public: |
| 37 |
typedef enum |
| 38 |
{ |
| 39 |
POLICE_LOOK, |
| 40 |
POLICE_PURSUE, |
| 41 |
POLICE_LOST_PURSUE, |
| 42 |
POLICE_COLLABORATE |
| 43 |
} police_state_t; |
| 44 |
|
| 45 |
AgentPolice(Kernel& kernel, Environment& env, int x, int y); |
| 46 |
virtual ~AgentPolice(); |
| 47 |
|
| 48 |
virtual void processMessage(); |
| 49 |
virtual void born(); |
| 50 |
virtual void live(); |
| 51 |
virtual void die(); |
| 52 |
virtual void output(std::ostream& os) const; |
| 53 |
|
| 54 |
protected: |
| 55 |
police_state_t m_state; |
| 56 |
unsigned int m_sleep; |
| 57 |
unsigned int m_pursue; |
| 58 |
unsigned int m_lost_pursue; |
| 59 |
|
| 60 |
Agent* SeeBadGuy(MAS_DIRECTION dir); |
| 61 |
void Look(); |
| 62 |
void Pursue(); |
| 63 |
void Collaborate(); |
| 64 |
void SetState(police_state_t state); |
| 65 |
void NoticePursue(Agent *agent); |
| 66 |
Agent* FindBadGuy(bool test_backward=true); |
| 67 |
void LostPursue(); |
| 68 |
Agent* IsNearBadGuy(); |
| 69 |
|
| 70 |
|
| 71 |
unsigned int m_index; |
| 72 |
std::vector<Destination> m_path; |
| 73 |
typedef std::vector<Destination>::iterator m_path_it; |
| 74 |
|
| 75 |
private: |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
void followPath(); |
| 80 |
}; |
| 81 |
|
| 82 |
#endif |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|