Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 16, 2011, 4:20:26 PM (12 years ago)
Author:
eceline
Message:

level Spacerace2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/spaceraceTwo/src/modules/gametypes/SpaceRace.cc

    r8934 r8940  
    4545    {
    4646        RegisterObject(SpaceRace);
    47         this->checkpointReached_ = 0;
     47       
    4848        this->bTimeIsUp_ = false;
    4949        this->numberOfBots_ = 0;
    5050        this->cantMove_=false;
    5151       
    52        
     52       for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
     53        {this->checkpointReached_[it->first]=0;}
    5354    }
    5455   
     
    136137    }
    137138
    138        
    139        
    140 
    141     void SpaceRace::newCheckpointReached(SpaceRaceManager* p, int index)
    142     {
    143         this->checkpointReached_=index;
     139        void SpaceRace::setV(SpaceRaceManager* m){
     140                Vector3 v =Vector3(0,0,0);
     141        int j=0;
     142        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
     143        {
     144                j=this->getCheckpointReached(it->first);
     145                RaceCheckPoint* r=m->getCheckpoint(j);
     146                v=r->getNextcheckpoint();
     147                for(int i=1;i<4;i++){
     148                 RaceCheckPoint* n=m->getCheckpoint(i);
     149                 n->setV(true);
     150                 }
     151        }
     152        }
     153
     154    void SpaceRace::newCheckpointReached(SpaceRaceManager* p, int index,PlayerInfo* pl)
     155    {
     156        this->checkpointReached_[pl]=index;
    144157        this->clock_.capture();
    145158        int s = this->clock_.getSeconds();
     
    154167    }
    155168   
    156      void SpaceRace::newCheckpointReached(RaceCheckPoint* p)
     169     void SpaceRace::newCheckpointReached(RaceCheckPoint* p, PlayerInfo* pl)
    157170    {   int index = p->getCheckpointIndex();
    158         this->checkpointReached_=index;
     171        this->checkpointReached_[pl]=index;
    159172        this->clock_.capture();
    160173        int s = this->clock_.getSeconds();
     
    169182    }
    170183   
    171      int SpaceRace::getCheckpointReached(PlayerInfo* player){
    172         return this->currentCheckpoint_[player];
    173 }
     184   
    174185
    175186void SpaceRace::playerEntered(PlayerInfo* player){
    176         this->currentCheckpoint_[player]=1;
     187        this->checkpointReached_[player]=0;
    177188        this->playersAlive_++;
    178189    }
Note: See TracChangeset for help on using the changeset viewer.