Changeset 7163 for code/trunk/src/orxonox/gametypes/TeamDeathmatch.cc
- Timestamp:
- Aug 11, 2010, 8:55:13 AM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/gametypes/TeamDeathmatch.cc
r6417 r7163 137 137 } 138 138 139 SpawnPoint* fallbackSpawnPoint = NULL; 139 140 if (teamSpawnPoints.size() > 0) 140 141 { 141 142 unsigned int randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size()))); 142 143 unsigned int index = 0; 144 // Get random fallback spawnpoint in case there is no active SpawnPoint. 145 for (std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it) 146 { 147 if (index == randomspawn) 148 { 149 fallbackSpawnPoint = (*it); 150 break; 151 } 152 153 ++index; 154 } 155 156 // Remove all inactive SpawnPoints from the list. 157 for (std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ) 158 { 159 if(!(*it)->isActive()) 160 { 161 teamSpawnPoints.erase(it++); 162 continue; 163 } 164 165 ++it; 166 } 167 168 randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size()))); 169 index = 0; 143 170 for (std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it) 144 171 { … … 148 175 ++index; 149 176 } 177 178 return fallbackSpawnPoint; 150 179 } 151 180
Note: See TracChangeset
for help on using the changeset viewer.