[Orxonox-commit 4606] r9277 - code/branches/presentation2012merge/src/orxonox/worldentities/pawns

landauf at orxonox.net landauf at orxonox.net
Mon Jun 4 21:40:54 CEST 2012


Author: landauf
Date: 2012-06-04 21:40:54 +0200 (Mon, 04 Jun 2012)
New Revision: 9277

Modified:
   code/branches/presentation2012merge/src/orxonox/worldentities/pawns/Pawn.cc
   code/branches/presentation2012merge/src/orxonox/worldentities/pawns/Pawn.h
Log:
small cleanup of damage multiplier: added 'const' to getter and removed unnecessary dynamic_cast

Modified: code/branches/presentation2012merge/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/presentation2012merge/src/orxonox/worldentities/pawns/Pawn.cc	2012-06-03 20:38:57 UTC (rev 9276)
+++ code/branches/presentation2012merge/src/orxonox/worldentities/pawns/Pawn.cc	2012-06-04 19:40:54 UTC (rev 9277)
@@ -230,12 +230,8 @@
 
     void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator)
     {
-        //Applies multiplier given by the DamageBoost Pickup.
-        Pawn *test = dynamic_cast<Pawn *>(originator);
-        if( test != NULL )
-        {
-            damage *= originator->getDamageMultiplier();
-        }
+        // Applies multiplier given by the DamageBoost Pickup.
+        damage *= originator->getDamageMultiplier();
 
         if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
         {

Modified: code/branches/presentation2012merge/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/presentation2012merge/src/orxonox/worldentities/pawns/Pawn.h	2012-06-03 20:38:57 UTC (rev 9276)
+++ code/branches/presentation2012merge/src/orxonox/worldentities/pawns/Pawn.h	2012-06-04 19:40:54 UTC (rev 9277)
@@ -164,7 +164,7 @@
             // These are used with the Damage Boost Pickup to use the damage multiplier.
             inline void setDamageMultiplier(float multiplier)
                 { this->damageMultiplier_ = multiplier; }
-            inline float getDamageMultiplier()
+            inline float getDamageMultiplier() const
                 { return this->damageMultiplier_; }
 
 
@@ -209,13 +209,12 @@
             float shieldHealth_;
             float maxShieldHealth_;
             float initialShieldHealth_;
-            float shieldAbsorption_; // Has to be between 0 and 1
+            float shieldAbsorption_; ///< Has to be between 0 and 1
             float reloadRate_;
             float reloadWaitTime_;
             float reloadWaitCountdown_;
 
-            // Modifier
-            float damageMultiplier_; // Used by the Damage Boost Pickup.
+            float damageMultiplier_; ///< Used by the Damage Boost Pickup.
 
             WeakPtr<Pawn> lastHitOriginator_;
 




More information about the Orxonox-commit mailing list