Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

Location:
code/branches/campaignHS15/src/orxonox/controllers
Files:
4 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
  • code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.h

    r10923 r10934  
    252252                std::multimap <int, std::pair<PickupSpawner*, bool> > speedSpawners_;
    253253*/
    254                 float timeOffset_;
    255254                bool bActionCalled_;
    256255                bool bManeuverCalled_;
  • code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc

    r10927 r10934  
    336336        if (firemode == getFiremode("RocketFire"))
    337337        {
    338             this->timeout_ = 0.5f;
     338            this->timeout_ = 5;
    339339            this->rocketsLeft_--;
    340340            this->bFiredRocket_ = true;
  • code/branches/campaignHS15/src/orxonox/controllers/FightingController.h

    r10927 r10934  
    9191            //WEAPONSYSTEM DATA
    9292            int rocketsLeft_;
    93             float timeout_;
     93            int timeout_;
    9494            bool bFiredRocket_;
    9595            std::map<std::string, int> weaponModes_; //<! Links each "weapon" to it's weaponmode - managed by setupWeapons()
Note: See TracChangeset for help on using the changeset viewer.