[Orxonox-commit 3914] r8588 - in code/branches/bigships/src/orxonox: gametypes items worldentities worldentities/pawns

dafrick at orxonox.net dafrick at orxonox.net
Thu May 26 00:04:43 CEST 2011


Author: dafrick
Date: 2011-05-26 00:04:42 +0200 (Thu, 26 May 2011)
New Revision: 8588

Modified:
   code/branches/bigships/src/orxonox/gametypes/Dynamicmatch.cc
   code/branches/bigships/src/orxonox/gametypes/Dynamicmatch.h
   code/branches/bigships/src/orxonox/items/Engine.cc
   code/branches/bigships/src/orxonox/items/Engine.h
   code/branches/bigships/src/orxonox/worldentities/MobileEntity.cc
   code/branches/bigships/src/orxonox/worldentities/MobileEntity.h
   code/branches/bigships/src/orxonox/worldentities/pawns/SpaceShip.cc
   code/branches/bigships/src/orxonox/worldentities/pawns/SpaceShip.h
Log:
Converting tabs to spaces.


Modified: code/branches/bigships/src/orxonox/gametypes/Dynamicmatch.cc
===================================================================
--- code/branches/bigships/src/orxonox/gametypes/Dynamicmatch.cc	2011-05-25 21:44:04 UTC (rev 8587)
+++ code/branches/bigships/src/orxonox/gametypes/Dynamicmatch.cc	2011-05-25 22:04:42 UTC (rev 8588)
@@ -150,7 +150,7 @@
 
                 //Give new pig boost
                 SpaceShip* spaceship = dynamic_cast<SpaceShip*>(victim);
-				grantPigBoost(spaceship);
+                grantPigBoost(spaceship);
             }
 
             //Case: notEnoughKillers: party change
@@ -305,9 +305,9 @@
         else return false;
     }
 
-	void Dynamicmatch::grantPigBoost(orxonox::SpaceShip* spaceship)
-	{
-		// Give pig boost
+    void Dynamicmatch::grantPigBoost(orxonox::SpaceShip* spaceship)
+    {
+        // Give pig boost
         if (spaceship)
         {
             spaceship->setSpeedFactor(5);
@@ -316,7 +316,7 @@
             executor->setDefaultValue(0, ptr);
             new Timer(10, false, executor, true);
         }
-	}
+    }
 
     void Dynamicmatch::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) //set party + colouring
     {

Modified: code/branches/bigships/src/orxonox/gametypes/Dynamicmatch.h
===================================================================
--- code/branches/bigships/src/orxonox/gametypes/Dynamicmatch.h	2011-05-25 21:44:04 UTC (rev 8587)
+++ code/branches/bigships/src/orxonox/gametypes/Dynamicmatch.h	2011-05-25 22:04:42 UTC (rev 8588)
@@ -72,7 +72,7 @@
             /*virtual void instructions();
             virtual void furtherInstructions();*/
             virtual void rewardPig();
-			void grantPigBoost(SpaceShip* spaceship); // Added this, since it's used twice on different occasions.
+            void grantPigBoost(SpaceShip* spaceship); // Added this, since it's used twice on different occasions.
             void resetSpeedFactor(WeakPtr<SpaceShip>* ptr);
             void tick (float dt);// used to end the game
             SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const;

Modified: code/branches/bigships/src/orxonox/items/Engine.cc
===================================================================
--- code/branches/bigships/src/orxonox/items/Engine.cc	2011-05-25 21:44:04 UTC (rev 8587)
+++ code/branches/bigships/src/orxonox/items/Engine.cc	2011-05-25 22:04:42 UTC (rev 8588)
@@ -46,7 +46,7 @@
 
         this->ship_ = 0;
         this->shipID_ = OBJECTID_UNKNOWN;
-		this->relativePosition_ = Vector3(0,0,0);
+        this->relativePosition_ = Vector3(0,0,0);
 
         this->boostFactor_ = 1.5;
         this->speedFactor_ = 1.0;
@@ -71,13 +71,7 @@
 
     Engine::~Engine()
     {
-        if (this->isInitialized() && this->ship_)
-        {
-            //this->ship_->setEngine(0);
 
-            //if (this->boostBlur_)
-            //    this->boostBlur_->destroy();
-        }
     }
 
     void Engine::XMLPort(Element& xmlelement, XMLPort::Mode mode)
@@ -97,8 +91,8 @@
         XMLPortParam(Engine, "accelerationleftright", setAccelerationLeftRight, setAccelerationLeftRight, xmlelement, mode);
         XMLPortParam(Engine, "accelerationupdown",    setAccelerationUpDown,    setAccelerationUpDown,    xmlelement, mode);
 
-		XMLPortParam(Engine, "position", setRelativePosition, getRelativePosition, xmlelement, mode);
-		XMLPortParam(Engine, "template", setEngineTemplate, getEngineTemplate, xmlelement, mode);
+        XMLPortParam(Engine, "position", setRelativePosition, getRelativePosition, xmlelement, mode);
+        XMLPortParam(Engine, "template", setEngineTemplate, getEngineTemplate, xmlelement, mode);
     }
 
     void Engine::setConfigValues()
