[Orxonox-commit 5366] r10029 - in code/branches/modularships: data/levels data/levels/templates src/orxonox/worldentities src/orxonox/worldentities/pawns

noep at orxonox.net noep at orxonox.net
Thu Apr 10 15:45:57 CEST 2014


Author: noep
Date: 2014-04-10 15:45:56 +0200 (Thu, 10 Apr 2014)
New Revision: 10029

Modified:
   code/branches/modularships/data/levels/emptyLevel.oxw
   code/branches/modularships/data/levels/templates/HeavyCruiser.oxt
   code/branches/modularships/src/orxonox/worldentities/WorldEntity.h
   code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
Log:
Fixed a bug where part-entity-assignments were not created.

Modified: code/branches/modularships/data/levels/emptyLevel.oxw
===================================================================
--- code/branches/modularships/data/levels/emptyLevel.oxw	2014-04-10 13:40:57 UTC (rev 10028)
+++ code/branches/modularships/data/levels/emptyLevel.oxw	2014-04-10 13:45:56 UTC (rev 10029)
@@ -97,7 +97,7 @@
       </templates>
     </ModularSpaceShip>
     
-    <ModularSpaceShip position="0,-1000,-200" health="1000" maxhealth="2000" initialhealth="1000">
+    <ModularSpaceShip position="0,-1000,-200" health="2000" maxhealth="4000" initialhealth="2000">
       <templates>
         <Template link=HeavyCruiser />
       </templates>

Modified: code/branches/modularships/data/levels/templates/HeavyCruiser.oxt
===================================================================
--- code/branches/modularships/data/levels/templates/HeavyCruiser.oxt	2014-04-10 13:40:57 UTC (rev 10028)
+++ code/branches/modularships/data/levels/templates/HeavyCruiser.oxt	2014-04-10 13:45:56 UTC (rev 10029)
@@ -10,9 +10,9 @@
    spawnparticleduration  = 3
    explosionchunks        = 6
 
-   health            = 1000
-   maxhealth         = 2000
-   initialhealth     = 1000
+   health            = 2000
+   maxhealth         = 4000
+   initialhealth     = 2000
 
    shieldhealth        = 100
    initialshieldhealth = 30
@@ -50,14 +50,14 @@
     </engines>
     
     <parts>
-        <ShipPart name="frontL" health="100" damageabsorption="0.5" />
-        <ShipPart name="frontR" health="100" damageabsorption="0.5" />
-        <ShipPart name="partL" health="100" damageabsorption="0.5" />
-        <ShipPart name="partR" health="100" damageabsorption="0.5" />
-        <ShipPart name="sidearmL" health="201" damageabsorption="0.2" />
-        <ShipPart name="sidearmLfront" health="100" damageabsorption="0.5" />
-        <ShipPart name="sidearmR" health="200" damageabsorption="0.2" />
-        <ShipPart name="sidearmRfront" health="100" damageabsorption="0.5" />
+        <ShipPart name="frontL" initialhealth="10" damageabsorption="0.5" />
+        <ShipPart name="frontR" initialhealth="10" damageabsorption="0.5" />
+        <ShipPart name="partL" initialhealth="10" damageabsorption="0.5" />
+        <ShipPart name="partR" initialhealth="10" damageabsorption="0.5" />
+        <ShipPart name="sidearmL" initialhealth="20" damageabsorption="0.2" />
+        <ShipPart name="sidearmLfront" initialhealth="10" damageabsorption="0.5" />
+        <ShipPart name="sidearmR" initialhealth="20" damageabsorption="0.2" />
+        <ShipPart name="sidearmRfront" initialhealth="10" damageabsorption="0.5" />
     </parts>
     
     <attached>

Modified: code/branches/modularships/src/orxonox/worldentities/WorldEntity.h
===================================================================
--- code/branches/modularships/src/orxonox/worldentities/WorldEntity.h	2014-04-10 13:40:57 UTC (rev 10028)
+++ code/branches/modularships/src/orxonox/worldentities/WorldEntity.h	2014-04-10 13:45:56 UTC (rev 10029)
@@ -206,6 +206,9 @@
 
             void notifyChildPropsChanged();
 
+            inline int getNumAttachedObj()
+                { return this->children_.size(); }
+
         protected:
             virtual void parentChanged() {}
 

Modified: code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
===================================================================
--- code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc	2014-04-10 13:40:57 UTC (rev 10028)
+++ code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc	2014-04-10 13:45:56 UTC (rev 10029)
@@ -77,10 +77,12 @@
     void ModularSpaceShip::updatePartAssignment()
     {
         // iterate through all attached objects
-        for (unsigned int i=0; i < 100; i++)
+        for (unsigned int i=0; i < this->getNumAttachedObj(); i++)
         {
             if (this->getAttachedObject(i) == NULL)
+            {
                 break;
+            }
             // iterate through all attached parts
             for(unsigned int j = 0; j < this->partList_.size(); j++)
             {
@@ -148,7 +150,7 @@
 
     void ModularSpaceShip::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs)
     {
-        orxout() << "Mdamage(): Collision detected on " << this->getRadarName() << ", btCS*: " << cs << endl;
+        /*orxout() << "Mdamage(): Collision detected on " << this->getRadarName() << ", btCS*: " << cs << endl;
         orxout() << "UserPtr of said collisionShape: " << cs->getUserPointer() << endl;
 
 
@@ -176,15 +178,11 @@
 
         //orxout() << "ShipPart of Entity " << cs->getUserPointer() << ": " << this->getPartOfEntity((StaticEntity*)(cs->getUserPointer())) << endl;
 
-        orxout() << "CP_start" << endl;
-
         if (this->getPartOfEntity((StaticEntity*)(cs->getUserPointer())) != NULL)
             this->getPartOfEntity((StaticEntity*)(cs->getUserPointer()))->handleHit(damage, healthdamage, shielddamage, originator);
         else
             SpaceShip::damage(damage, healthdamage, shielddamage, originator, cs);
 
-        orxout() << "CP_end" << endl;
-
         /*
         // Applies multiplier given by the DamageBoost Pickup.
         if (originator)
@@ -266,7 +264,10 @@
         for(unsigned int i = 0; i < this->partList_.size(); i++)
         {
             if(this->partList_[i] == part)
+            {
                 this->partList_.erase(it);
+                break;
+            }
             it++;
         }
         // Remove the part-entity assignment and detach the Entity of this ShipPart
@@ -274,7 +275,11 @@
         {
             if (itt->second == part)
             {
-                this->detach(itt->first);
+                //this->detach(itt->first);
+                //itt->first->destroy();
+                itt->first->setActive(false);
+                itt->first->setVisible(false);
+                itt->first->setCollisionResponse(false);
                 this->partMap_.erase(itt);
             }
         }




More information about the Orxonox-commit mailing list