Debian Codegraph @

src/mas/agentpolice.h

raw symbols SCIP
1 /***************************************************************************
2 agentpolice.h - description
3 -------------------
4 begin : nov 29th 2005
5 copyright : (C) 2005 by Duong Khang NGUYEN
6 email : neoneurone @ gmail com
7 author : Victor STINNER
8
9 $Id: agentpolice.h 375 2008-10-28 14:47:15Z neoneurone $
10 ***************************************************************************/
11
12 /***************************************************************************
13 * *
14 * This program is free software; you can redistribute it and/or modify *
15 * it under the terms of the GNU General Public License as published by *
16 * the Free Software Foundation; either version 2 of the License, or *
17 * any later version. *
18 * *
19 ***************************************************************************/
20
21 #ifndef _OPENCITY_AGENTPOLICE_H_
22 #define _OPENCITY_AGENTPOLICE_H_ 1
23
24 #include "agent.h"
25 #include <vector>
26
27 // Forward declarations
28 class Destination;
29
30 /*=====================================================================*/
31 /** Specialized police agent
32 @author Victor STINNER
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 // For collaboration and path finding
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 /* PRIVATE METHODS */
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