Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 28, 2018, 11:17:41 PM (5 years ago)
Author:
stadlero
Message:

changed gametype from Deathmatch to Wagnis in Wagnis.oxw + some wip in Wagnis.cc

File:
1 edited

Legend:

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

    r12124 r12130  
    1515    this->gameBoard = nullptr;
    1616    this->gameStage = NOT_READY;
     17    this->active_player = 1;
    1718
    1819    int n = 3;
     20    this->players.push_back(nullptr);
    1921    for(int i = 1;i <= n;i++){
    2022        WagnisPlayer* p = new WagnisPlayer(context);
    2123        p->gameBoard = this->gameBoard;
     24        p->Player_ID = i;
     25        p->master = this;
     26        //p->finishedStageCallback = &Wagnis::playerFinishedStage;
    2227        this->players.push_back(p);
    2328    }
     
    2934//Runs the game
    3035void Wagnis::start(){
    31     //SUPER(Wagnis,start);
    32     this->createGame();
     36    Deathmatch::start();
     37    if(this->gameStage == NOT_READY){
     38        this->createGame();
     39    }
     40
     41    //this->gameStage = CHOOSE_PROVINCE_STAGE;
     42    //this->players[1]->gameStage = this->gameStage;
     43    //this->players[1]->is_active = true;
    3344}
    3445
     
    3849}
    3950
     51
     52
     53/**
     54 * Callback function for Player classes. Needs to be called for the game to go on.
     55 * arg: player: pointer to the player which finished his stage.
     56 * (used to deactivate player after finishing)
     57 * enum GameStage { NOT_READY, CHOOSE_PROVINCE_STAGE, REINFORCEMENT_STAGE, ATTACK_STAGE, MOVE_STAGE };
     58 **/
     59void Wagnis::playerFinishedStage(WagnisPlayer* player){
     60
     61    /////////////////TEST////////////
     62    orxout()<<"juhuuuuuuuuuuuuuuuuuuu"<<endl;
     63    /////////////////TEST////////////
     64
     65    if(this->active_player != player->Player_ID){
     66        orxout()<<"shit happend. This player should not be activ. Wagnis::playerFinishedStage was called from wrong player"<<endl;
     67    }
     68    switch(this->gameStage){
     69        case CHOOSE_PROVINCE_STAGE:{
     70            player->is_active = false;
     71            if(this->active_player+1 < this->players.size()){
     72                this->active_player++;
     73                this->players[this->active_player]->gameStage = CHOOSE_PROVINCE_STAGE;
     74                this->players[this->active_player]->is_active = true;
     75            }else{
     76                this->active_player = 1;
     77                this->players[this->active_player]->gameStage = REINFORCEMENT_STAGE;
     78                this->players[this->active_player]->is_active = true;
     79            }
     80            break;
     81        }
     82        case REINFORCEMENT_STAGE:{
     83           
     84        }
     85        case ATTACK_STAGE:{
     86           
     87        }
     88        case MOVE_STAGE:{
     89           
     90        }
     91    }
     92}
     93
     94
     95
     96
    4097//Creates and links all needed classes
    41 void Wagnis::createGame(){\
    42     orxout() << "Game creation started";
     98void Wagnis::createGame(){
     99    orxout() << "Game creation started" << endl;
    43100
    44101    if(!findGameBoard()){
    45         orxout() << "Error: GameBoard not found";
     102        orxout() << "Error: GameBoard not found" << endl;
    46103    }
    47104
    48     this->gameBoard->initializeNeighbors();
    49     orxout() << "Game creation finished";
     105    //this->gameBoard->initializeNeighbors();
     106
     107    //for(WagnisPlayer* p: this->players){
     108        //this->playerEntered(p);
     109    //}
     110   
     111    orxout() << "Game creation finished" << endl;
    50112}
    51113
     
    54116    for (WagnisGameboard* gb : ObjectList<WagnisGameboard>()){
    55117        this->gameBoard = gb;
    56         orxout()<<"Gameboard pointer found and added";
     118        orxout()<<"Gameboard pointer found and added"<<endl;
    57119        return true;
    58120    }
Note: See TracChangeset for help on using the changeset viewer.