@@ -198,17 +192,16 @@
                 acceleration.y = direction.y * this->accelerationUpDown_ * clamp((this->maxSpeedUpDown_ - velocity.y) / this->maxSpeedUpDown_, 0.0f, 1.0f);
         }
 
-		// NOTE: Bullet always uses global coordinates.
+        // NOTE: Bullet always uses global coordinates.
         this->ship_->addAcceleration(this->ship_->getOrientation() * (acceleration*this->getSpeedMultiply()+Vector3(0,0,-this->getSpeedAdd())), this->ship_->getOrientation() * this->relativePosition_);
 
-
-		// Hack to reset a temporary variable "direction"
-		this->ship_->oneEngineTickDone();
-		if(!this->ship_->hasEngineTicksRemaining())
-		{
-			this->ship_->setSteeringDirection(Vector3::ZERO);
-			this->ship_->resetEngineTicks();
-		}
+        // Hack to reset a temporary variable "direction"
+        this->ship_->oneEngineTickDone();
+        if(!this->ship_->hasEngineTicksRemaining())
+        {
+            this->ship_->setSteeringDirection(Vector3::ZERO);
+            this->ship_->resetEngineTicks();
+        }
     }
 
     void Engine::changedActivity()
@@ -246,16 +239,16 @@
         return this->ship_->getWorldPosition();
     }
 
-	void Engine::loadEngineTemplate()
-	{
-		if(!this->engineTemplate_.empty())
-		{
-			COUT(4)<<"Loading an engine template: "<<this->engineTemplate_<<"\n";
-			Template *temp = Template::getTemplate(this->engineTemplate_);
-			if(temp)
-			{
-				this->addTemplate(temp);
-			}
-		}
-	}
+    void Engine::loadEngineTemplate()
+    {
+        if(!this->engineTemplate_.empty())
+        {
+            COUT(4)<<"Loading an engine template: "<<this->engineTemplate_<<"\n";
+            Template *temp = Template::getTemplate(this->engineTemplate_);
+            if(temp)
+            {
+                this->addTemplate(temp);
+            }
+        }
+    }
 }

Modified: code/branches/bigships/src/orxonox/items/Engine.h
===================================================================
--- code/branches/bigships/src/orxonox/items/Engine.h	2011-05-25 21:44:04 UTC (rev 8587)
+++ code/branches/bigships/src/orxonox/items/Engine.h	2011-05-25 22:04:42 UTC (rev 8588)
@@ -54,10 +54,10 @@
             inline SpaceShip* getShip() const
                 { return this->ship_; }
 
-			inline void setRelativePosition(const Vector3 &position)
-				{ this->relativePosition_ = position; }
-			inline Vector3& getRelativePosition()
-				{ return this->relativePosition_; }
+            inline void setRelativePosition(const Vector3 &position)
+                { this->relativePosition_ = position; }
+            inline Vector3& getRelativePosition()
+                { return this->relativePosition_; }
 
             inline void setBoostFactor(float factor)
                 { this->boostFactor_ = factor; }
@@ -123,7 +123,7 @@
             inline void setSpeedMultiply(float speedMultiply)
                 { this->speedMultiply_=speedMultiply; }
 
