Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 14, 2018, 11:58:59 AM (6 years ago)
Author:
samuelbl
Message:

Player update

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  
    6868    }
    6969   
    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    
    8470    //
    8571    void WagnisPlayer::setTroops(WagnisProvince*){
     
    10187    //private function for CheckMove
    10288    //checks if provinces are neighbours for move
    103     bool isNeighbour(WagnisProvince*,WagnisProvince*)
     89    bool WagnisPlayer::isNeighbour(WagnisProvince*,WagnisProvince*)
    10490    {
    105         for (int i = 0; i < this->origin->getNeighbours().size(); ++i)
     91        for (int i = 0; i < this->origin->neighbors.size(); ++i)
    10692        {
    107             if (this->target == this->origin->getNeighbours()(i))
     93            if (this->target == this->origin->neighbors(i))
    10894                return true;
    10995        }
     
    114100    //private function for CheckMove
    115101    //checks if path is complete with provinces owned by player
    116     bool existPath(WagnisProvince*,WagnisProvince*)
     102    bool WagnisPlayer::existPath(WagnisProvince*,WagnisProvince*)
    117103    {
    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;
    119114    }
    120115}
  • code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h

    r12100 r12105  
    4040        WagnisProvince* target;
    4141        bool isNeighbour(WagnisProvince*,WagnisProvince*);
    42         bool existPath(WagnisProvince*,WagnisProvince*)
     42        bool existPath(WagnisProvince*,WagnisProvince*);
    4343    };
    4444}
Note: See TracChangeset for help on using the changeset viewer.