aboutsummaryrefslogtreecommitdiff
path: root/game/entity.h
diff options
context:
space:
mode:
authorjacopograndi <jak.sk8@hotmail.it>2021-09-06 20:11:36 +0200
committerjacopograndi <jak.sk8@hotmail.it>2021-09-06 20:11:36 +0200
commit411d2f6d6a6e5370d33f0f54b2f2de7147a9d977 (patch)
tree82b631079a3d7226ce6384f695f2e3b213a2c635 /game/entity.h
parent522a43d16e812e10ff69747ee916918b4bd29f2f (diff)
started ai
Diffstat (limited to 'game/entity.h')
-rw-r--r--game/entity.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/game/entity.h b/game/entity.h
index 62e352e..a15ebdb 100644
--- a/game/entity.h
+++ b/game/entity.h
@@ -50,22 +50,32 @@ namespace EntityClass {
class Entity {
public:
- Entity(int x, int y, EntityInfo *info, int owner)
+ Entity (int x, int y, EntityInfo *info, int owner)
: x(x), y(y), info(info), owner(owner) { moved = 0; hp = 100; }
+ // copy constructor
+ Entity (const Entity& rhs) {
+ building = rhs.building; hp = rhs.hp; x = rhs.x; y = rhs.y;
+ done = rhs.done; moved = rhs.moved; info = rhs.info;
+ fights = rhs.fights; owner = rhs.owner;
+ }
+ Entity& operator=(const Entity& rhs) {
+ building = rhs.building; hp = rhs.hp; x = rhs.x; y = rhs.y;
+ done = rhs.done; moved = rhs.moved; info = rhs.info;
+ fights = rhs.fights; owner = rhs.owner;
+ };
bool operator==(Entity oth) {
return x == oth.x && y == oth.y && info->unit == oth.info->unit;
}
int building { 0 };
- float hp; /**/
+ float hp;
int x, y;
bool done = false;
int moved;
EntityInfo *info;
int fights { 0 };
-
int owner;
};