aboutsummaryrefslogtreecommitdiff
path: root/game/player.h
blob: c29ea7e7f4e9c94a0eeb19a834b20909bf728d43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef PLAYER_H
#define PLAYER_H

#include <vector>

#include "tech.h"


class Player {
    public:
    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;
    }
    
    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;
};

#endif