Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 3, 2014, 9:44:23 PM (12 years ago)
Author:
landauf
Message:

removed unused code (some of the code was after a 'return' statement and thus never executed)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/gametypes/RaceCheckPoint.cc

    r9963 r9964  
    104104    }
    105105
    106     //Must not be called before setNextCheckpointsAsVector3 at least once has been called
    107     void RaceCheckPoint::setNextVirtualCheckpointsAsVector3(const Vector3& checkpoints){
    108         /*std::set<int> lastcheckpoints=this->nextCheckpoints_;
    109         nextCheckpoints_.clear();
    110         std::set<int>::iterator it = lastcheckpoints.begin();
    111         if(checkpoints.x<-1){
    112             virtualToRealCheckPoints_.insert(std::pair<int,int>(checkpoints.x,(*it)));
    113             it++;
    114         }
    115         if(checkpoints.x!=-1)
    116             this->nextCheckpoints_.insert(static_cast<int>(checkpoints.x + 0.5)); // the red number has the type double and for the cast (to int) is added 0.5 so that the cast works correctly
    117 
    118         if(checkpoints.y<-1){
    119                     virtualToRealCheckPoints_.insert(std::pair<int,int>(checkpoints.y,(*it)));
    120                     it++;
    121         }
    122         if(checkpoints.y!=-1)
    123             this->nextCheckpoints_.insert(static_cast<int>(checkpoints.y + 0.5));
    124 
    125         if(checkpoints.z<-1){
    126                     virtualToRealCheckPoints_.insert(std::pair<int,int>(checkpoints.z,(*it)));
    127                     it++;
    128         }
    129         if(checkpoints.z!=-1)
    130             this->nextCheckpoints_.insert(static_cast<int>(checkpoints.z + 0.5));*/
    131         nextCheckpointsVirtual_.clear();
    132         if(checkpoints.x!=-1)
    133             nextCheckpointsVirtual_.insert(checkpoints.x);
    134         if(checkpoints.y!=-1)
    135                 nextCheckpointsVirtual_.insert(checkpoints.y);
    136         if(checkpoints.z!=-1)
    137                 nextCheckpointsVirtual_.insert(checkpoints.z);
    138     }
    139 
    140106    void RaceCheckPoint::setNextCheckpointsAsVector3(const Vector3& checkpoints)
    141107    {
     
    148114        if (checkpoints.z > -1)
    149115        this->nextCheckpoints_.insert(static_cast<int>(checkpoints.z + 0.5));
    150 
    151         this->nextCheckpointsVirtual_=nextCheckpoints_;
    152116    }
    153117
     
    195159        }
    196160        return checkpoints;
    197         //= getVirtualNextCheckpointsAsVector3();
    198         int j[3];
    199         j[0]=changeVirtualToRealCheckPoint(checkpoints.x);
    200         j[1]=changeVirtualToRealCheckPoint(checkpoints.y);
    201         j[2]=changeVirtualToRealCheckPoint(checkpoints.z);
    202 
    203 
    204         return Vector3(j[0],j[1],j[2]);
    205 
    206 
    207161    }
    208162
    209     int RaceCheckPoint::changeVirtualToRealCheckPoint(int checkpointID) {
    210         int temp=checkpointID;
    211         while(temp<-1){
    212             temp = this->virtualToRealCheckPoints_[temp];
    213         }
    214         return temp;
    215     }
    216 
    217 
    218     Vector3 RaceCheckPoint::getVirtualNextCheckpointsAsVector3() const
    219     {
    220         Vector3 checkpoints = Vector3(-1, -1, -1);
    221 
    222         size_t count = 0;
    223         for (std::set<int>::iterator it = this->nextCheckpointsVirtual_.begin(); it != this->nextCheckpointsVirtual_.end(); ++it)
    224         {
    225             switch (count)
    226             {
    227                 case 0: checkpoints.x = static_cast<Ogre::Real>(*it); break;
    228                 case 1: checkpoints.y = static_cast<Ogre::Real>(*it); break;
    229                 case 2: checkpoints.z = static_cast<Ogre::Real>(*it); break;
    230             }
    231             ++count;
    232         }
    233 
    234         return checkpoints;
    235     }
    236163}
Note: See TracChangeset for help on using the changeset viewer.