[Orxonox-commit 5760] r10420 - in code/branches/core7/src/orxonox: . collisionshapes items worldentities/pawns

landauf at orxonox.net landauf at orxonox.net
Sun May 3 15:02:05 CEST 2015


Author: landauf
Date: 2015-05-03 15:02:05 +0200 (Sun, 03 May 2015)
New Revision: 10420

Removed:
   code/branches/core7/src/orxonox/PawnManager.cc
   code/branches/core7/src/orxonox/PawnManager.h
   code/branches/core7/src/orxonox/ShipPartManager.cc
   code/branches/core7/src/orxonox/ShipPartManager.h
Modified:
   code/branches/core7/src/orxonox/CMakeLists.txt
   code/branches/core7/src/orxonox/OrxonoxPrereqs.h
   code/branches/core7/src/orxonox/collisionshapes/CollisionShape.cc
   code/branches/core7/src/orxonox/items/ShipPart.cc
   code/branches/core7/src/orxonox/items/ShipPart.h
   code/branches/core7/src/orxonox/worldentities/pawns/Pawn.cc
Log:
use destroyLater() in Pawn and ShipPart. PawnManager and ShipPartManager are not needed anymore.

Modified: code/branches/core7/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/core7/src/orxonox/CMakeLists.txt	2015-05-03 12:39:30 UTC (rev 10419)
+++ code/branches/core7/src/orxonox/CMakeLists.txt	2015-05-03 13:02:05 UTC (rev 10420)
@@ -28,9 +28,7 @@
   LevelManager.cc
   Main.cc
   MoodManager.cc
-  PawnManager.cc
   PlayerManager.cc
-  ShipPartManager.cc
   Radar.cc
 #  Test.cc
 

Modified: code/branches/core7/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/branches/core7/src/orxonox/OrxonoxPrereqs.h	2015-05-03 12:39:30 UTC (rev 10419)
+++ code/branches/core7/src/orxonox/OrxonoxPrereqs.h	2015-05-03 13:02:05 UTC (rev 10420)
@@ -72,7 +72,6 @@
     class LevelInfo;
     class LevelInfoItem;
     class LevelManager;
-    class PawnManager;
     class PlayerManager;
     class Radar;
     class Scene;

Deleted: code/branches/core7/src/orxonox/PawnManager.cc
===================================================================
--- code/branches/core7/src/orxonox/PawnManager.cc	2015-05-03 12:39:30 UTC (rev 10419)
+++ code/branches/core7/src/orxonox/PawnManager.cc	2015-05-03 13:02:05 UTC (rev 10420)
@@ -1,63 +0,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#include "PawnManager.h"
-
-#include "core/CoreIncludes.h"
-#include "core/singleton/ScopedSingletonManager.h"
-#include "worldentities/pawns/Pawn.h"
-
-namespace orxonox
-{
-    ManageScopedSingleton(PawnManager, ScopeID::Root, false);
-
-    RegisterAbstractClass(PawnManager).inheritsFrom<UpdateListener>();
-
-    PawnManager::PawnManager()
-    {
-        RegisterObject(PawnManager);
-    }
-
-    PawnManager::~PawnManager()
-    {
-        // Be sure to delete all the pawns
-        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); )
-            (it++)->destroy();
-    }
-
-    void PawnManager::postUpdate(const Clock& time)
-    {
-        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); )
-        {
-            if (!it->isAlive())
-                (it++)->destroy();
-            else
-                ++it;
-        }
-    }
-}

Deleted: code/branches/core7/src/orxonox/PawnManager.h
===================================================================
--- code/branches/core7/src/orxonox/PawnManager.h	2015-05-03 12:39:30 UTC (rev 10419)
+++ code/branches/core7/src/orxonox/PawnManager.h	2015-05-03 13:02:05 UTC (rev 10420)
@@ -1,55 +0,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _PawnManager_H__
-#define _PawnManager_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "util/Singleton.h"
-#include "core/UpdateListener.h"
-
-namespace orxonox
-{
-    class _OrxonoxExport PawnManager : public Singleton<PawnManager>, public UpdateListener
-    {
-            friend class Singleton<PawnManager>;
-        public:
-            PawnManager();
-            virtual ~PawnManager();
-
-            virtual void preUpdate(const Clock& time) { /*no action*/ }
-            virtual void postUpdate(const Clock& time);
-
-        private:
-
-            static PawnManager* singletonPtr_s;
-    };
-}
-
-#endif /* _PawnManager_H__ */

Deleted: code/branches/core7/src/orxonox/ShipPartManager.cc
===================================================================
--- code/branches/core7/src/orxonox/ShipPartManager.cc	2015-05-03 12:39:30 UTC (rev 10419)
+++ code/branches/core7/src/orxonox/ShipPartManager.cc	2015-05-03 13:02:05 UTC (rev 10420)
@@ -1,63 +0,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#include "ShipPartManager.h"
-
-#include "core/CoreIncludes.h"
-#include "core/singleton/ScopedSingletonManager.h"
-#include "items/ShipPart.h"
-
-namespace orxonox
-{
-    ManageScopedSingleton(ShipPartManager, ScopeID::Root, false);
-
-    RegisterAbstractClass(ShipPartManager).inheritsFrom<UpdateListener>();
-
-    ShipPartManager::ShipPartManager()
-    {
-        RegisterObject(ShipPartManager);
-    }
-
-    ShipPartManager::~ShipPartManager()
-    {
-        // Be sure to delete all the ship parts
-        for (ObjectList<ShipPart>::iterator it = ObjectList<ShipPart>::begin(); it != ObjectList<ShipPart>::end(); )
-            (it++)->destroy();
-    }
-
-    void ShipPartManager::postUpdate(const Clock& time)
-    {
-        for (ObjectList<ShipPart>::iterator it = ObjectList<ShipPart>::begin(); it != ObjectList<ShipPart>::end(); )
-        {
-            if (!it->isAlive())
-                (it++)->destroy();
-            else
-                ++it;
-        }
-    }
-}

