-
Notifications
You must be signed in to change notification settings - Fork 0
/
being.h
122 lines (93 loc) · 3.23 KB
/
being.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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
114
115
116
117
118
119
120
121
122
/*
* =====================================================================================
*
* Filename: being.h
*
* Description: Header file for a "being"
*
* Version: 1.0
* Created: 15/04/16 11:17:00
* Revision: none
* Compiler: gcc
*
* Author: Petra (P.L.), [email protected]
* Organization:
*
* =====================================================================================
*/
#ifndef BEING_INC
#define BEING_INC
#include "ur_common.h"
#include <utility>
#include <queue>
#include <ctime>
#include <cstdlib>
#include "cityhelper.h"
/*
* =====================================================================================
* Class: Being
* Description: Class for an individual "being"
* =====================================================================================
*/
class Being
{
public:
std::pair<int, int> position;
CityHelper * helper;
/* ==================== LIFECYCLE ======================================= */
Being (CityHelper * _helper); /* constructor */
Being ( const Being &other ); /* copy constructor */
~Being (); /* destructor */
/* ==================== ACCESSORS ======================================= */
/*
*--------------------------------------------------------------------------------------
* Class: Being
* Method: get_carrying_furnature
*--------------------------------------------------------------------------------------
*/
inline Furniture get_carrying_furniture ( ) const
{
return carrying_furniture;
} /* ----- end of method Being::get_carrying_furnature ----- */
inline BeingRole get_role() const {
return role;
}
/* ==================== MUTATORS ======================================= */
/*
*--------------------------------------------------------------------------------------
* Class: Being
* Method: set_carrying_furnature
*--------------------------------------------------------------------------------------
*/
inline void set_carrying_furniture ( Furniture value )
{
carrying_furniture = value;
return ;
} /* ----- end of method Being::set_carrying_furnature ----- */
inline void set_init_position(point _pos) {
position = initialposition = _pos;
}
inline void set_role(BeingRole br) {
role = br;
}
void act();
/* ==================== OPERATORS ======================================= */
Being& operator = ( const Being &other ); /* assignment operator */
protected:
/* ==================== DATA MEMBERS ======================================= */
private:
inline std::queue<std::pair<int, int> > * pathto(std::pair<int, int> destination) {
return helper->astar(position, destination);
}
/* ==================== DATA MEMBERS ======================================= */
std::queue<std::pair<int, int> > * planned_path;
Furniture carrying_furniture;
point initialposition;
std::set<point> * home;
BeingRole role;
// AI methods
void Farmer_act();
void Lord_act();
void Cook_act();
}; /* ----- end of class Being ----- */
#endif /* ----- #ifndef BEING_INC ----- */