Changeset 12100 for code/branches/wagnis_HS18
- Timestamp:
- Nov 14, 2018, 9:29:00 AM (6 years ago)
- Location:
- code/branches/wagnis_HS18/src/modules/wagnis
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/wagnis_HS18/src/modules/wagnis/CMakeLists.txt
r12080 r12100 2 2 WagnisProvince.cc 3 3 WagnisGameboard.cc 4 WagnisPlayer.cc5 4 ) 6 5 -
code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc
r12080 r12100 25 25 } 26 26 //Manages a Players turn 27 void WagnisPlayer::playerTurn( WagnisGameboard* gameBoard){27 void WagnisPlayer::playerTurn(){ 28 28 29 29 } 30 //checks if a move is valid 31 bool WagnisPlayer::checkMove(WagnisGameboard*,WagnisProvince*,WagnisProvince*){ 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 32 67 return false; 33 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 34 84 // 35 void WagnisPlayer::setTroops(Wagnis Gameboard* gameBoard,WagnisProvince* prov,MoveType type){85 void WagnisPlayer::setTroops(WagnisProvince*){ 36 86 37 87 } 38 void WagnisPlayer::attack(Wagnis Gameboard* gameBoard,WagnisProvince* own,WagnisProvince* target){88 void WagnisPlayer::attack(WagnisProvince*,WagnisProvince*){ 39 89 40 90 } 41 void WagnisPlayer::moveTroops(Wagnis Gameboard* gameBoard,WagnisProvince* current,WagnisProvince* target){91 void WagnisPlayer::moveTroops(WagnisProvince*,WagnisProvince*){ 42 92 43 93 } -
code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h
r12080 r12100 15 15 #include <string> 16 16 17 enum MoveType { ATTACK, MOVE, SET_TROOPS };17 enum MoveType { ATTACK, MOVE, SET_TROOPS, SET_TROOPS_INITIAL }; 18 18 19 19 … … 27 27 virtual ~WagnisPlayer(); 28 28 29 void playerTurn( WagnisGameboard*);29 void playerTurn(); 30 30 bool checkMove(WagnisProvince*,WagnisProvince*,MoveType); 31 31 void setTroops(WagnisProvince*); … … 39 39 WagnisProvince* origin; 40 40 WagnisProvince* target; 41 bool isNeighbour(WagnisProvince*,WagnisProvince*); 42 bool existPath(WagnisProvince*,WagnisProvince*) 41 43 }; 42 44 }
Note: See TracChangeset
for help on using the changeset viewer.