Deleted: code/branches/core7/src/orxonox/ShipPartManager.h
===================================================================
--- code/branches/core7/src/orxonox/ShipPartManager.h	2015-05-03 12:39:30 UTC (rev 10419)
+++ code/branches/core7/src/orxonox/ShipPartManager.h	2015-05-03 13:02:05 UTC (rev 10420)
@@ -1,55 +0,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _ShipPartManager_H__
-#define _ShipPartManager_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "util/Singleton.h"
-#include "core/UpdateListener.h"
-
-namespace orxonox
-{
-    class _OrxonoxExport ShipPartManager : public Singleton<ShipPartManager>, public UpdateListener
-    {
-            friend class Singleton<ShipPartManager>;
-        public:
-            ShipPartManager();
-            virtual ~ShipPartManager();
-
-            virtual void preUpdate(const Clock& time) { /*no action*/ }
-            virtual void postUpdate(const Clock& time);
-
-        private:
-
-            static ShipPartManager* singletonPtr_s;
-    };
-}
-
-#endif /* _ShipPartManager_H__ */

Modified: code/branches/core7/src/orxonox/collisionshapes/CollisionShape.cc
===================================================================
--- code/branches/core7/src/orxonox/collisionshapes/CollisionShape.cc	2015-05-03 12:39:30 UTC (rev 10419)
+++ code/branches/core7/src/orxonox/collisionshapes/CollisionShape.cc	2015-05-03 13:02:05 UTC (rev 10420)
@@ -77,7 +77,7 @@
         if (this->isInitialized())
         {
             if (this->getScene() && this->getScene()->isUpdatingPhysics())
-                orxout(internal_error) << "Don't destroy collision shapes while the physics is updated! This will lead to crashes" << endl;
+                orxout(internal_error) << "Don't destroy collision shapes while the physics is updated! This will lead to crashes. Try to use destroyLater() instead" << endl;
 
             if (this->parent_)
                 this->parent_->detach(this);

Modified: code/branches/core7/src/orxonox/items/ShipPart.cc
===================================================================
--- code/branches/core7/src/orxonox/items/ShipPart.cc	2015-05-03 12:39:30 UTC (rev 10419)
+++ code/branches/core7/src/orxonox/items/ShipPart.cc	2015-05-03 13:02:05 UTC (rev 10420)
@@ -52,7 +52,6 @@
         : Item(context), parent_(NULL)
     {
         RegisterObject(ShipPart);
-        this->alive_ = true;
         this->eventExecution_ = true;
         this->healthMem_ = 100;
     }
@@ -89,11 +88,7 @@
     */
     void ShipPart::death()
     {
-        //if (!(this->isAlive()))
-            //return;
-
         this->explode();
-        this->setAlive(false);
 
         if(eventExecution_)
         {
@@ -103,6 +98,8 @@
                 this->getDestructionEvent(i)->execute();
             }
         }
+
+        this->destroyLater();
     }
 
     void ShipPart::explode()
@@ -204,12 +201,6 @@
         this->health_ = health;
     }
 
-    void ShipPart::setAlive(bool var)
-    {
-        this->alive_ = var;
-        orxout() << "ShipPart " << this->getName() << " alive_: " << this->alive_ << endl;
-    }
-
     /**
     @brief
         Handles a received hit.

Modified: code/branches/core7/src/orxonox/items/ShipPart.h
===================================================================
--- code/branches/core7/src/orxonox/items/ShipPart.h	2015-05-03 12:39:30 UTC (rev 10419)
+++ code/branches/core7/src/orxonox/items/ShipPart.h	2015-05-03 13:02:05 UTC (rev 10420)
@@ -71,10 +71,6 @@
             inline ModularSpaceShip* getParent()
                 { return this->parent_; }
 
-            void setAlive(bool var);
-            inline bool isAlive()
-                { return this->alive_; }
-
             inline void setEventExecution(bool var)
                 { this->eventExecution_ = var; }
             inline bool isEventExecution()
@@ -120,7 +116,6 @@
             std::vector<StaticEntity*> entityList_;         // List of all entities which belong to this part
             std::vector<PartDestructionEvent*> eventList_;  // The list of all PartDestructionEvent assigned to this ShipPart.
 
-            bool alive_;
             bool eventExecution_;
 
             float healthMem_;

Modified: code/branches/core7/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/core7/src/orxonox/worldentities/pawns/Pawn.cc	2015-05-03 12:39:30 UTC (rev 10419)
+++ code/branches/core7/src/orxonox/worldentities/pawns/Pawn.cc	2015-05-03 13:02:05 UTC (rev 10420)
@@ -325,8 +325,9 @@
         this->setHealth(1);
         if (this->getGametype() && this->getGametype()->allowPawnDeath(this, this->lastHitOriginator_))
         {
-            // Set bAlive_ to false and wait for PawnManager to do the destruction
+            // Set bAlive_ to false and wait for destroyLater() to do the destruction
             this->bAlive_ = false;
+            this->destroyLater();
 
             this->setDestroyWhenPlayerLeft(false);
 




More information about the Orxonox-commit mailing list