diff options
author | jacopograndi <jak.sk8@hotmail.it> | 2021-08-31 23:53:53 +0200 |
---|---|---|
committer | jacopograndi <jak.sk8@hotmail.it> | 2021-08-31 23:53:53 +0200 |
commit | 8af1284654a4a5d454a559eca371bf0ac3c79786 (patch) | |
tree | 70e9cf9d3d11a205175bdad394b6201870cf7f07 /game/player.h | |
parent | fb5a98b72ab79949d1da7f75a3d6150c2906ef40 (diff) |
tech done, building sprites, upgrade on age up, gui
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; |