Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9005 for code/branches


Ignore:
Timestamp:
Dec 19, 2011, 2:43:04 PM (13 years ago)
Author:
willis
Message:

fixed merging some merging bugs and some other bugs…

Location:
code/branches/presentation2011/src/orxonox/controllers
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2011/src/orxonox/controllers/AIController.cc

    r8992 r9005  
    5959        if (this->state_ == FREE)
    6060        {
    61 
     61           
    6262            if (this->formationFlight_)
    6363            {
     64
     65                //changed order -> searchNewMaster MUSTN'T be called in SLAVE-state (bugfix for internal-error messages at quit)
     66                random = rnd(maxrand);
     67                if (random < 90 && (((!this->target_) || (random < 50 && this->target_)) && !this->forcedFree()))
     68                       this->searchNewMaster();
     69
    6470                // return to Master after being forced free
    6571                if (this->freedomCount_ == 1)
     
    6874                    this->freedomCount_ = 0;
    6975                }
    70 
    71                 random = rnd(maxrand);
    72                 if (random < 90 && (((!this->target_) || (random < 50 && this->target_)) && !this->forcedFree()))
    73                     this->searchNewMaster();
    7476            }
    7577
     
    7880        }
    7981
    80         if (this->state_ == SLAVE && this->formationMode_ == ATTACK) //TODO: add botlevel parameter
     82        if (this->state_ == SLAVE && this->formationMode_ == ATTACK)
    8183        {
    8284            // search enemy
    8385            random = rnd(maxrand);
    84             if (random < 75 && (!this->target_))
     86            if (random < (botlevel_*100) && (!this->target_))
    8587                this->searchNewTarget();
    8688
    8789            // next enemy
    8890            random = rnd(maxrand);
    89             if (random < 10 && (this->target_))
     91            if (random < (botlevel_*30) && (this->target_))
    9092                this->searchNewTarget();
    9193
    9294            // shoot
    9395            random = rnd(maxrand);
    94             if (!(this->passive_) && random < 75 && (this->target_ && !this->bShooting_))
     96            if (!(this->passive_) && random < (botlevel_*100) && (this->target_ && !this->bShooting_))
    9597                this->bShooting_ = true;
    9698
    9799            // stop shooting
    98100            random = rnd(maxrand);
    99             if (random < 25 && (this->bShooting_))
     101            if (random < (1-botlevel_)*50 && (this->bShooting_))
    100102                this->bShooting_ = false;
    101103
  • code/branches/presentation2011/src/orxonox/controllers/FormationController.cc

    r8996 r9005  
    383383    void FormationController::searchNewMaster()
    384384    {
    385 
     385        if (this->state_==SLAVE)
     386           return;
    386387        if (!this->getControllableEntity())
    387388            return;
     
    588589    void FormationController::takeLeadOfFormation()
    589590    {
    590         if (!this->getControllableEntity())
     591        if (!this->getControllableEntity() || this->state_==MASTER)
    591592            return;
    592593
    593         if (this->state_==MASTER) return;
    594594        //search new Master, then take lead
    595         if (this->state_==FREE)
     595        if (this->state_==FREE && this->myMaster_==0)
    596596        {
    597597          searchNewMaster();
  • code/branches/presentation2011/src/orxonox/controllers/HumanController.cc

    r8992 r9005  
    7878        this->boosting_ = false;
    7979        this->boosting_ = false;
    80         this->tempMaster=NULL;
    8180        HumanController::localController_s = this;
    8281        this->boostingTimeout_.setTimer(HumanController::BOOSTING_TIME, false, createExecutor(createFunctor(&HumanController::terminateBoosting, this)));
    8382        this->boostingTimeout_.stopTimer();
    84         this->state_=FREE;
    8583    }
    8684
  • code/branches/presentation2011/src/orxonox/controllers/HumanController.h

    r8992 r9005  
    113113            Timer boostingTimeout_; // A timer to check whether the player is no longer boosting.
    114114            static const float BOOSTING_TIME; // The time after it is checked, whether the player is no longer boosting.
    115             FormationController* tempMaster;
    116115
    117116    }; // tolua_export
  • code/branches/presentation2011/src/orxonox/controllers/NewHumanController.cc

    r8992 r9005  
    277277    }
    278278
    279     void NewHumanController::doFire(unsigned int firemode)//TODO??
     279    void NewHumanController::doFire(unsigned int firemode)
    280280    {
    281281        if (!this->controllableEntity_)
     
    291291        }
    292292        else
    293             HumanController::localController_s->getControllableEntity()->fire(firemode);
    294 
     293            HumanController::doFire(firemode); //call for formationflight
    295294    }
    296295
Note: See TracChangeset for help on using the changeset viewer.