Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 12163


Ignore:
Timestamp:
Dec 5, 2018, 9:57:36 PM (6 years ago)
Author:
stadlero
Message:

Added winning-stage

Location:
code/branches/wagnis_HS18/src/modules/wagnis
Files:
3 edited

Legend:

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

    r12162 r12163  
    145145        case MOVE_STAGE:{
    146146            player->setActive(false);
    147             if(this->active_player < this->players.size()){
    148                 this->active_player++;
     147            int tc;
     148            do{
     149                if(this->active_player < this->players.size()){
     150                    this->active_player++;
     151                }else{
     152                    this->active_player = 1;
     153                }
     154                tc = provincesOfPlayerCounter(this->active_player);
     155            }while(tc == 0); //Skip players without provinces.
     156
     157            if(player->Player_ID == this->active_player){
     158                //If all players except one got skipped, we got a winner
     159                this->gameStage = WINNER_STAGE;
     160                player->gameStage = WINNER_STAGE;
    149161            }else{
    150                 this->active_player = 1;
    151             }
    152             WagnisPlayer* next = this->players[this->active_player - 1];
    153             orxout()<<"Player "<<next->Player_ID<<"\'s turn. Reinforcement."<<endl;
    154             next->gameStage = REINFORCEMENT_STAGE;
    155             this->gameStage = REINFORCEMENT_STAGE;
    156             next->setActive(true);
    157             next->reinforcements = provincesOfPlayerCounter(next->Player_ID);
     162                WagnisPlayer* next = this->players[this->active_player - 1];
     163                orxout()<<"Player "<<next->Player_ID<<"\'s turn. Reinforcement."<<endl;
     164                next->gameStage = REINFORCEMENT_STAGE;
     165                this->gameStage = REINFORCEMENT_STAGE;
     166                next->setActive(true);
     167                next->reinforcements = tc;
     168            }
     169           
    158170            break;
    159171        }
  • code/branches/wagnis_HS18/src/modules/wagnis/WagnisHUDinfo.cc

    r12160 r12163  
    9898                break;
    9999            }
     100            case WINNER_STAGE: {
     101                ss<<"PLAYER "<<wagnisgame->active_player<<" WINS!!!";
     102                setCaption( ss.str() );
     103                break;
     104            }
     105            default: {}
    100106        }
    101107    }
  • code/branches/wagnis_HS18/src/modules/wagnis/WagnisPrereqs.h

    r12157 r12163  
    7272    class WagnisHUD;
    7373    class WagnisHUDinfo;
    74     enum GameStage { NOT_READY, CHOOSE_PROVINCE_STAGE, REINFORCEMENT_STAGE, ATTACK_STAGE, MOVE_STAGE };
     74    enum GameStage { NOT_READY, CHOOSE_PROVINCE_STAGE, REINFORCEMENT_STAGE, ATTACK_STAGE, MOVE_STAGE, WINNER_STAGE };
    7575    enum MoveType { ATTACK, MOVE, SET_TROOPS, SET_TROOPS_INITIAL };
    7676
Note: See TracChangeset for help on using the changeset viewer.