-			
+            
             inline void setEngineTemplate(const std::string& temp)
                 { this->engineTemplate_ = temp; this->loadEngineTemplate(); }
             inline const std::string& getEngineTemplate() const
@@ -133,18 +133,18 @@
             virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const
                 { return new std::vector<PickupCarrier*>(); }
             virtual PickupCarrier* getCarrierParent(void) const;
-			
+            
             void loadEngineTemplate();
 
         private:
             void registerVariables();
             void networkcallback_shipID();
 
-			std::string engineTemplate_;
+            std::string engineTemplate_;
 
             SpaceShip* ship_;
             unsigned int shipID_;
-			Vector3 relativePosition_;
+            Vector3 relativePosition_;
 
             float boostFactor_;
             float speedFactor_;

Modified: code/branches/bigships/src/orxonox/worldentities/MobileEntity.cc
===================================================================
--- code/branches/bigships/src/orxonox/worldentities/MobileEntity.cc	2011-05-25 21:44:04 UTC (rev 8587)
+++ code/branches/bigships/src/orxonox/worldentities/MobileEntity.cc	2011-05-25 22:04:42 UTC (rev 8588)
@@ -142,21 +142,21 @@
     void MobileEntity::setAcceleration(const Vector3& acceleration)
     {
         if (this->isDynamic())
-		{
+        {
             this->physicalBody_->applyCentralForce(btVector3(acceleration.x * this->getMass(), acceleration.y * this->getMass(), acceleration.z * this->getMass()));
-		}
+        }
 
-		// If not bullet-managed (deprecated? SpaceShip doesn't use this anymore for movement)
+        // If not bullet-managed (deprecated? SpaceShip doesn't use this anymore for movement)
         this->linearAcceleration_ = acceleration;
     }
 
-	void MobileEntity::addAcceleration(const Vector3 &acceleration, const Vector3 &relativePosition)
-	{
-		if(this->isDynamic())
-		{
-			this->physicalBody_->applyForce(this->getMass() * btVector3(acceleration.x, acceleration.y, acceleration.z), btVector3(relativePosition.x, relativePosition.y, relativePosition.z));
-		}
-	}
+    void MobileEntity::addAcceleration(const Vector3 &acceleration, const Vector3 &relativePosition)
+    {
+        if(this->isDynamic())
+        {
+            this->physicalBody_->applyForce(this->getMass() * btVector3(acceleration.x, acceleration.y, acceleration.z), btVector3(relativePosition.x, relativePosition.y, relativePosition.z));
+        }
+    }
 
     void MobileEntity::setAngularAcceleration(const Vector3& acceleration)
     {

Modified: code/branches/bigships/src/orxonox/worldentities/MobileEntity.h
===================================================================
--- code/branches/bigships/src/orxonox/worldentities/MobileEntity.h	2011-05-25 21:44:04 UTC (rev 8587)
+++ code/branches/bigships/src/orxonox/worldentities/MobileEntity.h	2011-05-25 22:04:42 UTC (rev 8588)
@@ -69,11 +69,11 @@
             inline const Vector3& getAcceleration() const
                 { return this->linearAcceleration_; }
 
-			// Added for making N engines work with spaceships
-			void addAcceleration(const Vector3& acceleration, const Vector3 &relativePosition);
-			inline void addAcceleration(float x, float y, float z)
-				{ this->addAcceleration(Vector3(x, y, z), Vector3(0,0,0)); }
-			// Getter function above
+            // Added for making N engines work with spaceships
+            void addAcceleration(const Vector3& acceleration, const Vector3 &relativePosition);
+            inline void addAcceleration(float x, float y, float z)
+                { this->addAcceleration(Vector3(x, y, z), Vector3(0,0,0)); }
+            // Getter function above
 
             void setAngularAcceleration(const Vector3& acceleration);
             inline void setAngularAcceleration(float x, float y, float z)

Modified: code/branches/bigships/src/orxonox/worldentities/pawns/SpaceShip.cc
===================================================================
--- code/branches/bigships/src/orxonox/worldentities/pawns/SpaceShip.cc	2011-05-25 21:44:04 UTC (rev 8587)
+++ code/branches/bigships/src/orxonox/worldentities/pawns/SpaceShip.cc	2011-05-25 22:04:42 UTC (rev 8588)
@@ -76,7 +76,7 @@
         // Get notification about collisions
         this->enableCollisionCallback();
 
-		this->engineTicksNotDone = 0;
+        this->engineTicksNotDone = 0;
         this->setConfigValues();
         this->registerVariables();
     }
