- 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/Dynamicmatch.cc
r10768 r10821 405 405 void Dynamicmatch::rewardPig() 406 406 { 407 for ( std::map< PlayerInfo*, int >::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it) //durch alle Spieler iterieren und alle piggys finden408 { 409 if ( it->second==piggy)//Spieler mit der Pig-party frags++410 { 411 this->playerScored( it->first);407 for (auto & elem : this->playerParty_) //durch alle Spieler iterieren und alle piggys finden 408 { 409 if (elem.second==piggy)//Spieler mit der Pig-party frags++ 410 { 411 this->playerScored(elem.first); 412 412 } 413 413 } … … 422 422 423 423 std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects(); 424 for ( std::set<WorldEntity*>::iterator it = pawnAttachments.begin(); it != pawnAttachments.end(); ++it)425 { 426 if (( *it)->isA(Class(TeamColourable)))424 for (const auto & pawnAttachment : pawnAttachments) 425 { 426 if ((pawnAttachment)->isA(Class(TeamColourable))) 427 427 { 428 TeamColourable* tc = orxonox_cast<TeamColourable*>( *it);428 TeamColourable* tc = orxonox_cast<TeamColourable*>(pawnAttachment); 429 429 tc->setTeamColour(this->partyColours_[it_player->second]); 430 430 } … … 441 441 if (tutorial) // Announce selectionphase 442 442 { 443 for ( std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)444 { 445 if (! it->first)//in order to catch nullpointer443 for (auto & elem : this->playerParty_) 444 { 445 if (!elem.first)//in order to catch nullpointer 446 446 continue; 447 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)447 if (elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 448 448 continue; 449 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.", it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));449 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",elem.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 450 450 } 451 451 } … … 456 456 if(tutorial&&(!notEnoughKillers)&&(!notEnoughChasers)) //Selection phase over 457 457 { 458 for ( std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)458 for (auto & elem : this->playerParty_) 459 459 { 460 if (! it->first)//in order to catch nullpointer460 if (!elem.first)//in order to catch nullpointer 461 461 continue; 462 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)462 if (elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 463 463 continue; 464 else if ( it->second==chaser)464 else if (elem.second==chaser) 465 465 { 466 466 if (numberOf[killer]>0) 467 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.", it->first->getClientID(),partyColours_[piggy]);467 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",elem.first->getClientID(),partyColours_[piggy]); 468 468 else 469 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.", it->first->getClientID(),partyColours_[piggy]);469 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",elem.first->getClientID(),partyColours_[piggy]); 470 470 //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID()); 471 471 } 472 else if ( it->second==piggy)473 { 474 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.", it->first->getClientID(),partyColours_[chaser]);472 else if (elem.second==piggy) 473 { 474 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",elem.first->getClientID(),partyColours_[chaser]); 475 475 //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID()); 476 476 } 477 else if ( it->second==killer)478 { 479 this->gtinfo_->sendStaticMessage("Take the chasers down.", it->first->getClientID(),partyColours_[chaser]);477 else if (elem.second==killer) 478 { 479 this->gtinfo_->sendStaticMessage("Take the chasers down.",elem.first->getClientID(),partyColours_[chaser]); 480 480 //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID()); 481 481 } … … 490 490 if (tutorial) // Announce selectionphase 491 491 { 492 for ( std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)493 { 494 if (! it->first)//in order to catch nullpointer492 for (auto & elem : this->playerParty_) 493 { 494 if (!elem.first)//in order to catch nullpointer 495 495 continue; 496 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)496 if (elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 497 497 continue; 498 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.", it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));498 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",elem.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 499 499 } 500 500 } … … 505 505 if(tutorial&&(!notEnoughPigs)&&(!notEnoughChasers)) //Selection phase over 506 506 { 507 for ( std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)507 for (auto & elem : this->playerParty_) 508 508 { 509 if (! it->first)509 if (!elem.first) 510 510 continue; 511 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)511 if (elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 512 512 continue; 513 else if ( it->second==chaser)513 else if (elem.second==chaser) 514 514 { 515 515 if (numberOf[killer]>0) 516 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.", it->first->getClientID(),partyColours_[piggy]);516 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",elem.first->getClientID(),partyColours_[piggy]); 517 517 else 518 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.", it->first->getClientID(),partyColours_[piggy]);518 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",elem.first->getClientID(),partyColours_[piggy]); 519 519 //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID()); 520 520 } 521 else if ( it->second==piggy)522 { 523 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.", it->first->getClientID(),partyColours_[piggy]);521 else if (elem.second==piggy) 522 { 523 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",elem.first->getClientID(),partyColours_[piggy]); 524 524 //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID()); 525 525 } 526 else if ( it->second==killer)527 { 528 this->gtinfo_->sendStaticMessage("Take the chasers down.", it->first->getClientID(),partyColours_[piggy]);526 else if (elem.second==killer) 527 { 528 this->gtinfo_->sendStaticMessage("Take the chasers down.",elem.first->getClientID(),partyColours_[piggy]); 529 529 //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID()); 530 530 } … … 540 540 if (tutorial) // Announce selectionphase 541 541 { 542 for ( std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)543 { 544 if (! it->first)//in order to catch nullpointer542 for (auto & elem : this->playerParty_) 543 { 544 if (!elem.first)//in order to catch nullpointer 545 545 continue; 546 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)546 if (elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 547 547 continue; 548 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.", it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));548 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",elem.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 549 549 } 550 550 } … … 555 555 if(tutorial&&(!notEnoughPigs)&&(!notEnoughKillers)) //Selection phase over 556 556 { 557 for ( std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)557 for (auto & elem : this->playerParty_) 558 558 { 559 if (! it->first)559 if (!elem.first) 560 560 continue; 561 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)561 if (elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 562 562 continue; 563 else if ( it->second==chaser)563 else if (elem.second==chaser) 564 564 { 565 565 if (numberOf[killer]>0) 566 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.", it->first->getClientID(),partyColours_[piggy]);566 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",elem.first->getClientID(),partyColours_[piggy]); 567 567 else 568 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.", it->first->getClientID(),partyColours_[piggy]);568 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",elem.first->getClientID(),partyColours_[piggy]); 569 569 //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID()); 570 570 } 571 else if ( it->second==piggy)572 { 573 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.", it->first->getClientID(),partyColours_[chaser]);571 else if (elem.second==piggy) 572 { 573 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",elem.first->getClientID(),partyColours_[chaser]); 574 574 //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID()); 575 575 } 576 else if ( it->second==killer)577 { 578 this->gtinfo_->sendStaticMessage("Take the chasers down.", it->first->getClientID(),partyColours_[chaser]);576 else if (elem.second==killer) 577 { 578 this->gtinfo_->sendStaticMessage("Take the chasers down.",elem.first->getClientID(),partyColours_[chaser]); 579 579 //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID()); 580 580 } … … 620 620 else if(tutorial) // Announce selectionphase 621 621 { 622 for ( std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)623 { 624 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)622 for (auto & elem : this->playerParty_) 623 { 624 if (elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 625 625 continue; 626 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.", it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));626 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",elem.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 627 627 } 628 628 } … … 676 676 unsigned int randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size()))); 677 677 unsigned int index = 0; 678 for ( std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it)678 for (const auto & teamSpawnPoint : teamSpawnPoints) 679 679 { 680 680 if (index == randomspawn) 681 return ( *it);681 return (teamSpawnPoint); 682 682 683 683 ++index;
Note: See TracChangeset
for help on using the changeset viewer.