aboutsummaryrefslogtreecommitdiff
path: root/game/entity.h
diff options
context:
space:
mode:
authorjacopograndi <jacopo.grandi@outlook.it>2022-01-04 13:35:02 +0100
committerjacopograndi <jacopo.grandi@outlook.it>2022-01-04 13:35:02 +0100
commitbb16c32bde58cba70e4877aa2d3ebd04332eb575 (patch)
treede3d82cca043c26cbaa64837a3b2c18efc6ddb64 /game/entity.h
parent411d2f6d6a6e5370d33f0f54b2f2de7147a9d977 (diff)
linux compile and imgs
Diffstat (limited to 'game/entity.h')
-rw-r--r--game/entity.h162
1 files changed, 81 insertions, 81 deletions
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 <vector>
-#include <string>
-
-#include <iostream>
-
-#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<int> abilities;
- std::vector<int> build;
- std::vector<int> train_id;
- std::vector<Class> train_class;
-
- std::vector<float> prod { 0, 0 };
- std::vector<float> cost { 0, 0 };
-
- std::vector<int> adjacent;
- std::vector<int> 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 <vector>
+#include <string>
+
+#include <iostream>
+
+#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<int> abilities;
+ std::vector<int> build;
+ std::vector<int> train_id;
+ std::vector<Class> train_class;
+
+ std::vector<float> prod { 0, 0 };
+ std::vector<float> cost { 0, 0 };
+
+ std::vector<int> adjacent;
+ std::vector<int> 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