diff options
Diffstat (limited to 'game/player.h')
-rw-r--r-- | game/player.h | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/game/player.h b/game/player.h index 01d8ee9..cf4146f 100644 --- a/game/player.h +++ b/game/player.h @@ -3,14 +3,41 @@ #include <vector> +#include "tech.h" + class Player { public: - Player (int r, int g, int b) : r(r), g(g), b(b) { } + Player (int r, int g, int b, int id) : r(r), g(g), b(b), id(id) { } + + void pay (std::vector<float> cost) { + for (int i=0; i<res.size(); i++) { + res[i] -= cost[i]; + } + } + void gain (std::vector<float> gain) { + for (int i=0; i<res.size(); i++) { + res[i] += gain[i]; + } + } + + bool has_tech (int id) { + if (std::find(techs.begin(), techs.end(), id) != techs.end()) + return true; + return false; + } - std::vector<int> res { 0, 0 }; + bool operator== (Player &oth) { return id == oth.id; } + + int id; + + std::vector<float> res { 0, 0 }; std::vector<int> techs; + TechLookup tech_lookup; + + int researching { -1 }; + int leveling_up { -1 }; int level { 0 }; int r, g, b; |