@@ -86,7 +86,7 @@
         if (this->isInitialized())
         {
             this->removeAllEngines();
-		
+        
             if (this->boostBlur_)
                 this->boostBlur_->destroy();
         }
@@ -105,7 +105,7 @@
         XMLPortParamVariable(SpaceShip, "boostRate", boostRate_, xmlelement, mode);
         XMLPortParamVariable(SpaceShip, "boostCooldownDuration", boostCooldownDuration_, xmlelement, mode);
 
-		XMLPortObject(SpaceShip, Engine, "engines", addEngine, getEngine, xmlelement, mode);
+        XMLPortObject(SpaceShip, Engine, "engines", addEngine, getEngine, xmlelement, mode);
     }
 
     void SpaceShip::registerVariables()
@@ -122,7 +122,7 @@
     void SpaceShip::setConfigValues()
     {
         SetConfigValue(bInvertYAxis_, false).description("Set this to true for joystick-like mouse behaviour (mouse up = ship down).");
-		
+        
         SetConfigValueExternal(bEnableMotionBlur_, "GraphicsSettings", "enableMotionBlur", true)
             .description("Enable or disable the motion blur effect when moving very fast")
             .callback(this, &SpaceShip::changedEnableMotionBlur);
@@ -148,7 +148,7 @@
 
         if (this->hasLocalController())
         {
-			// Handle mouse look
+            // Handle mouse look
             if (!this->isInMouseLook())
             {
                 this->localAngularAcceleration_ *= this->getLocalInertia() * this->rotationThrust_;
@@ -156,12 +156,12 @@
             }
             this->localAngularAcceleration_.setValue(0, 0, 0);
 
-			// Charge boostPower
+            // Charge boostPower
             if(!this->bBoostCooldown_ && this->boostPower_ < this->initialBoostPower_)
             {
                 this->boostPower_ += this->boostPowerRate_*dt;
             }
-			// Use boostPower
+            // Use boostPower
             if(this->bBoost_)
             {
                 this->boostPower_ -=this->boostRate_*dt;
@@ -173,26 +173,26 @@
                 }
             }
 
-			// Enable Blur depending on settings
-			if (this->bEnableMotionBlur_ && !this->boostBlur_ && this->hasLocalController() && this->hasHumanController())
-			{
-				this->boostBlur_ = new Shader(this->getScene()->getSceneManager());
-				this->boostBlur_->setCompositorName("Radial Blur");
-			}
+            // Enable Blur depending on settings
+            if (this->bEnableMotionBlur_ && !this->boostBlur_ && this->hasLocalController() && this->hasHumanController())
+            {
+                this->boostBlur_ = new Shader(this->getScene()->getSceneManager());
+                this->boostBlur_->setCompositorName("Radial Blur");
+            }
 
-			if (this->boostBlur_) // && this->maxSpeedFront_ != 0 && this->boostFactor_ != 1)
-			{
-				// TODO: this->maxSpeedFront_ gets fastest engine
-				float blur = this->blurStrength_ * clamp((-this->getLocalVelocity().z - 0.0f /*this->maxSpeedFront_*/) / ((150.0f /*boostFactor_*/ - 1) * 1.5f /*this->maxSpeedFront_*/), 0.0f, 1.0f);
+            if (this->boostBlur_) // && this->maxSpeedFront_ != 0 && this->boostFactor_ != 1)
+            {
+                // TODO: this->maxSpeedFront_ gets fastest engine
+                float blur = this->blurStrength_ * clamp((-this->getLocalVelocity().z - 0.0f /*this->maxSpeedFront_*/) / ((150.0f /*boostFactor_*/ - 1) * 1.5f /*this->maxSpeedFront_*/), 0.0f, 1.0f);
 
-				// Show and hide blur effect depending on state of booster
-				if(this->bBoost_)
-					this->boostBlur_->setVisible(blur > 0);
-				else
-					this->boostBlur_->setVisible(false);
+                // Show and hide blur effect depending on state of booster
+                if(this->bBoost_)
+                    this->boostBlur_->setVisible(blur > 0);
+                else
+                    this->boostBlur_->setVisible(false);
 
-				this->boostBlur_->setParameter(0, 0, "sampleStrength", blur);
-			}
+                this->boostBlur_->setParameter(0, 0, "sampleStrength", blur);
+            }
         }
     }
 
