From bb16c32bde58cba70e4877aa2d3ebd04332eb575 Mon Sep 17 00:00:00 2001 From: jacopograndi Date: Tue, 4 Jan 2022 13:35:02 +0100 Subject: linux compile and imgs --- game/entity.h | 162 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 81 insertions(+), 81 deletions(-) (limited to 'game/entity.h') diff --git a/game/entity.h b/game/entity.h index a15ebdb..f9f6781 100644 --- a/game/entity.h +++ b/game/entity.h @@ -1,82 +1,82 @@ -#ifndef ENTITIES_H -#define ENTITIES_H - -#include -#include - -#include - -#include "../umath/vec2.h" - - -class EntityInfo { - public: - EntityInfo() { spritebounds = vec2 { 16*6, 16 }; } - - enum Class { inf, cav, ran, sie, bld }; - Class ent_class; - - std::string name; - - int id; - int level; - - float hp; - float attack; - float defence; - int range; - float sight; - int move; - int unit; - std::vector abilities; - std::vector build; - std::vector train_id; - std::vector train_class; - - std::vector prod { 0, 0 }; - std::vector cost { 0, 0 }; - - std::vector adjacent; - std::vector diagonal; - float defence_bonus { 0 }; - int upgrade { -1 }; - - vec2 spritebounds; -}; - -namespace EntityClass { - int from_string(std::string str); -} - -class Entity { - public: - 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; - int x, y; - bool done = false; - int moved; - EntityInfo *info; - int fights { 0 }; - int owner; -}; - +#ifndef ENTITIES_H +#define ENTITIES_H + +#include +#include + +#include + +#include "../umath/vec2.h" + + +class EntityInfo { + public: + EntityInfo() { spritebounds = vec2 { 16*6, 16 }; } + + enum Class { inf, cav, ran, sie, bld }; + Class ent_class; + + std::string name; + + int id; + int level; + + float hp; + float attack; + float defence; + int range; + float sight; + int move; + int unit; + std::vector abilities; + std::vector build; + std::vector train_id; + std::vector train_class; + + std::vector prod { 0, 0 }; + std::vector cost { 0, 0 }; + + std::vector adjacent; + std::vector diagonal; + float defence_bonus { 0 }; + int upgrade { -1 }; + + vec2 spritebounds; +}; + +namespace EntityClass { + int from_string(std::string str); +} + +class Entity { + public: + 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; + int x, y; + bool done = false; + int moved; + EntityInfo *info; + int fights { 0 }; + int owner; +}; + #endif \ No newline at end of file -- cgit v1.2.3-54-g00ecf