Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 30, 2015, 11:07:34 PM (8 years ago)
Author:
gania
Message:

fixed pointers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/AI_HS15/src/orxonox/controllers/SectionController.cc

    r10722 r10725  
    3838    {
    3939        RegisterObject(SectionController);
     40                this->setFormationMode(WALL);
     41
    4042        bIsDivisionLeader_ = false;
    4143        this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&SectionController::action, this)));
    42 
     44        this->myWingman_ = 0;
     45        this->myDivisionLeader_ = 0;
     46        this->desiredRelativePosition_ = 0;
     47
     48        orxout(internal_error) << this << "Was created" << endl;
    4349
    4450    }
     
    4652    SectionController::~SectionController()
    4753    {
    48         if (this->isInitialized())
    49         {
    50             if (this->myDivisionLeader_)
    51                 this->myDivisionLeader_->myFollower_ = 0;
    52             if(this->myWingman_)
    53                 this->myWingman_->myLeader_ = 0;
    54         }
    55     }
    56    
     54       
     55    }
     56    /*void SectionController::setDesiredPositionOfWingman()
     57    {
     58        if (!this->myWingman_)
     59            return;
     60
     61        switch (this->formationMode_){
     62            case WALL:
     63            {
     64                myWingman_->desiredRelativePosition_ = new Vector3 (-200, 0, 0);   
     65                break;
     66            }
     67            case FINGER4:
     68            {
     69                break;
     70            }
     71            case VEE:
     72            {
     73                break;
     74            }
     75            case DIAMOND:
     76            {
     77                break;
     78            }
     79        }
     80       
     81    }
     82*/
    5783    LeaderController* SectionController::findNewDivisionLeader()
    5884    {
     
    112138            LeaderController* newDivisionLeader = findNewDivisionLeader();
    113139            this->myDivisionLeader_ = newDivisionLeader;
    114             /*if (newDivisionLeader)
     140            if (newDivisionLeader)
    115141                orxout(internal_error) << "new DivisionLeader set" << endl;
    116             else
    117                 orxout(internal_error) << "0 division leader" << endl;*/
    118         }
    119     }
     142
     143        }
     144/*        setDesiredPositionOfWingman();
     145*/    }
    120146    /*
    121147    Wingmen and Leaders attack target_, which is a member variable of their classes.
     
    132158
    133159    */
     160   /* void SectionController::keepDivisionTick()
     161    {
     162
     163
     164        if (this->myDivisionLeader_ && this->myDivisionLeader_->getControllableEntity() && desiredRelativePosition_)
     165        {
     166
     167            Vector3 desiredAbsolutePosition = ((this->myDivisionLeader_->getControllableEntity()->getWorldPosition()) +
     168                (this->myDivisionLeader_->getControllableEntity()->getWorldOrientation()* (*desiredRelativePosition_)));
     169            this->moveToPosition (desiredAbsolutePosition);
     170        }
     171    }*/
    134172    void SectionController::tick(float dt)
    135     {/*
     173    {
     174       
     175
     176       /*
    136177        if (!this->isActive())
    137178            return;
    138179       
    139180        //--------------------------Stay in division--------------------------
    140         this->keepDivisionTick();*/
    141         /*keepDivisionTick(){
    142             if (this->divisionLeader_ && this->divisionLeader_->getControllableEntity() && desiredRelativePosition_){
    143                 Vector3 desiredAbsolutePosition = ((this->divisionLeader_->getControllableEntity()->getWorldPosition()) +
    144                     (this->divisionLeader_->getControllableEntity()->getWorldOrientation()* (*desiredRelativePosition_)));
    145                 this->moveToPosition (desiredAbsolutePosition);
    146             }
    147         }
     181        this->keepDivisionTick();
    148182        */
    149         /*//If ordered to attack -> follow target and shoot
    150         if (this->bAttackOrder_)
    151         {
    152  
    153         }
    154183        //If ordered to move -> move to a target Point
    155184       
    156185        //No orders -> Don't move, but shoot at whatever is close, unless Boss is shooting at it.
    157186        //(Section shoots same target, Boss's section shoots another target)
    158         {
    159 
    160         }*/
     187       
    161188
    162189        //orxout(internal_error) << "my Wingman is " << this->myWingman_ << endl;
Note: See TracChangeset for help on using the changeset viewer.