Changeset 9263 for code/trunk/src/modules/gametypes/RaceCheckPoint.cc
- Timestamp:
- Jun 3, 2012, 12:04:35 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/gametypes/RaceCheckPoint.cc
r9260 r9263 58 58 59 59 this->checkpointIndex_ = 0; 60 this->nextcheckpoints_ = Vector3::ZERO;61 60 this->bIsLast_ = false; 62 61 this->timeLimit_ = 0; … … 76 75 XMLPortParam(RaceCheckPoint, "islast", setLast, isLast, xmlelement, mode).defaultValues(false); 77 76 XMLPortParam(RaceCheckPoint, "timelimit", setTimelimit, getTimeLimit, xmlelement, mode).defaultValues(0); 78 XMLPortParam Template(RaceCheckPoint, "nextcheckpoints", setNextcheckpoint, getNextcheckpoint, xmlelement, mode, const Vector3&).defaultValues(Vector3::ZERO);77 XMLPortParam(RaceCheckPoint, "nextcheckpoints", setNextCheckpointsAsVector3, getNextCheckpointsAsVector3, xmlelement, mode); 79 78 } 80 79 … … 102 101 } 103 102 } 103 104 void RaceCheckPoint::setNextCheckpointsAsVector3(const Vector3& checkpoints) 105 { 106 this->nextCheckpoints_.clear(); 107 108 if (checkpoints.x > -1) 109 this->nextCheckpoints_.insert(static_cast<int>(checkpoints.x + 0.5)); 110 if (checkpoints.y > -1) 111 this->nextCheckpoints_.insert(static_cast<int>(checkpoints.y + 0.5)); 112 if (checkpoints.z > -1) 113 this->nextCheckpoints_.insert(static_cast<int>(checkpoints.z + 0.5)); 114 } 115 116 Vector3 RaceCheckPoint::getNextCheckpointsAsVector3() const 117 { 118 Vector3 checkpoints = Vector3(-1, -1, -1); 119 120 size_t count = 0; 121 for (std::set<int>::iterator it = this->nextCheckpoints_.begin(); it != this->nextCheckpoints_.end(); ++it) 122 { 123 switch (count) 124 { 125 case 0: checkpoints.x = static_cast<Ogre::Real>(*it); break; 126 case 1: checkpoints.y = static_cast<Ogre::Real>(*it); break; 127 case 2: checkpoints.z = static_cast<Ogre::Real>(*it); break; 128 } 129 ++count; 130 } 131 132 return checkpoints; 133 } 104 134 }
Note: See TracChangeset
for help on using the changeset viewer.