- Timestamp:
- Nov 21, 2015, 7:05:53 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/orxonox/gametypes/TeamBaseMatch.cc
r10768 r10821 152 152 int amountControlled2 = 0; 153 153 154 for ( std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.begin(); it != this->bases_.end(); ++it)155 { 156 if(( *it)->getState() == BaseState::ControlTeam1)154 for (const auto & elem : this->bases_) 155 { 156 if((elem)->getState() == BaseState::ControlTeam1) 157 157 { 158 158 amountControlled++; 159 159 } 160 if(( *it)->getState() == BaseState::ControlTeam2)160 if((elem)->getState() == BaseState::ControlTeam2) 161 161 { 162 162 amountControlled2++; … … 187 187 } 188 188 189 for ( std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)190 { 191 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)189 for (auto & elem : this->teamnumbers_) 190 { 191 if (elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 192 192 continue; 193 193 194 if ( it->second == winningteam)195 this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());194 if (elem.second == winningteam) 195 this->gtinfo_->sendAnnounceMessage("You have won the match!", elem.first->getClientID()); 196 196 else 197 this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());197 this->gtinfo_->sendAnnounceMessage("You have lost the match!", elem.first->getClientID()); 198 198 } 199 199 … … 238 238 int count = 0; 239 239 240 for ( std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.begin(); it != this->bases_.end(); ++it)241 { 242 if (( *it)->getState() == BaseState::ControlTeam1 && team == 0)240 for (const auto & elem : this->bases_) 241 { 242 if ((elem)->getState() == BaseState::ControlTeam1 && team == 0) 243 243 count++; 244 if (( *it)->getState() == BaseState::ControlTeam2 && team == 1)244 if ((elem)->getState() == BaseState::ControlTeam2 && team == 1) 245 245 count++; 246 246 } … … 258 258 { 259 259 unsigned int i = 0; 260 for ( std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.begin(); it != this->bases_.end(); ++it)260 for (const auto & elem : this->bases_) 261 261 { 262 262 i++; 263 263 if (i > index) 264 return ( *it);264 return (elem); 265 265 } 266 266 return nullptr;
Note: See TracChangeset
for help on using the changeset viewer.