Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9616


Ignore:
Timestamp:
Apr 23, 2013, 3:47:49 PM (11 years ago)
Author:
maxima
Message:

A few changes of the death function. Tried to change the master of the formation.

Location:
code/branches/formationupdate/src/orxonox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/formationupdate/src/orxonox/controllers/FormationController.h

    r9613 r9616  
    5959      static void passivebehaviour(const bool passive);
    6060      static void formationsize(const int size);
     61      void takeLeadOfFormation();
    6162
    6263      inline void setFormationFlight(bool formation)
     
    139140      bool forcedFree();
    140141
    141       void takeLeadOfFormation();
    142142      void masterAttacked(Pawn* originator);
    143143
  • code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc

    r9615 r9616  
    318318                         it != ObjectList<FormationController>::end(); ++it )
    319319                {
    320                         // checks if the dying Pawn has a slave
     320                        // checks if the Pawn has a slave
    321321                        if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController())
    322                         {
    323                                 orxout(user_warning) << "This is a Slave of the HumanController: " << it->getThis() << endl;
    324322                                return true;
    325                         }
    326323                }
    327                 orxout(user_warning) << "The HumanController has no slaves!" << endl;
    328324                return false;
    329325    }
     
    357353            if (this->getPlayer() && this->getPlayer()->getControllableEntity() == this)
    358354            {
    359                 /* Do different things if Pawn is the Master of a Formation
    360                  * Doesn't work yet
    361                  *
    362                  */ if(this->hasSlaves())
     355
     356                // Do different things if Pawn is the Master of a Formation
     357                if(this->hasSlaves())
    363358                {
    364                                 // start to control a slave
    365                                 this->getPlayer()->startControl(this->getSlave()->getControllableEntity());
     359                        Controller* slave = this->getSlave();
     360                        ControllableEntity* entity = slave->getControllableEntity();
     361
     362                        // set new Master
     363                                        orxonox_cast<FormationController*>(slave)->takeLeadOfFormation();
     364
     365
     366                        /* TO DO: - new Master is not set right
     367                         *                - The slave still has a AIController
     368                         *
     369                         */
     370                                        //slave->getPlayer()->stopControl();
     371
     372                                        // start to control a slave
     373                                this->getPlayer()->startControl(entity);
    366374                }
    367                  else{
    368                          this->getPlayer()->stopControl();
    369                  }
     375                else
     376                {
     377                        this->getPlayer()->stopControl();
     378                }
    370379            }
    371380            if (GameMode::isMaster())
Note: See TracChangeset for help on using the changeset viewer.