-
Notifications
You must be signed in to change notification settings - Fork 0
/
board.hpp
executable file
·46 lines (36 loc) · 988 Bytes
/
board.hpp
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 BOARD_HPP
#define BOARD_HPP
#include "warrior.hpp"
#include <vector>
#include <cstdlib>
class Board
{
public:
Board();
void tick (Action action, int x, int y);
void draw() const;
void redraw();
void clear();
void push (Warrior w) { army_.push_back(w); }
void state (int x, int y, int s);
int action (int x, int y) const;
bool empty (int x, int y) const;
void select (int unit) { selected_ = unit; }
int next_unit();
void attack (int x, int y);
void move (int x, int y);
void possible_move (int x, int y, int ap);
void possible_attack (Warrior& unit);
Warrior& unit (int i) { return army_.at(i); }
Warrior& selected_unit () { return army_.at(selected_); }
size_t army_size() const { return army_.size(); }
int selected() const { return selected_; }
bool animated() const { return animator_.complete(); }
private:
unsigned selected_;
std::vector<int> cells_;
std::vector<Warrior> army_;
bool animating_;
Animator animator_;
};
#endif // BOARD_HPP