Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 7, 2015, 2:49:46 PM (8 years ago)
Author:
gania
Message:

fixed bugs that are not supposed to even exist by initializing a variable in the constructor

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc

    r10927 r10934  
    4040    ActionpointController::ActionpointController(Context* context) : FightingController(context)
    4141    {
     42        this->actionpointControllerId_ = 0;
     43        ActionpointController::sTicks_ = 0;
     44        ActionpointController::nextActionpointControllerId_ = 0;
    4245        this->ticks_ = 0;
    4346        this->bPatrolling_ = false;
     
    4851        parsedActionpoints_.clear();
    4952        actionpoints_.clear();
    50 
    5153        this->bTakenOver_ = false;
    5254        this->action_ = Action::NONE;
     
    9294        parsedActionpoints_.clear();
    9395        actionpoints_.clear();
    94         ActionpointController::nextActionpointControllerId_--;
     96        this->actionpointControllerId_ = 0;
     97        /*ActionpointController::nextActionpointControllerId_--;
    9598        if (ActionpointController::nextActionpointControllerId_ < 0)
    96             ActionpointController::nextActionpointControllerId_ = 0;
     99            ActionpointController::nextActionpointControllerId_ = 0;*/
    97100    }
    98101    void ActionpointController::tick(float dt)
     
    121124                this->action_ = Action::FIGHTALL;
    122125            }
     126            //orxout (internal_error) << "first tick was called by id = " << this->actionpointControllerId_ << ", total = " << ActionpointController::nextActionpointControllerId_ << endl;
    123127        }
    124128        if (ActionpointController::sTicks_ == 1)
    125129        {   
    126             this->timeOffset_ = 0.0f;
    127130            this->bActionCalled_ = false;
    128131           
     
    152155            return;
    153156       
    154         this->timeOffset_ += dt;
    155         if (this->timeOffset_ >= 2.4f)
    156             this->timeOffset_ = 0.0f;
     157
    157158        if (timeout_ <= 0)
    158159            this->bFiredRocket_ = false;
     
    163164        if (this->timeout_ > 0 && this->bFiredRocket_)
    164165        {
    165             this->timeout_ -= dt;
     166            --this->timeout_;
    166167        }
    167168   
     
    188189        if (!this || !this->getControllableEntity())
    189190            return;
    190 
    191         if (this->hasTarget() &&  ActionpointController::sTicks_ % (ActionpointController::nextActionpointControllerId_ + 1) == (this->actionpointControllerId_))
     191       /* orxout (internal_error) << "id = " << this->actionpointControllerId_ << ", in total # ids = " << ActionpointController::nextActionpointControllerId_
     192        << ", I " << (this->hasTarget() ? "have" : "don't have") << " a target, my team is " << this->getControllableEntity()->getTeam() << endl;
     193       */ if (this->hasTarget() &&  ActionpointController::sTicks_ % (ActionpointController::nextActionpointControllerId_ + 1) == (this->actionpointControllerId_))
    192194        {
    193195
Note: See TracChangeset for help on using the changeset viewer.