@@ -258,76 +258,76 @@
             this->bBoost_ = false;
     }
 
-	void SpaceShip::addEngine(orxonox::Engine* engine)
-	{
-		//COUT(0)<<"Adding an Engine: " << engine << endl;
-		this->engineList_.push_back(engine);
-		engine->addToSpaceShip(this);
-		this->resetEngineTicks();
-	}
-	bool SpaceShip::hasEngine(Engine* engine)
-	{
-		for(unsigned int i=0; i<this->engineList_.size(); i++)
-		{
-			if(this->engineList_[i]==engine)
-				return true;
-		}
-		return false;
-	}
-	Engine* SpaceShip::getEngine(unsigned int i)
-	{
-		if(this->engineList_.size()>=i)
-			return 0;
-		else
-			return this->engineList_[i];
-	}
-	void SpaceShip::removeAllEngines()
-	{
-		for(unsigned int i=0; i<this->engineList_.size(); i++)
-			this->engineList_[i]->~Engine();
-	}
+    void SpaceShip::addEngine(orxonox::Engine* engine)
+    {
+        //COUT(0)<<"Adding an Engine: " << engine << endl;
+        this->engineList_.push_back(engine);
+        engine->addToSpaceShip(this);
+        this->resetEngineTicks();
+    }
+    bool SpaceShip::hasEngine(Engine* engine)
+    {
+        for(unsigned int i=0; i<this->engineList_.size(); i++)
+        {
+            if(this->engineList_[i]==engine)
+                return true;
+        }
+        return false;
+    }
+    Engine* SpaceShip::getEngine(unsigned int i)
+    {
+        if(this->engineList_.size()>=i)
+            return 0;
+        else
+            return this->engineList_[i];
+    }
+    void SpaceShip::removeAllEngines()
+    {
+        for(unsigned int i=0; i<this->engineList_.size(); i++)
+            this->engineList_[i]->~Engine();
+    }
 
-	void SpaceShip::setSpeedFactor(float factor)
-	{
-		for(unsigned int i=0; i<this->engineList_.size(); i++)
-			this->engineList_[i]->setSpeedFactor(factor);
-	}
-	float SpaceShip::getSpeedFactor() // Calculate mean SpeedFactor.
-	{
-		float ret = 0; unsigned int i = 0;
-		for(; i<this->engineList_.size(); i++)
-			ret += this->engineList_[i]->getSpeedFactor();
-		ret /= (float)i;
-		return ret;
-	}
-	float SpaceShip::getMaxSpeedFront()
-	{
-		float ret=0;
-		for(unsigned int i=0; i<this->engineList_.size(); i++)
-		{
-			if(this->engineList_[i]->getMaxSpeedFront() > ret)
-				ret = this->engineList_[i]->getMaxSpeedFront();
-		}
-		return ret;
-	}
-	float SpaceShip::getBoostFactor()
-	{
-		float ret = 0; unsigned int i=0;
-		for(; i<this->engineList_.size(); i++)
-			ret += this->engineList_[i]->getBoostFactor();
-		ret /= (float)i;
-		return ret;
-	}
+    void SpaceShip::setSpeedFactor(float factor)
+    {
+        for(unsigned int i=0; i<this->engineList_.size(); i++)
+            this->engineList_[i]->setSpeedFactor(factor);
+    }
+    float SpaceShip::getSpeedFactor() // Calculate mean SpeedFactor.
+    {
+        float ret = 0; unsigned int i = 0;
+        for(; i<this->engineList_.size(); i++)
+            ret += this->engineList_[i]->getSpeedFactor();
+        ret /= (float)i;
+        return ret;
+    }
+    float SpaceShip::getMaxSpeedFront()
+    {
+        float ret=0;
+        for(unsigned int i=0; i<this->engineList_.size(); i++)
+        {
+            if(this->engineList_[i]->getMaxSpeedFront() > ret)
+                ret = this->engineList_[i]->getMaxSpeedFront();
+        }
+        return ret;
+    }
+    float SpaceShip::getBoostFactor()
+    {
+        float ret = 0; unsigned int i=0;
+        for(; i<this->engineList_.size(); i++)
+            ret += this->engineList_[i]->getBoostFactor();
+        ret /= (float)i;
+        return ret;
+    }
 
     std::vector<PickupCarrier*>* SpaceShip::getCarrierChildren(void) const
     {
         std::vector<PickupCarrier*>* list = new std::vector<PickupCarrier*>();
-		for(unsigned int i=0; i<this->engineList_.size(); i++)
-			list->push_back(this->engineList_[i]);
+        for(unsigned int i=0; i<this->engineList_.size(); i++)
+            list->push_back(this->engineList_[i]);
         return list;
     }
