Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10249


Ignore:
Timestamp:
Feb 1, 2015, 10:37:36 PM (9 years ago)
Author:
landauf
Message:

autoformatted code and removed commented block

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/storymodeHS14/src/orxonox/gametypes/Mission.cc

    r10174 r10249  
    7373    void Mission::pawnKilled(Pawn* victim, Pawn* killer)
    7474    {
    75         if (victim && victim->getPlayer() && victim->getPlayer()->isHumanPlayer() )
     75        if (victim && victim->getPlayer() && victim->getPlayer()->isHumanPlayer())
    7676        {
    7777            this->lives_--;
     
    8181    void Mission::start()
    8282    {
    83         std::fstream myfile;
     83        std::fstream myfile;
    8484
    8585        Gametype::start();
     
    9090    }
    9191
    92     std::string GenerateHelperString(int number){
    93         std::string helperstring = "";
    94         while (number>1) {
    95                 helperstring=helperstring+" ";
    96                 number=number-1;
    97         }
    98         helperstring=helperstring+".";
    99         return helperstring;
     92    std::string GenerateHelperString(int number)
     93    {
     94        std::string helperstring = "";
     95        while (number > 1)
     96        {
     97            helperstring = helperstring + " ";
     98            number = number - 1;
     99        }
     100        helperstring = helperstring + ".";
     101        return helperstring;
    100102    }
    101103
     
    103105    {
    104106
    105         if (this->missionAccomplished_ && !this->gtinfo_->hasEnded()){
     107        if (this->missionAccomplished_ && !this->gtinfo_->hasEnded())
     108        {
    106109            this->gtinfo_->sendAnnounceMessage("Mission accomplished!");
    107110            std::fstream myfile;
    108                                 myfile.open("/home/maxima/maxima-extra-0/orxonox/storymodeHS14/campaign.txt");
    109                                 std::string line;
    110                                 std::string mission=this->getFilename();
    111                                 int k=58-mission.length();
    112                                 std::string helperstring = "";
    113                                 if(myfile.is_open()){
    114                                         while (k>1) {
    115                                                 helperstring=helperstring+" ";
    116                                                 k=k-1;
    117                                         }
    118                                         helperstring=helperstring+".";
    119                                        while(getline (myfile,line)){
    120                                           if(line==mission+" 0"+helperstring){
    121                                                   long pos = myfile.tellp();
    122                                                   myfile.seekp (pos-61);
    123                                                   myfile << mission+" 1"+helperstring;
    124                                           }
    125                                         }}
    126                                         myfile.flush();
    127                                         myfile.clear();
    128                                         myfile.close();
    129                   }
     111            myfile.open("/home/maxima/maxima-extra-0/orxonox/storymodeHS14/campaign.txt");
     112            std::string line;
     113            std::string mission = this->getFilename();
     114            int k = 58 - mission.length();
     115            std::string helperstring = "";
     116            if (myfile.is_open())
     117            {
     118                while (k > 1)
     119                {
     120                    helperstring = helperstring + " ";
     121                    k = k - 1;
     122                }
     123                helperstring = helperstring + ".";
     124                while (getline(myfile, line))
     125                {
     126                    if (line == mission + " 0" + helperstring)
     127                    {
     128                        long pos = myfile.tellp();
     129                        myfile.seekp(pos - 61);
     130                        myfile << mission + " 1" + helperstring;
     131                    }
     132                }
     133            }
     134            myfile.flush();
     135            myfile.clear();
     136            myfile.close();
     137        }
    130138
    131139        else if (!this->gtinfo_->hasEnded())
     
    135143
    136144    void Mission::setTeams()
    137     {//Set pawn-colours
     145    { //Set pawn-colours
    138146        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
    139147        {
    140148            Pawn* pawn = static_cast<Pawn*>(*it);
    141             if(!pawn) continue;
    142                 this->setDefaultObjectColour(pawn);
     149            if (!pawn)
     150                continue;
     151            this->setDefaultObjectColour(pawn);
    143152        }
    144153    }
     
    146155    {
    147156        for (ObjectList<Mission>::iterator it = ObjectList<Mission>::begin(); it != ObjectList<Mission>::end(); ++it)
    148         {//TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would end ALL missions!
    149            /* if(accomplished){
    150                 std::fstream myfile;
    151                         myfile.open("/home/pmao/pmao-extra-0/orxonox/storymodeHS14/data/gui/scripts/campaign.txt");
    152                         std::string line;
    153                         std::string mission=it->getFilename();
    154                         int k=58-mission.length();
    155                     std::string helperstring = "";
    156                     if(myfile.is_open()){
    157                         while (k>1) {
    158                                 helperstring=helperstring+" ";
    159                             k=k-1;
    160                                     }
    161                     helperstring=helperstring+".";
    162                         while(getline (myfile,line)){
    163                                 if(line==mission+" 0"+helperstring){
    164                                 long pos = myfile.tellp();
    165                             myfile.seekp (pos-61);
    166                             myfile << mission+" 1"+helperstring;
    167                                           }
    168                         }
    169                     }
    170                     myfile.flush();
    171                     myfile.clear();
    172                     myfile.close();
    173             }*/
    174                 it->setMissionAccomplished(accomplished);
     157        { //TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would end ALL missions!
     158            it->setMissionAccomplished(accomplished);
    175159            it->end();
    176160
     
    181165    {
    182166        for (ObjectList<Mission>::iterator it = ObjectList<Mission>::begin(); it != ObjectList<Mission>::end(); ++it)
    183         {//TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would affect ALL missions!
     167        { //TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would affect ALL missions!
    184168            it->setLives(amount);
    185169        }
    186170    }
    187171
    188 
    189172}
Note: See TracChangeset for help on using the changeset viewer.