Changeset 9262 for code/trunk/src/modules/gametypes/SpaceRaceManager.cc
- Timestamp:
- Jun 2, 2012, 11:08:21 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/gametypes/SpaceRaceManager.cc
r9260 r9262 94 94 } 95 95 96 int SpaceRaceManager::getIndex(RaceCheckPoint* checkpoint) 96 /** 97 @brief Returns the checkpoint with the given checkpoint-index (@see RaceCheckPoint::getCheckpointIndex). 98 */ 99 RaceCheckPoint* SpaceRaceManager::findCheckpoint(int index) const 97 100 { 98 101 for (size_t i = 0; i < this->checkpoints_.size(); ++i) 99 if (this->checkpoints_[i] == checkpoint) 100 return i; 101 102 return -1; 102 if (this->checkpoints_[i]->getCheckpointIndex() == index) 103 return this->checkpoints_[i]; 104 return 0; 103 105 } 104 106 … … 113 115 if (index > -1) 114 116 { 115 Vector3 v = this-> getCheckpoint(index)->getNextcheckpoint();117 Vector3 v = this->findCheckpoint(index)->getNextcheckpoint(); 116 118 117 if (this-> getCheckpoint(v.x) == check)119 if (this->findCheckpoint(v.x) == check) 118 120 { 119 121 reachedValidCheckpoint = true; 120 122 } 121 if (this-> getCheckpoint(v.y) == check)123 if (this->findCheckpoint(v.y) == check) 122 124 { 123 125 reachedValidCheckpoint = true; 124 126 } 125 if (this-> getCheckpoint(v.z) == check)127 if (this->findCheckpoint(v.z) == check) 126 128 { 127 129 reachedValidCheckpoint = true; … … 130 132 else 131 133 { 132 reachedValidCheckpoint = ( this->getIndex(check) == 0);134 reachedValidCheckpoint = (check->getCheckpointIndex() == 0); 133 135 } 134 136 … … 147 149 { 148 150 if (index > -1) 149 this->setRad Vis(player, false);151 this->setRadarVisibility(player, false); 150 152 else 151 this-> getCheckpoint(0)->setRadarVisibility(false);153 this->findCheckpoint(0)->setRadarVisibility(false); 152 154 153 155 gametype->newCheckpointReached(check, player); 154 this->setRad Vis(player, true);156 this->setRadarVisibility(player, true); 155 157 } 156 158 } … … 159 161 } 160 162 161 void SpaceRaceManager::setRad Vis(PlayerInfo* player, bool bVisible)163 void SpaceRaceManager::setRadarVisibility(PlayerInfo* player, bool bVisible) 162 164 { 163 165 SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get()); 164 166 assert(gametype); 165 167 int index = gametype->getCheckpointReached(player); 166 Vector3 v = this-> getCheckpoint(index)->getNextcheckpoint();168 Vector3 v = this->findCheckpoint(index)->getNextcheckpoint(); 167 169 168 170 if (v.x > -1) 169 171 { 170 this-> getCheckpoint(v.x)->setRadarVisibility(bVisible);171 this-> getCheckpoint(v.x)->settingsChanged();172 this->findCheckpoint(v.x)->setRadarVisibility(bVisible); 173 this->findCheckpoint(v.x)->settingsChanged(); 172 174 } 173 175 if (v.y > -1) 174 176 { 175 this-> getCheckpoint(v.y)->setRadarVisibility(bVisible);176 this-> getCheckpoint(v.y)->settingsChanged();177 this->findCheckpoint(v.y)->setRadarVisibility(bVisible); 178 this->findCheckpoint(v.y)->settingsChanged(); 177 179 } 178 180 if (v.z > -1) 179 181 { 180 this-> getCheckpoint(v.z)->setRadarVisibility(bVisible);181 this-> getCheckpoint(v.z)->settingsChanged();182 this->findCheckpoint(v.z)->setRadarVisibility(bVisible); 183 this->findCheckpoint(v.z)->settingsChanged(); 182 184 } 183 185 }
Note: See TracChangeset
for help on using the changeset viewer.