Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 14, 2013, 3:42:22 PM (11 years ago)
Author:
maxima
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc

    r9622 r9624  
    309309
    310310
    311     // A function to check if this pawn's controller is the master of any formationcontroller
    312     bool Pawn::hasSlaves()
    313     {
    314         for (ObjectList<FormationController>::iterator it =
    315                          ObjectList<FormationController>::begin();
    316                          it != ObjectList<FormationController>::end(); ++it )
    317                 {
    318                         // checks if the pawn's controller has a slave
    319                         if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController())
    320                                 return true;
    321                 }
    322                 return false;
    323     }
    324 
    325     // A function that returns a slave of the pawn's controller
    326     Controller* Pawn::getSlave(){
    327         for (ObjectList<FormationController>::iterator it =
    328                         ObjectList<FormationController>::begin();
    329                         it != ObjectList<FormationController>::end(); ++it )
    330         {
    331                 if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController())
    332                         return it->getController();
    333         }
    334         return 0;
    335     }
    336 
    337 
    338311    void Pawn::death()
    339312    {
     
    348321            if (this->getGametype())
    349322                this->getGametype()->pawnKilled(this, this->lastHitOriginator_);
    350 
    351323
    352324            if (this->getPlayer() && this->getPlayer()->getControllableEntity() == this)
     
    527499    }
    528500
     501
     502    // A function to check if this pawn's controller is the master of any formationcontroller
     503    bool Pawn::hasSlaves()
     504    {
     505        for (ObjectList<FormationController>::iterator it =
     506                         ObjectList<FormationController>::begin();
     507                         it != ObjectList<FormationController>::end(); ++it )
     508                {
     509                        // checks if the pawn's controller has a slave
     510                        if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController())
     511                                return true;
     512                }
     513                return false;
     514    }
     515
     516    // A function that returns a slave of the pawn's controller
     517    Controller* Pawn::getSlave(){
     518        for (ObjectList<FormationController>::iterator it =
     519                        ObjectList<FormationController>::begin();
     520                        it != ObjectList<FormationController>::end(); ++it )
     521        {
     522                if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController())
     523                        return it->getController();
     524        }
     525        return 0;
     526    }
     527
     528
     529
    529530}
Note: See TracChangeset for help on using the changeset viewer.