Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 14, 2018, 9:29:00 AM (6 years ago)
Author:
samuelbl
Message:

Wagnis Player updated

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  
    22  WagnisProvince.cc
    33  WagnisGameboard.cc
    4   WagnisPlayer.cc
    54)
    65
  • code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc

    r12080 r12100  
    2525    }
    2626    //Manages a Players turn
    27     void WagnisPlayer::playerTurn(WagnisGameboard* gameBoard){
     27    void WagnisPlayer::playerTurn(){
    2828       
    2929    }
    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       
    3267        return false;
    3368    }
     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   
    3484    //
    35     void WagnisPlayer::setTroops(WagnisGameboard* gameBoard,WagnisProvince* prov,MoveType type){
     85    void WagnisPlayer::setTroops(WagnisProvince*){
    3686
    3787    }
    38     void WagnisPlayer::attack(WagnisGameboard* gameBoard,WagnisProvince* own,WagnisProvince* target){
     88    void WagnisPlayer::attack(WagnisProvince*,WagnisProvince*){
    3989
    4090    }
    41     void WagnisPlayer::moveTroops(WagnisGameboard* gameBoard,WagnisProvince* current,WagnisProvince* target){
     91    void WagnisPlayer::moveTroops(WagnisProvince*,WagnisProvince*){
    4292
    4393    }
  • code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h

    r12080 r12100  
    1515#include <string>
    1616
    17 enum MoveType { ATTACK, MOVE, SET_TROOPS };
     17enum MoveType { ATTACK, MOVE, SET_TROOPS, SET_TROOPS_INITIAL };
    1818
    1919
     
    2727        virtual ~WagnisPlayer();
    2828
    29         void playerTurn(WagnisGameboard*);
     29        void playerTurn();
    3030        bool checkMove(WagnisProvince*,WagnisProvince*,MoveType);
    3131        void setTroops(WagnisProvince*);
     
    3939        WagnisProvince* origin;
    4040        WagnisProvince* target;
     41        bool isNeighbour(WagnisProvince*,WagnisProvince*);
     42        bool existPath(WagnisProvince*,WagnisProvince*)
    4143    };
    4244}
Note: See TracChangeset for help on using the changeset viewer.