[Orxonox-commit 4062] r8733 - in code/branches/ai2/src: modules/weapons/projectiles orxonox/controllers orxonox/worldentities

jo at orxonox.net jo at orxonox.net
Tue Jul 5 23:59:37 CEST 2011


Author: jo
Date: 2011-07-05 23:59:37 +0200 (Tue, 05 Jul 2011)
New Revision: 8733

Modified:
   code/branches/ai2/src/modules/weapons/projectiles/Rocket.cc
   code/branches/ai2/src/orxonox/controllers/AIController.cc
   code/branches/ai2/src/orxonox/controllers/ArtificialController.cc
   code/branches/ai2/src/orxonox/worldentities/ControllableEntity.cc
   code/branches/ai2/src/orxonox/worldentities/ControllableEntity.h
Log:
Further narrowing down. The bug is triggered, when a bot calls fire(3) - whenever a bot launches a rocket.

Modified: code/branches/ai2/src/modules/weapons/projectiles/Rocket.cc
===================================================================
--- code/branches/ai2/src/modules/weapons/projectiles/Rocket.cc	2011-07-05 20:57:40 UTC (rev 8732)
+++ code/branches/ai2/src/modules/weapons/projectiles/Rocket.cc	2011-07-05 21:59:37 UTC (rev 8733)
@@ -57,7 +57,7 @@
 
         this->localAngularVelocity_ = 0;
         this->lifetime_ = 100;
-        this->bIsRocket=true;
+        this->bIsRocket_= true;
 
         if (GameMode::isMaster())
         {
@@ -116,7 +116,7 @@
     {
         if(this->isInitialized())
         {
-            this->bIsRocket=false;
+            this->bIsRocket_= false;
             if (GameMode::isMaster())
             {
                 this->destructionEffect();

Modified: code/branches/ai2/src/orxonox/controllers/AIController.cc
===================================================================
--- code/branches/ai2/src/orxonox/controllers/AIController.cc	2011-07-05 20:57:40 UTC (rev 8732)
+++ code/branches/ai2/src/orxonox/controllers/AIController.cc	2011-07-05 21:59:37 UTC (rev 8733)
@@ -229,8 +229,7 @@
                     if (this->bHasTargetPosition_)
                         this->moveToTargetPosition();
 
-                    if (this->getControllableEntity() && this->bShooting_ && this->isCloseAtTarget(1000) && this->isLookingAtTarget(math::pi / 20.0f))
-                        this->getControllableEntity()->fire(0);
+                    this->doFire();
                 }
 
                 if (this->specificMasterAction_  == TURN180)
@@ -266,8 +265,7 @@
                 if (this->bHasTargetPosition_)
                     this->moveToTargetPosition();
 
-                if (this->getControllableEntity() && this->bShooting_ && this->isCloseAtTarget(1000) && this->isLookingAtTarget(math::pi / 20.0f))
-                    this->getControllableEntity()->fire(0);
+                this->doFire();
             }
         }//END_OF DEFAULT MODE
         else if (this->mode_ == ROCKET)//Rockets do not belong to a group of bots -> bot states are not relevant.

Modified: code/branches/ai2/src/orxonox/controllers/ArtificialController.cc
===================================================================
--- code/branches/ai2/src/orxonox/controllers/ArtificialController.cc	2011-07-05 20:57:40 UTC (rev 8732)
+++ code/branches/ai2/src/orxonox/controllers/ArtificialController.cc	2011-07-05 21:59:37 UTC (rev 8733)
@@ -1048,9 +1048,9 @@
             }
             else if((weapons[3]==3)&& this->isCloseAtTarget(400) /*&&projectiles[3]*/ )
             {//ROCKET: mid range weapon
-                //TODO: Which weapon is the rocket? How many rockets are available?
+                //TODO: How many rockets are available?
                 this->mode_ = ROCKET;//Vector-implementation: mode_.push_back(ROCKET);
-                this->getControllableEntity()->fire(3);//launch rocket
+                this->getControllableEntity()->fire(3);//launch rocket BUG IS TRIGGERED HERE.
                 if(this->getControllableEntity()&&this->target_)//after fire(3) getControllableEntity() refers to the rocket!
                 {
                     float speed = this->getControllableEntity()->getVelocity().length() - target_->getVelocity().length();
@@ -1080,7 +1080,7 @@
             {
                 for(unsigned int i=0; i<WeaponSystem::MAX_WEAPON_MODES; i++)
                 {
-                    const std::string wpn = getWeaponname(i, pawn); COUT(0)<<wpn<< std::endl;//Temporary debug info.
+                    //const std::string wpn = getWeaponname(i, pawn); COUT(0)<<wpn<< std::endl;//Temporary debug info.
                     /*if(wpn=="")
                         weapons[i]=-1;
                     else if(wpn=="LaserMunition")//other munitiontypes are not defined yet :-(

Modified: code/branches/ai2/src/orxonox/worldentities/ControllableEntity.cc
===================================================================
--- code/branches/ai2/src/orxonox/worldentities/ControllableEntity.cc	2011-07-05 20:57:40 UTC (rev 8732)
+++ code/branches/ai2/src/orxonox/worldentities/ControllableEntity.cc	2011-07-05 21:59:37 UTC (rev 8733)
@@ -73,6 +73,7 @@
         this->currentCameraPosition_ = 0;
         this->bMouseLook_ = false;
         this->mouseLookSpeed_ = 200;
+        this->bIsRocket_ = false;
 
         this->server_position_         = Vector3::ZERO;
         this->client_position_         = Vector3::ZERO;

Modified: code/branches/ai2/src/orxonox/worldentities/ControllableEntity.h
===================================================================
--- code/branches/ai2/src/orxonox/worldentities/ControllableEntity.h	2011-07-05 20:57:40 UTC (rev 8732)
+++ code/branches/ai2/src/orxonox/worldentities/ControllableEntity.h	2011-07-05 21:59:37 UTC (rev 8733)
@@ -163,7 +163,7 @@
                 { return this->target_.get(); }
             void setTargetInternal( uint32_t targetID );
             inline bool getRocket() const
-                { return this-> bIsRocket; }
+                { return this-> bIsRocket_; }
 
         protected:
             virtual void preDestroy();
@@ -182,7 +182,7 @@
             void destroyHud(void);
 
             Ogre::SceneNode* cameraPositionRootNode_;
-            bool bIsRocket; //Workaround to see, if the controllable entity is a Rocket.
+            bool bIsRocket_; //Workaround to see, if the controllable entity is a Rocket.
 
         private:
             void registerVariables();




More information about the Orxonox-commit mailing list