Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8948


Ignore:
Timestamp:
Nov 23, 2011, 4:06:18 PM (13 years ago)
Author:
willis
Message:

debugging

Location:
code/branches/formation/src/orxonox/controllers
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/formation/src/orxonox/controllers/HumanController.cc

    r8943 r8948  
    7777        this->boosting_ = false;
    7878        this->boosting_ = false;
    79 
     79        this->tempMaster=NULL;
    8080        HumanController::localController_s = this;
    8181        this->boostingTimeout_.setTimer(HumanController::BOOSTING_TIME, false, createExecutor(createFunctor(&HumanController::terminateBoosting, this)));
    8282        this->boostingTimeout_.stopTimer();
    83         this->state_=MASTER;
     83        this->state_=FREE;
    8484    }
    8585
    8686    HumanController::~HumanController()
    8787    {
     88        if (HumanController::localController_s)
     89        {
     90            HumanController::localController_s->removeFromFormation();
     91        }
    8892        HumanController::localController_s = 0;
    89         if (this->state_==MASTER)
    90             removeFromFormation();
    9193    }
    9294
     
    101103
    102104        // commandslaves when Master of a formation
    103         if (this->state_==MASTER)
    104         {
    105             this->commandSlaves();
     105        if (HumanController::localController_s && HumanController::localController_s->state_==MASTER)
     106        {
     107            HumanController::localController_s->commandSlaves();
    106108        }
    107109    }
     
    274276    void HumanController::toggleFormationFlight()
    275277    {
     278       
    276279        if (HumanController::localController_s)
    277280        {
     
    280283                HumanController::localController_s->freeSlaves();
    281284                HumanController::localController_s->state_=FREE;
     285                orxout(message) <<"FormationFlight disabled "<< endl;
    282286            } else //SLAVE or FREE
    283287            {
    284288                HumanController::localController_s->takeLeadOfFormation();
     289                orxout(message) <<"FormationFlight enabled "<< endl;
    285290            }
     291           
    286292        }
    287293
  • code/branches/formation/src/orxonox/controllers/HumanController.h

    r8939 r8948  
    109109            Timer boostingTimeout_; // A timer to check whether the player is no longer boosting.
    110110            static const float BOOSTING_TIME; // The time after it is checked, whether the player is no longer boosting.
     111            Masterable* tempMaster;
    111112
    112113    }; // tolua_export
  • code/branches/formation/src/orxonox/controllers/Masterable.cc

    r8943 r8948  
    5959  static const unsigned int STANDARD_MAX_FORMATION_SIZE = 7;
    6060  static const int RADIUS_TO_SEARCH_FOR_MASTERS = 20000;
    61   static const int FORMATION_LENGTH =  130;
     61  static const int FORMATION_LENGTH =  110;
    6262  static const int FORMATION_WIDTH =  110;
    6363  static const int FREEDOM_COUNT = 4; //seconds the slaves in a formation will be set free when master attacks an enemy
     
    8686        this->speedCounter_ = 0.2f;
    8787        this->targetPosition_ = Vector3::ZERO;
    88 
     88        //this->team_=-1;
    8989        this->target_.setCallback(createFunctor(&Masterable::targetDied, this));
    9090  }
     
    319319                if (distance < 40)
    320320                {
    321                     this->getControllableEntity()->moveFrontBack(0.8f*SPEED_MASTER);
     321                    this->getControllableEntity()->moveFrontBack(0.2f*SPEED_MASTER);
    322322                   
    323323                } else this->getControllableEntity()->moveFrontBack(1.2f*SPEED_MASTER);
     
    444444            this->state_ = MASTER;
    445445            this->myMaster_ = 0;
     446            orxout(debug_output) << "search new master: no master found, but teammates"<< endl;
    446447        }
    447448    }
     
    588589        if (this->state_==FREE)
    589590        {
    590             float minDistance=RADIUS_TO_SEARCH_FOR_MASTERS;
     591          /*
     592            float minDistance=(float)RADIUS_TO_SEARCH_FOR_MASTERS;
    591593            Masterable* bestMaster=NULL;
    592594
     
    639641              this->slaves_.clear();
    640642              this->myMaster_=0;
     643              orxout(debug_output) << this << "no formation found!, empty formation"<< endl;
    641644              return;
    642645            }
    643         }
    644 
    645         if (this->state_==SLAVE)
    646         {
     646         */
     647          searchNewMaster();
     648        }
     649
     650        if (this->state_==SLAVE)  //become master of this formation
     651        {   
    647652            this->slaves_=myMaster_->slaves_;
    648653            this->myMaster_->slaves_.clear();
Note: See TracChangeset for help on using the changeset viewer.