Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 2, 2018, 10:47:00 PM (5 years ago)
Author:
stadlero
Message:

Troop count is visible in the HUD

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc

    r12133 r12134  
    1 
    2 
    3 
    41
    52
     
    6461                        if (checkMove(SET_TROOPS_INITIAL)){
    6562                            this->target_province->owner_ID = this->Player_ID;
    66                             this->target_province->troops += 1;
    67                             orxout()<<"Province "<<this->target_province->ID<<" owned by Player "<<this->target_province->owner_ID<<" troops: "<<this->target_province->troops<<endl;
     63                            this->target_province->setTroops(this->target_province->getTroops()+1);
     64                            orxout()<<"Province "<<this->target_province->ID<<" owned by Player "<<this->target_province->owner_ID<<" troops: "<<this->target_province->getTroops()<<endl;
    6865                            master->playerFinishedStageCallback(this);
    6966                        }else{
     
    7774                    {
    7875                        if (checkMove(SET_TROOPS)){
    79                             this->target_province->troops += 1;
    80                             orxout()<<"Province "<<this->target_province->ID<<" owned by Player "<<this->target_province->owner_ID<<" troops: "<<this->target_province->troops<<endl;
     76                            this->target_province->setTroops(this->target_province->getTroops()+1);
     77                            orxout()<<"Province "<<this->target_province->ID<<" owned by Player "<<this->target_province->owner_ID<<" troops: "<<this->target_province->getTroops()<<endl;
    8178                        }
    8279                           
     
    8784                        if (checkMove(ATTACK))
    8885                        {
    89                             while ((this->origin_province->troops > 1) && (this->target_province->troops > 0)) //still troops available
     86                            while ((this->origin_province->getTroops() > 1) && (this->target_province->getTroops() > 0)) //still troops available
    9087                            {
    91                                 while ((this->origin_province->troops >= 4) && (this->target_province->troops >= 2))
     88                                while ((this->origin_province->getTroops() >= 4) && (this->target_province->getTroops() >= 2))
    9289                                {
    9390                                    //normal fight, 3 attackers, 2 defenders
    9491                                }
    9592
    96                                 if ((this->origin_province->troops == 3) && (this->target_province->troops >= 2))
     93                                if ((this->origin_province->getTroops() == 3) && (this->target_province->getTroops() >= 2))
    9794                                {
    9895                                    //2 attackers, 2 defenders
    9996                                }
    10097
    101                                 if((this->origin_province->troops == 2) && (this->target_province->troops >= 2))
     98                                if((this->origin_province->getTroops() == 2) && (this->target_province->getTroops() >= 2))
    10299                                {
    103100                                    //1 attacker, 2 defenders
     
    107104                            }
    108105
    109                             if (this->target_province->troops == 0) //attacker won
     106                            if (this->target_province->getTroops() == 0) //attacker won
    110107                            {
    111108                                this->target_province->owner_ID = this->Player_ID;
    112                                 this->target_province->troops = (this->origin_province->troops - 1);
    113                                 this->origin_province->troops = 1;
     109                                this->target_province->setTroops(this->origin_province->getTroops() - 1);
     110                                this->origin_province->setTroops(1);
    114111                            }
    115112                        }
     
    121118                        if (checkMove(MOVE))
    122119                        {
    123                             this->target_province->troops += ((this->origin_province->troops) - 1);
    124                             this->origin_province->troops = 1;
     120                            this->target_province->setTroops(this->origin_province->getTroops()-1);
     121                            this->origin_province->setTroops(1);
    125122                        }
    126123                        break;
Note: See TracChangeset for help on using the changeset viewer.