Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8792 for code/branches


Ignore:
Timestamp:
Jul 27, 2011, 9:21:29 PM (13 years ago)
Author:
jo
Message:

Yeay, works. The pickuping efficiency isn't as good as expected though.

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

Legend:

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

    r8791 r8792  
    241241                WorldEntity* wPoint = this->waypoints_[this->waypoints_.size()-1];
    242242                if(wPoint)
     243                {
    243244                    this->moveToPosition(wPoint->getWorldPosition()); //BUG ?? sometime wPoint->getWorldPosition() causes crash
    244                 if (wPoint->getWorldPosition().squaredDistance(controllable->getPosition()) <= this->squaredaccuracy_)
    245                     this->waypoints_.pop_back(); // if goal is reached, remove it from the list
     245                    if (wPoint->getWorldPosition().squaredDistance(controllable->getPosition()) <= this->squaredaccuracy_)
     246                        this->waypoints_.pop_back(); // if goal is reached, remove it from the list
     247                }
     248                else
     249                    this->waypoints_.pop_back(); // remove invalid waypoints
    246250
    247251            }
  • code/branches/ai2/src/orxonox/controllers/ArtificialController.cc

    r8791 r8792  
    105105        {//Vector-implementation: mode_.erase(mode_.begin(),mode_.end());
    106106            for (size_t i = 0; i < this->waypoints_.size(); ++i)
    107                 this->waypoints_[i]->destroy();
     107            {
     108                if(this->waypoints_[i])
     109                    this->waypoints_[i]->destroy();
     110            }
     111            //this->waypoints_.clear();
    108112            this->removeFromFormation();
    109113            this->weaponModes_.clear();
     
    11961200    {
    11971201        if(!defaultWaypoint_)
    1198             this->updatePointsOfInterest("PickupSpawner", 60.0f); // long search radius if there is no default goal
     1202            this->updatePointsOfInterest("PickupSpawner", 200.0f); // long search radius if there is no default goal
    11991203        else
    12001204            this->updatePointsOfInterest("PickupSpawner", 20.0f); // take pickup en passant if there is a default waypoint
  • code/branches/ai2/src/orxonox/controllers/ArtificialController.h

    r8786 r8792  
    173173
    174174            //WAYPOINT DATA
    175             std::vector<WorldEntity*> waypoints_;
     175            std::vector<WeakPtr<WorldEntity> > waypoints_;
    176176            size_t currentWaypoint_;
    177177            float squaredaccuracy_;
Note: See TracChangeset for help on using the changeset viewer.