Changeset 11071 for code/trunk/src/orxonox/gametypes/Dynamicmatch.cc
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (8 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/gametypes/Dynamicmatch.cc
r11052 r11071 88 88 Dynamicmatch::~Dynamicmatch() 89 89 { 90 for ( std::set<Timer*>::iterator it = this->piggyTimers_.begin(); it != this->piggyTimers_.end(); ++it)91 delete (*it);90 for (Timer* timer : this->piggyTimers_) 91 delete timer; 92 92 } 93 93 … … 413 413 void Dynamicmatch::rewardPig() 414 414 { 415 for ( std::map< PlayerInfo*, int >::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it) //durch alle Spieler iterieren und alle piggys finden416 { 417 if ( it->second==piggy)//Spieler mit der Pig-party frags++418 { 419 this->playerScored( it->first);415 for (const auto& mapEntry : this->playerParty_) //durch alle Spieler iterieren und alle piggys finden 416 { 417 if (mapEntry.second==piggy)//Spieler mit der Pig-party frags++ 418 { 419 this->playerScored(mapEntry.first); 420 420 } 421 421 } … … 430 430 431 431 std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects(); 432 for ( std::set<WorldEntity*>::iterator it = pawnAttachments.begin(); it != pawnAttachments.end(); ++it)433 { 434 if ( (*it)->isA(Class(TeamColourable)))432 for (WorldEntity* pawnAttachment : pawnAttachments) 433 { 434 if (pawnAttachment->isA(Class(TeamColourable))) 435 435 { 436 TeamColourable* tc = orxonox_cast<TeamColourable*>( *it);436 TeamColourable* tc = orxonox_cast<TeamColourable*>(pawnAttachment); 437 437 tc->setTeamColour(this->partyColours_[it_player->second]); 438 438 } … … 449 449 if (tutorial) // Announce selectionphase 450 450 { 451 for ( std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)452 { 453 if (! it->first)//in order to catch nullpointer451 for (const auto& mapEntry : this->playerParty_) 452 { 453 if (!mapEntry.first)//in order to catch nullpointer 454 454 continue; 455 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)455 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 456 456 continue; 457 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.", it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));457 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",mapEntry.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 458 458 } 459 459 } … … 464 464 if(tutorial&&(!notEnoughKillers)&&(!notEnoughChasers)) //Selection phase over 465 465 { 466 for ( std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)466 for (const auto& mapEntry : this->playerParty_) 467 467 { 468 if (! it->first)//in order to catch nullpointer468 if (!mapEntry.first)//in order to catch nullpointer 469 469 continue; 470 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)470 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 471 471 continue; 472 else if ( it->second==chaser)472 else if (mapEntry.second==chaser) 473 473 { 474 474 if (numberOf[killer]>0) 475 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.", it->first->getClientID(),partyColours_[piggy]);475 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",mapEntry.first->getClientID(),partyColours_[piggy]); 476 476 else 477 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.", it->first->getClientID(),partyColours_[piggy]);477 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",mapEntry.first->getClientID(),partyColours_[piggy]); 478 478 //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID()); 479 479 } 480 else if ( it->second==piggy)481 { 482 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.", it->first->getClientID(),partyColours_[chaser]);480 else if (mapEntry.second==piggy) 481 { 482 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",mapEntry.first->getClientID(),partyColours_[chaser]); 483 483 //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID()); 484 484 } 485 else if ( it->second==killer)486 { 487 this->gtinfo_->sendStaticMessage("Take the chasers down.", it->first->getClientID(),partyColours_[chaser]);485 else if (mapEntry.second==killer) 486 { 487 this->gtinfo_->sendStaticMessage("Take the chasers down.",mapEntry.first->getClientID(),partyColours_[chaser]); 488 488 //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID()); 489 489 } … … 498 498 if (tutorial) // Announce selectionphase 499 499 { 500 for ( std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)501 { 502 if (! it->first)//in order to catch nullpointer500 for (const auto& mapEntry : this->playerParty_) 501 { 502 if (!mapEntry.first)//in order to catch nullpointer 503 503 continue; 504 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)504 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 505 505 continue; 506 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.", it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));506 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",mapEntry.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 507 507 } 508 508 } … … 513 513 if(tutorial&&(!notEnoughPigs)&&(!notEnoughChasers)) //Selection phase over 514 514 { 515 for ( std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)515 for (const auto& mapEntry : this->playerParty_) 516 516 { 517 if (! it->first)517 if (!mapEntry.first) 518 518 continue; 519 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)519 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 520 520 continue; 521 else if ( it->second==chaser)521 else if (mapEntry.second==chaser) 522 522 { 523 523 if (numberOf[killer]>0) 524 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.", it->first->getClientID(),partyColours_[piggy]);524 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",mapEntry.first->getClientID(),partyColours_[piggy]); 525 525 else 526 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.", it->first->getClientID(),partyColours_[piggy]);526 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",mapEntry.first->getClientID(),partyColours_[piggy]); 527 527 //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID()); 528 528 } 529 else if ( it->second==piggy)530 { 531 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.", it->first->getClientID(),partyColours_[piggy]);529 else if (mapEntry.second==piggy) 530 { 531 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",mapEntry.first->getClientID(),partyColours_[piggy]); 532 532 //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID()); 533 533 } 534 else if ( it->second==killer)535 { 536 this->gtinfo_->sendStaticMessage("Take the chasers down.", it->first->getClientID(),partyColours_[piggy]);534 else if (mapEntry.second==killer) 535 { 536 this->gtinfo_->sendStaticMessage("Take the chasers down.",mapEntry.first->getClientID(),partyColours_[piggy]); 537 537 //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID()); 538 538 } … … 548 548 if (tutorial) // Announce selectionphase 549 549 { 550 for ( std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)551 { 552 if (! it->first)//in order to catch nullpointer550 for (const auto& mapEntry : this->playerParty_) 551 { 552 if (!mapEntry.first)//in order to catch nullpointer 553 553 continue; 554 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)554 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 555 555 continue; 556 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.", it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));556 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",mapEntry.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 557 557 } 558 558 } … … 563 563 if(tutorial&&(!notEnoughPigs)&&(!notEnoughKillers)) //Selection phase over 564 564 { 565 for ( std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)565 for (const auto& mapEntry : this->playerParty_) 566 566 { 567 if (! it->first)567 if (!mapEntry.first) 568 568 continue; 569 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)569 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 570 570 continue; 571 else if ( it->second==chaser)571 else if (mapEntry.second==chaser) 572 572 { 573 573 if (numberOf[killer]>0) 574 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.", it->first->getClientID(),partyColours_[piggy]);574 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",mapEntry.first->getClientID(),partyColours_[piggy]); 575 575 else 576 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.", it->first->getClientID(),partyColours_[piggy]);576 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",mapEntry.first->getClientID(),partyColours_[piggy]); 577 577 //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID()); 578 578 } 579 else if ( it->second==piggy)580 { 581 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.", it->first->getClientID(),partyColours_[chaser]);579 else if (mapEntry.second==piggy) 580 { 581 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",mapEntry.first->getClientID(),partyColours_[chaser]); 582 582 //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID()); 583 583 } 584 else if ( it->second==killer)585 { 586 this->gtinfo_->sendStaticMessage("Take the chasers down.", it->first->getClientID(),partyColours_[chaser]);584 else if (mapEntry.second==killer) 585 { 586 this->gtinfo_->sendStaticMessage("Take the chasers down.",mapEntry.first->getClientID(),partyColours_[chaser]); 587 587 //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID()); 588 588 } … … 631 631 else if(tutorial) // Announce selectionphase 632 632 { 633 for ( std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)634 { 635 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)633 for (const auto& mapEntry : this->playerParty_) 634 { 635 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 636 636 continue; 637 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.", it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));637 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",mapEntry.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 638 638 } 639 639 } … … 687 687 unsigned int randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size()))); 688 688 unsigned int index = 0; 689 for ( std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it)689 for (SpawnPoint* teamSpawnPoint : teamSpawnPoints) 690 690 { 691 691 if (index == randomspawn) 692 return (*it);692 return teamSpawnPoint; 693 693 694 694 ++index; … … 696 696 } 697 697 698 return 0;698 return nullptr; 699 699 } 700 700
Note: See TracChangeset
for help on using the changeset viewer.