From 411d2f6d6a6e5370d33f0f54b2f2de7147a9d977 Mon Sep 17 00:00:00 2001 From: jacopograndi Date: Mon, 6 Sep 2021 20:11:36 +0200 Subject: started ai --- game/entity.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'game/entity.h') 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; }; -- cgit v1.2.3-54-g00ecf