Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 5, 2018, 7:51:11 PM (5 years ago)
Author:
stadlero
Message:

some bugfixes

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

Legend:

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

    r12150 r12160  
    6464 **/
    6565void Wagnis::playerFinishedStageCallback(WagnisPlayer* player){
     66
     67    player->resetProvinceSelection();
    6668
    6769    if(this->active_player != player->Player_ID){
     
    132134            player->gameStage = ATTACK_STAGE;
    133135            this->gameStage = ATTACK_STAGE;
     136            player->reinforcements = provincesOfPlayerCounter(player->Player_ID);
    134137            orxout()<<"Player "<<player->Player_ID<<"\'s turn. Attack."<<endl;
    135138            break;
     
    170173    }
    171174
    172     //this->gameBoard->initializeNeighbors();
    173 
    174     //for(WagnisPlayer* p: this->players){
    175         //this->playerEntered(p);
    176     //}
     175    this->gameBoard->initializeNeighbors();
    177176   
    178177    orxout() << "Game creation finished" << endl;
     
    198197            }
    199198        }else{
    200             orxout()<<"Nullpointer found in provines!!!"<<endl;
     199            orxout()<<"Nullpointer found in provinces!!!"<<endl;
    201200        }
    202201    }
     
    212211            }
    213212        }else{
    214             orxout()<<"Nullpointer found in provines!!!"<<endl;
     213            orxout()<<"Nullpointer found in provinces!!!"<<endl;
    215214        }
    216215    }
  • code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc

    r12132 r12160  
    6464        orxout() << "String size:" << endl;
    6565        orxout() << str.size() << endl;
     66        orxout() << str<<endl;
    6667        unsigned int n = 0;
    6768        while(n < str.size()){
     
    8586                            if(other->getID() == other_ID){
    8687                                orig->addNeighbor(other);
    87                                 orxout() << "Added neighbor province "<< other_ID << " to province " << origin_ID << endl;
     88                                //orxout() << "Added neighbor province "<< other_ID << " to province " << origin_ID << endl;
    8889                                break;
    8990                            }
    9091                        }
    9192                    }
    92                     break;
    9393                }
    9494            }while((n < str.size()) && (str[n] == '+'));
     95
    9596            if(n == str.size()) return;
    9697            while((n < str.size()) && (str[n] == ' ')) n++;
     
    102103            n++;
    103104            while(n < str.size() && str[n] == ' ') n++;
     105            orxout()<<"One province finished"<<endl;
    104106        }
    105107    }
  • code/branches/wagnis_HS18/src/modules/wagnis/WagnisHUDinfo.cc

    r12159 r12160  
    7979            }
    8080            case REINFORCEMENT_STAGE: {
    81                 ss<<"Player "<<wagnisgame->active_player<<" place your reinforcements";
     81                ss<<"Player "<<wagnisgame->active_player<<" place your reinforcements: "<<wagnisgame->players.at(wagnisgame->active_player-1)->reinforcements;
    8282                setCaption( ss.str() );
    8383                break;
  • code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc

    r12150 r12160  
    4747                        this->province_selection_changed = true;
    4848                    }else{
     49                        if(this->origin_province != nullptr) this->origin_province->dehighlight();
    4950                        this->origin_province = prov;
     51                        this->origin_province->highlight();
    5052                        this->province_selection_changed = true;
    5153                    }
     
    8284                                this->reinforcements -= 1;
    8385                                orxout()<<"Province "<<this->target_province->getID()<<" owned by Player "<<this->target_province->getOwner_ID()<<" troops: "<<this->target_province->getTroops()<<endl;
     86                                if(reinforcements == 0) master->playerFinishedStageCallback(this);
    8487                            }
    8588                        }   
     
    351354        return this->is_active;
    352355    }
     356
     357    //Resets the two province pointers and dehighlights them.
     358    void WagnisPlayer::resetProvinceSelection(){
     359
     360        if(this->origin_province != nullptr)this->origin_province->dehighlight();
     361        if(this->target_province != nullptr)this->target_province->dehighlight();
     362        this->origin_province = nullptr;
     363        this->target_province = nullptr;
     364    }
    353365}
  • code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h

    r12150 r12160  
    3838        void setActive(bool);
    3939        bool isActive() const;
     40        void resetProvinceSelection();
    4041
    4142
  • code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc

    r12159 r12160  
    2020        this->owner_ID = -1;
    2121        this->troops = 0;
    22         this->setRadarName(std::to_string(0));
     22        this->setRadarName("");
    2323        this->setRadarObjectColour(colour({128,128,128}, 100.0f));
    2424        this->ID = -1;
     
    8181        this->setOwner_ID( this->getOwner_ID() );
    8282    }
     83
     84
     85
     86   
    8387    //set troops
    8488    void WagnisProvince::setTroops(int troops){
Note: See TracChangeset for help on using the changeset viewer.