[Orxonox-commit 6277] r10934 - code/branches/campaignHS15/src/orxonox/controllers

gania at orxonox.net gania at orxonox.net
Mon Dec 7 14:49:47 CET 2015


Author: gania
Date: 2015-12-07 14:49:46 +0100 (Mon, 07 Dec 2015)
New Revision: 10934

Modified:
   code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc
   code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.h
   code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc
   code/branches/campaignHS15/src/orxonox/controllers/FightingController.h
Log:
fixed bugs that are not supposed to even exist by initializing a variable in the constructor

Modified: code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc	2015-12-07 13:49:30 UTC (rev 10933)
+++ code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc	2015-12-07 13:49:46 UTC (rev 10934)
@@ -39,6 +39,9 @@
 
     ActionpointController::ActionpointController(Context* context) : FightingController(context)
     {
+        this->actionpointControllerId_ = 0;
+        ActionpointController::sTicks_ = 0;
+        ActionpointController::nextActionpointControllerId_ = 0;
         this->ticks_ = 0;
         this->bPatrolling_ = false;
         this->bInLoop_ = false;
@@ -47,7 +50,6 @@
         loopActionpoints_.clear();
         parsedActionpoints_.clear();
         actionpoints_.clear();
-
         this->bTakenOver_ = false;
         this->action_ = Action::NONE;
         this->squaredaccuracy_ = 2500;
@@ -91,9 +93,10 @@
         loopActionpoints_.clear();
         parsedActionpoints_.clear();
         actionpoints_.clear();
-        ActionpointController::nextActionpointControllerId_--;
+        this->actionpointControllerId_ = 0;
+        /*ActionpointController::nextActionpointControllerId_--;
         if (ActionpointController::nextActionpointControllerId_ < 0)
-            ActionpointController::nextActionpointControllerId_ = 0;
+            ActionpointController::nextActionpointControllerId_ = 0;*/
     }
     void ActionpointController::tick(float dt)
     {
@@ -120,10 +123,10 @@
             {
                 this->action_ = Action::FIGHTALL;
             }
+            //orxout (internal_error) << "first tick was called by id = " << this->actionpointControllerId_ << ", total = " << ActionpointController::nextActionpointControllerId_ << endl;
         }
         if (ActionpointController::sTicks_ == 1)
         {    
-            this->timeOffset_ = 0.0f;
             this->bActionCalled_ = false;
             
             this->bFirstTick_ = false;
@@ -151,9 +154,7 @@
         if (stop_)
             return;
         
-        this->timeOffset_ += dt;
-        if (this->timeOffset_ >= 2.4f)
-            this->timeOffset_ = 0.0f;
+
         if (timeout_ <= 0)
             this->bFiredRocket_ = false;
         
@@ -162,7 +163,7 @@
             return;
         if (this->timeout_ > 0 && this->bFiredRocket_)
         {
-            this->timeout_ -= dt;
+            --this->timeout_;
         }
    
 
@@ -187,8 +188,9 @@
 
         if (!this || !this->getControllableEntity())
             return;
-
-        if (this->hasTarget() &&  ActionpointController::sTicks_ % (ActionpointController::nextActionpointControllerId_ + 1) == (this->actionpointControllerId_))
+       /* orxout (internal_error) << "id = " << this->actionpointControllerId_ << ", in total # ids = " << ActionpointController::nextActionpointControllerId_ 
+        << ", I " << (this->hasTarget() ? "have" : "don't have") << " a target, my team is " << this->getControllableEntity()->getTeam() << endl;
+       */ if (this->hasTarget() &&  ActionpointController::sTicks_ % (ActionpointController::nextActionpointControllerId_ + 1) == (this->actionpointControllerId_))
         {
 
          

Modified: code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.h	2015-12-07 13:49:30 UTC (rev 10933)
+++ code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.h	2015-12-07 13:49:46 UTC (rev 10934)
@@ -251,7 +251,6 @@
                 std::multimap <int, std::pair<PickupSpawner*, bool> > damageSpawners_; 
                 std::multimap <int, std::pair<PickupSpawner*, bool> > speedSpawners_; 
 */
-                float timeOffset_;
                 bool bActionCalled_;
                 bool bManeuverCalled_;
                 bool bDefaultFightAll_;

Modified: code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc	2015-12-07 13:49:30 UTC (rev 10933)
+++ code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc	2015-12-07 13:49:46 UTC (rev 10934)
@@ -335,7 +335,7 @@
         }
         if (firemode == getFiremode("RocketFire"))
         {
-            this->timeout_ = 0.5f;
+            this->timeout_ = 5;
             this->rocketsLeft_--;
             this->bFiredRocket_ = true;
         }

Modified: code/branches/campaignHS15/src/orxonox/controllers/FightingController.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/FightingController.h	2015-12-07 13:49:30 UTC (rev 10933)
+++ code/branches/campaignHS15/src/orxonox/controllers/FightingController.h	2015-12-07 13:49:46 UTC (rev 10934)
@@ -90,7 +90,7 @@
             bool bStartedDodging_;
             //WEAPONSYSTEM DATA
             int rocketsLeft_;
-            float timeout_;
+            int timeout_;
             bool bFiredRocket_;
             std::map<std::string, int> weaponModes_; //<! Links each "weapon" to it's weaponmode - managed by setupWeapons()
             //std::vector<int> projectiles_; //<! Displays amount of projectiles of each weapon. - managed by setupWeapons()




More information about the Orxonox-commit mailing list