Changeset 12105
- Timestamp:
- Nov 14, 2018, 11:58:59 AM (6 years ago)
- Location:
- code/branches/wagnis_HS18/src/modules/wagnis
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc
r12103 r12105 68 68 } 69 69 70 //TODO71 bool WagnisPlayer::isNeighbour(WagnisProvince*,WagnisProvince*)72 {73 for ()74 75 return false;76 }77 78 //TODO79 bool WagnisPlayer::existPath(WagnisProvince*,WagnisProvince*)80 {81 return false;82 }83 84 70 // 85 71 void WagnisPlayer::setTroops(WagnisProvince*){ … … 101 87 //private function for CheckMove 102 88 //checks if provinces are neighbours for move 103 bool isNeighbour(WagnisProvince*,WagnisProvince*)89 bool WagnisPlayer::isNeighbour(WagnisProvince*,WagnisProvince*) 104 90 { 105 for (int i = 0; i < this->origin-> getNeighbours().size(); ++i)91 for (int i = 0; i < this->origin->neighbors.size(); ++i) 106 92 { 107 if (this->target == this->origin-> getNeighbours()(i))93 if (this->target == this->origin->neighbors(i)) 108 94 return true; 109 95 } … … 114 100 //private function for CheckMove 115 101 //checks if path is complete with provinces owned by player 116 bool existPath(WagnisProvince*,WagnisProvince*)102 bool WagnisPlayer::existPath(WagnisProvince*,WagnisProvince*) 117 103 { 118 WagnisProvince 104 if (this->origin->getOwner_ID() == this->target->getOwner_ID() && isNeighbour(this->origin, this->target)) 105 return true; 106 107 for (int i = 0; i < this->origin->neighbors.size(); ++i) 108 { 109 if (this->origin->getOwner_ID() == this->origin->neighbors(i)->getOwner_ID()) 110 return existPath(this->origin->neighbors(i), this->target); 111 } 112 113 return false; 119 114 } 120 115 } -
code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h
r12100 r12105 40 40 WagnisProvince* target; 41 41 bool isNeighbour(WagnisProvince*,WagnisProvince*); 42 bool existPath(WagnisProvince*,WagnisProvince*) 42 bool existPath(WagnisProvince*,WagnisProvince*); 43 43 }; 44 44 }
Note: See TracChangeset
for help on using the changeset viewer.