-	
-	void SpaceShip::changedEnableMotionBlur()
+    
+    void SpaceShip::changedEnableMotionBlur()
     {
         if (!this->bEnableMotionBlur_)
         {

Modified: code/branches/bigships/src/orxonox/worldentities/pawns/SpaceShip.h
===================================================================
--- code/branches/bigships/src/orxonox/worldentities/pawns/SpaceShip.h	2011-05-25 21:44:04 UTC (rev 8587)
+++ code/branches/bigships/src/orxonox/worldentities/pawns/SpaceShip.h	2011-05-25 22:04:42 UTC (rev 8588)
@@ -60,28 +60,28 @@
             virtual void fire();
             virtual void boost(bool bBoost); // Starts or stops boosting.
 
-			void addEngine(Engine* engine);
-			bool hasEngine(Engine* engine);
-			Engine* getEngine(unsigned int i); // This one's for XMLPort
-			inline const std::vector<Engine*>& getEngineList()
-				{ return this->engineList_; }
-			void removeAllEngines();
+            void addEngine(Engine* engine);
+            bool hasEngine(Engine* engine);
+            Engine* getEngine(unsigned int i); // This one's for XMLPort
+            inline const std::vector<Engine*>& getEngineList()
+                { return this->engineList_; }
+            void removeAllEngines();
 
-			void setSpeedFactor(float factor);
-			float getSpeedFactor(); // Gets mean speed factor
-			float getMaxSpeedFront(); // gets largest speed forward
-			float getBoostFactor(); // gets mean boost factor
+            void setSpeedFactor(float factor);
+            float getSpeedFactor(); // Gets mean speed factor
+            float getMaxSpeedFront(); // gets largest speed forward
+            float getBoostFactor(); // gets mean boost factor
 
             inline void setSteeringDirection(const Vector3& direction)
                 { this->steering_ = direction; }
             inline const Vector3& getSteeringDirection() const
                 { return this->steering_; }
-			inline void resetEngineTicks()
-				{ this->engineTicksNotDone = this->engineList_.size(); }
-			inline void oneEngineTickDone()
-				{ this->engineTicksNotDone--; }
-			inline const bool hasEngineTicksRemaining()
-				{ return (this->engineTicksNotDone>0); }
+            inline void resetEngineTicks()
+                { this->engineTicksNotDone = this->engineList_.size(); }
+            inline void oneEngineTickDone()
+                { this->engineTicksNotDone--; }
+            inline const bool hasEngineTicksRemaining()
+                { return (this->engineTicksNotDone>0); }
 
             inline bool getBoost() const
                 { return this->bBoost_; }
@@ -108,16 +108,16 @@
             void registerVariables();
             virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const;
             
-			//All things booster
-			void changedEnableMotionBlur();
+            //All things booster
+            void changedEnableMotionBlur();
             void boostCooledDown(void);
 
-			Shader* boostBlur_;
+            Shader* boostBlur_;
             float blurStrength_;
             bool bEnableMotionBlur_;
 
-			std::vector<Engine*> engineList_;
-			int engineTicksNotDone; // Used for knowing when to reset temporary variables.
+            std::vector<Engine*> engineList_;
+            int engineTicksNotDone; // Used for knowing when to reset temporary variables.
             Timer timer_;
     };
 }




More information about the Orxonox-commit mailing list