Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 14, 2011, 10:29:18 PM (13 years ago)
Author:
jo
Message:

Code clean up.

Location:
code/branches/ai2/src/orxonox
Files:
5 edited

Legend:

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

    r8736 r8758  
    196196                    this->bShooting_ = false;
    197197
     198                //boost
     199                random = rnd(maxrand);
     200                if (random < botlevel_*100 )
     201                    this->boostControl(); //TEST
    198202            }
    199203        }
     
    205209        if (!this->isActive())
    206210            return;
    207         if(this->bDeathFlag_)//If a bot died recently, make him check his weaponsystem.
    208         {
    209             this->bSetupWorked = false;
    210             this->numberOfWeapons = 0;
    211             this->resetDeathFlag();
    212         }
    213         this->boostControl();//TEST
     211
    214212        float random;
    215213        float maxrand = 100.0f / ACTION_INTERVAL;
     
    229227                            random = rnd(maxrand);
    230228                            if(this->botlevel_*100 > random)
    231                                 this->follow();//If a bot is shooting a player, it shouldn't let him go away easily.
     229                                this->follow();  //If a bot is shooting a player, it shouldn't let him go away easily.
    232230                        }
    233231                    }
     
    277275        else if (this->mode_ == ROCKET)//Rockets do not belong to a group of bots -> bot states are not relevant.
    278276        {   //Vector-implementation: mode_.back() == ROCKET;
    279             ControllableEntity *controllable = this->getControllableEntity(); 
     277            ControllableEntity *controllable = this->getControllableEntity();
    280278            if(controllable)
    281279            {
  • code/branches/ai2/src/orxonox/controllers/ArtificialController.cc

    r8757 r8758  
    317317        if (!this->getControllableEntity())
    318318            this->removeFromFormation();
     319        this->bSetupWorked = false;        // reset weapon information
     320        this->numberOfWeapons = 0;
     321        COUT(0)<<"ArtificialController::changedControllableEntity()"<<endl; //why is this function called more than once ??
    319322    }
    320323
     
    11351138    {
    11361139        int max=10, i=0, j=0, k=0;
    1137         if(!pawn) {COUT(0)<<"NO PAWN"<<std::endl; return;}
     1140        if(!pawn) return;
    11381141        while(i<max)
    11391142        {
     
    11511154                    k++;
    11521155                    if(wMode==NULL) continue;
    1153                     COUT(0)<<wMode->getName()<<": weaponpack "+multi_cast<std::string>(i-1)<<", weapon "<<multi_cast<std::string>(j-1)<<", weaponmode "<<multi_cast<std::string>(k-1)<<std::endl;
     1156                    COUT(0)<<wMode->getIdentifier()->getName()<<": weaponpack "+multi_cast<std::string>(i-1)<<", weapon "<<multi_cast<std::string>(j-1)<<", weaponmode "<<multi_cast<std::string>(k-1)<<std::endl;
    11541157                }
    11551158            }
  • code/branches/ai2/src/orxonox/controllers/Controller.cc

    r8735 r8758  
    4242        this->controllableEntity_ = 0;
    4343        this->bGodMode_ = false;
    44         this->bDeathFlag_ = false;
    4544    }
    4645
  • code/branches/ai2/src/orxonox/controllers/Controller.h

    r8735 r8758  
    6363            inline ControllableEntity* getControllableEntity() const
    6464                { return this->controllableEntity_; }
    65             inline void setDeathFlag()
    66                 { this->bDeathFlag_ = true; }
    67             inline void resetDeathFlag()
    68                 { this->bDeathFlag_ = false; }
    6965            virtual void changedControllableEntity() {}
    7066
     
    8379            PlayerInfo* player_;
    8480            ControllableEntity* controllableEntity_;
    85             bool bDeathFlag_; //<! Signal, when a controlled entity died. Flag is set in Pawn.cc and used in AIController.
    8681        private:
    8782            bool bGodMode_;
  • code/branches/ai2/src/orxonox/worldentities/pawns/Pawn.cc

    r8735 r8758  
    9494
    9595        this->isHumanShip_ = this->hasLocalController();
    96        
     96
    9797        this->setSyncMode(ObjectDirection::Bidirectional); // needed to synchronise e.g. aimposition
    9898    }
     
    304304        if (this->getGametype() && this->getGametype()->allowPawnDeath(this, this->lastHitOriginator_))
    305305        {
    306             if ( this->getController()&& (!this->isHumanShip_) ) //announce death to the ai
    307             {
    308                  this->getController()->setDeathFlag();
    309             }
    310306            // Set bAlive_ to false and wait for PawnManager to do the destruction
    311307            this->bAlive_ = false;
Note: See TracChangeset for help on using the changeset viewer.