1 | |
---|
2 | |
---|
3 | |
---|
4 | |
---|
5 | |
---|
6 | |
---|
7 | #include "WagnisPlayer.h" |
---|
8 | #include <vector> |
---|
9 | #include <string> |
---|
10 | |
---|
11 | namespace orxonox |
---|
12 | { |
---|
13 | RegisterClass(WagnisPlayer); |
---|
14 | |
---|
15 | //Constructor |
---|
16 | WagnisPlayer::WagnisPlayer(Context* context,WagnisGameboard* gb) : Baseclass(context){ |
---|
17 | RegisterObject(WagnisPlayer); |
---|
18 | this->origin = nullptr; |
---|
19 | this->target = nullptr; |
---|
20 | this->gameBoard = gb; |
---|
21 | } |
---|
22 | //Destructor |
---|
23 | WagnisPlayer::~WagnisPlayer(){ |
---|
24 | |
---|
25 | } |
---|
26 | //Manages a Players turn |
---|
27 | void WagnisPlayer::playerTurn(){ |
---|
28 | |
---|
29 | } |
---|
30 | //checks if a move is valid, possible MoveTypes: ATTACK, MOVE, SET_TROOPS, SET_TROOPS_INITIAL |
---|
31 | bool WagnisPlayer::checkMove(WagnisProvince*,WagnisProvince*,MoveType) |
---|
32 | { |
---|
33 | if (MoveType == ATTACK) |
---|
34 | { |
---|
35 | if (isNeighbour(this->origin, this->target))//TODO: provinces neighbours |
---|
36 | { |
---|
37 | if (this->origin->getOwner_ID() == this->Player_ID) //origin belongs to player |
---|
38 | { |
---|
39 | if (this->target->getOwner_ID() != this->Player_ID)//target belongs to enemy |
---|
40 | return true; |
---|
41 | } |
---|
42 | } |
---|
43 | } |
---|
44 | |
---|
45 | if (MoveType == MOVE) |
---|
46 | { |
---|
47 | if (existPath(this->origin, this->target))//TODO: path exists, all belong to same player |
---|
48 | { |
---|
49 | if (this->origin->getOwner_ID() == this->Player_ID)//origin belongs to player |
---|
50 | return true; |
---|
51 | } |
---|
52 | |
---|
53 | } |
---|
54 | |
---|
55 | if (MoveType == SET_Troops) |
---|
56 | { |
---|
57 | if (this->target->getOwner_ID() == this->Player_ID)//target belongs to player |
---|
58 | return true; |
---|
59 | } |
---|
60 | |
---|
61 | if (MoveType == SET_TROOPS_INITIAL) |
---|
62 | { |
---|
63 | if (this->target->getOwner_ID() == 0)//target belongs to nobody |
---|
64 | return true; |
---|
65 | } |
---|
66 | |
---|
67 | return false; |
---|
68 | } |
---|
69 | |
---|
70 | //TODO |
---|
71 | bool WagnisPlayer::isNeighbour(WagnisProvince*,WagnisProvince*) |
---|
72 | { |
---|
73 | for () |
---|
74 | |
---|
75 | return false; |
---|
76 | } |
---|
77 | |
---|
78 | //TODO |
---|
79 | bool WagnisPlayer::existPath(WagnisProvince*,WagnisProvince*) |
---|
80 | { |
---|
81 | return false; |
---|
82 | } |
---|
83 | |
---|
84 | // |
---|
85 | void WagnisPlayer::setTroops(WagnisProvince*){ |
---|
86 | |
---|
87 | } |
---|
88 | void WagnisPlayer::attack(WagnisProvince*,WagnisProvince*){ |
---|
89 | |
---|
90 | } |
---|
91 | void WagnisPlayer::moveTroops(WagnisProvince*,WagnisProvince*){ |
---|
92 | |
---|
93 | } |
---|
94 | //Return a "Player x" String |
---|
95 | std::string WagnisPlayer::toString(){ |
---|
96 | std::string str = "Player "; |
---|
97 | str.append(std::to_string(Player_ID); |
---|
98 | return str; |
---|
99 | } |
---|
100 | } |
---|