[Orxonox-commit 1026] r5747 - in code/trunk/src: . libraries/core libraries/core/input libraries/tools libraries/util orxonox/graphics orxonox/worldentities

rgrieder at orxonox.net rgrieder at orxonox.net
Sat Sep 19 23:17:51 CEST 2009


Author: rgrieder
Date: 2009-09-19 23:17:51 +0200 (Sat, 19 Sep 2009)
New Revision: 5747

Modified:
   code/trunk/src/Orxonox.cc
   code/trunk/src/libraries/core/Core.cc
   code/trunk/src/libraries/core/Game.cc
   code/trunk/src/libraries/core/Game.h
   code/trunk/src/libraries/core/GraphicsManager.cc
   code/trunk/src/libraries/core/IRC.cc
   code/trunk/src/libraries/core/Loader.cc
   code/trunk/src/libraries/core/TclBind.cc
   code/trunk/src/libraries/core/TclThreadManager.cc
   code/trunk/src/libraries/core/XMLPort.h
   code/trunk/src/libraries/core/input/InputDevice.h
   code/trunk/src/libraries/core/input/InputManager.cc
   code/trunk/src/libraries/tools/ResourceLocation.cc
   code/trunk/src/libraries/util/CMakeLists.txt
   code/trunk/src/libraries/util/Exception.cc
   code/trunk/src/libraries/util/Exception.h
   code/trunk/src/orxonox/graphics/ParticleEmitter.cc
   code/trunk/src/orxonox/worldentities/BigExplosion.cc
   code/trunk/src/orxonox/worldentities/ExplosionChunk.cc
Log:
Added Exception::handleMessage() (copy from Game::getExceptionMessage) function that returns the exception message (if retrievable) when catching with "..."
and adjusted some exception handlers.

Modified: code/trunk/src/Orxonox.cc
===================================================================
--- code/trunk/src/Orxonox.cc	2009-09-13 13:07:19 UTC (rev 5746)
+++ code/trunk/src/Orxonox.cc	2009-09-19 21:17:51 UTC (rev 5747)
@@ -44,6 +44,7 @@
 #endif
 
 #include "util/Debug.h"
+#include "util/Exception.h"
 #include "orxonox/Main.h"
 
 /*
@@ -66,15 +67,9 @@
         return orxonox::main(strCmdLine);
 #endif
     }
-    catch (const std::exception& ex)
-    {
-        COUT(0) << "Orxonox failed to initialise: " << ex.what() << std::endl;
-        COUT(0) << "Terminating program." << std::endl;
-        return 1;
-    }
     catch (...)
     {
-        COUT(0) << "Orxonox failed to initialise: " << std::endl;
+        COUT(0) << "Orxonox failed to initialise: " << orxonox::Exception::handleMessage() << std::endl;
         COUT(0) << "Terminating program." << std::endl;
         return 1;
     }

Modified: code/trunk/src/libraries/core/Core.cc
===================================================================
--- code/trunk/src/libraries/core/Core.cc	2009-09-13 13:07:19 UTC (rev 5746)
+++ code/trunk/src/libraries/core/Core.cc	2009-09-19 21:17:51 UTC (rev 5747)
@@ -283,13 +283,9 @@
                         {
                             DynLibManager::getInstance().load(librarypath.string());
                         }
-                        catch (const std::exception& e)
-                        {
-                            COUT(1) << "Couldn't load module \"" << librarypath.string() << "\": " << e.what() << std::endl;
-                        }
                         catch (...)
                         {
-                            COUT(1) << "Couldn't load module \"" << librarypath.string() << "\"" << std::endl;
+                            COUT(1) << "Couldn't load module \"" << librarypath.string() << "\": " << Exception::handleMessage() << std::endl;
                         }
                     }
                 }
@@ -297,13 +293,9 @@
                 ++file;
             }
         }
-        catch (const std::exception& e)
-        {
-            COUT(1) << "An error occurred while loading modules: " << e.what() << std::endl;
-        }
         catch (...)
         {
-            COUT(1) << "An error occurred while loading modules." << std::endl;
+            COUT(1) << "An error occurred while loading modules: " << Exception::handleMessage() << std::endl;
         }
 
         // Parse command line arguments AFTER the modules have been loaded (static code!)
@@ -397,8 +389,8 @@
             { this->graphicsManager_.reset(new GraphicsManager(false)); }
         catch (...)
         {
-            COUT(0) << "An exception occurred during 'new GraphicsManager' while "
-                    << "another exception was being handled. This will lead to undefined behaviour!" << std::endl
+            COUT(0) << "An exception occurred during 'unloadGraphics':" << Exception::handleMessage() << std::endl
+                    << "Another exception might be being handled which may lead to undefined behaviour!" << std::endl
                     << "Terminating the program." << std::endl;
             abort();
         }

Modified: code/trunk/src/libraries/core/Game.cc
===================================================================
--- code/trunk/src/libraries/core/Game.cc	2009-09-13 13:07:19 UTC (rev 5746)
+++ code/trunk/src/libraries/core/Game.cc	2009-09-19 21:17:51 UTC (rev 5747)
@@ -36,7 +36,6 @@
 
 #include <exception>
 #include <boost/weak_ptr.hpp>
-#include <CEGUIExceptions.h>
 
 #include "util/Debug.h"
 #include "util/Exception.h"
@@ -203,7 +202,7 @@
                 { this->core_->preUpdate(*this->gameClock_); }
             catch (...)
             {
-                COUT(0) << "An exception occurred in the Core preUpdate: " << Game::getExceptionMessage() << std::endl;
+                COUT(0) << "An exception occurred in the Core preUpdate: " << Exception::handleMessage() << std::endl;
                 COUT(0) << "This should really never happen! Closing the program." << std::endl;
                 this->stop();
                 break;
@@ -217,8 +216,8 @@
                 { this->core_->postUpdate(*this->gameClock_); }
             catch (...)
             {
-            COUT(0) << "An exception occurred in the Core postUpdate: " << Game::getExceptionMessage() << std::endl;
-            COUT(0) << "This should really never happen! Closing the program." << std::endl;
+                COUT(0) << "An exception occurred in the Core postUpdate: " << Exception::handleMessage() << std::endl;
+                COUT(0) << "This should really never happen! Closing the program." << std::endl;
                 this->stop();
                 break;
             }
@@ -253,7 +252,7 @@
                 }
                 catch (...)
                 {
-                    COUT(1) << "Error: Loading GameState '" << requestedStateNode->name_ << "' failed: " << Game::getExceptionMessage() << std::endl;
+                    COUT(1) << "Error: Loading GameState '" << requestedStateNode->name_ << "' failed: " << Exception::handleMessage() << std::endl;
                     // All scheduled operations have now been rendered inert --> flush them and issue a warning
                     if (this->requestedStateNodes_.size() > 1)
                         COUT(4) << "All " << this->requestedStateNodes_.size() - 1 << " scheduled transitions have been ignored." << std::endl;
@@ -284,7 +283,7 @@
             }
             catch (...)
             {
-                COUT(1) << "An exception occurred while updating '" << (*it)->getName() << "': " << Game::getExceptionMessage() << std::endl;
+                COUT(1) << "An exception occurred while updating '" << (*it)->getName() << "': " << Exception::handleMessage() << std::endl;
                 COUT(1) << "This should really never happen!" << std::endl;
                 COUT(1) << "Unloading all GameStates depending on the one that crashed." << std::endl;
                 shared_ptr<GameStateTreeNode> current = this->loadedTopStateNode_;
@@ -592,7 +591,7 @@
         }
         catch (...)
         {
-            COUT(2) << "Warning: Unloading GameState '" << name << "' threw an exception: " << Game::getExceptionMessage() << std::endl;
+            COUT(2) << "Warning: Unloading GameState '" << name << "' threw an exception: " << Exception::handleMessage() << std::endl;
             COUT(2) << "         There might be potential resource leaks involved! To avoid this, improve exception-safety." << std::endl;
         }
         // Check if graphics is still required
@@ -607,33 +606,6 @@
         this->bChangingState_ = false;
     }
 
-    /*static*/ std::string Game::getExceptionMessage()
-    {
-        std::string exceptionMessage;
-        try
-        {
-            // rethrow
-            throw;
-        }
-        catch (const std::exception& ex)
-        {
-            return ex.what();
-        }
-        catch (const CEGUI::Exception& ex)
-        {
-#if CEGUI_VERSION_MAJOR == 0 && CEGUI_VERSION_MINOR < 6
-            return GeneralException(ex.getMessage().c_str()).getDescription();
-#else
-            return GeneralException(ex.getMessage().c_str(), ex.getLine(),
-                ex.getFileName().c_str(), ex.getName().c_str()).getDescription();
-#endif
-        }
-        catch (...)
-        {
-            return "Unknown exception";
-        }
-    }
-
     std::map<std::string, shared_ptr<Game::GameStateFactory> > Game::GameStateFactory::factories_s;
 
     /*static*/ shared_ptr<GameState> Game::GameStateFactory::fabricate(const GameStateInfo& info)

Modified: code/trunk/src/libraries/core/Game.h
===================================================================
--- code/trunk/src/libraries/core/Game.h	2009-09-13 13:07:19 UTC (rev 5746)
+++ code/trunk/src/libraries/core/Game.h	2009-09-19 21:17:51 UTC (rev 5747)
@@ -154,13 +154,6 @@
 
         // ScopeGuard helper function
         void resetChangingState() { this->bChangingState_ = false; }
-        /**
-        @brief
-            Retrieves information from an exception caught with "..."
-        @remarks
-            Never ever call this function without an exception in the stack!
-        */
-        static std::string getExceptionMessage();
 
         scoped_ptr<Clock>                  gameClock_;
         scoped_ptr<Core>                   core_;

Modified: code/trunk/src/libraries/core/GraphicsManager.cc
===================================================================
--- code/trunk/src/libraries/core/GraphicsManager.cc	2009-09-13 13:07:19 UTC (rev 5746)
+++ code/trunk/src/libraries/core/GraphicsManager.cc	2009-09-19 21:17:51 UTC (rev 5747)
@@ -171,7 +171,7 @@
         // to support both Ogre 1.4 and 1.6. The hacky solution is to create
         // scripts for the 1.6 version and then remove the inserted "particle_system"
         // keyword. But we need to supply these new scripts as well, which is why
-        // there is an extra Ogre::Archive dealing with in the memory.
+        // there is an extra Ogre::Archive dealing with it in the memory.
         using namespace Ogre;
         ArchiveManager::getSingleton().addArchiveFactory(memoryArchiveFactory_.get());
         const StringVector& groups = ResourceGroupManager::getSingleton().getResourceGroups();

Modified: code/trunk/src/libraries/core/IRC.cc
===================================================================
--- code/trunk/src/libraries/core/IRC.cc	2009-09-13 13:07:19 UTC (rev 5746)
+++ code/trunk/src/libraries/core/IRC.cc	2009-09-19 21:17:51 UTC (rev 5747)
@@ -31,6 +31,7 @@
 #include <cpptcl/cpptcl.h>
 
 #include "util/Convert.h"
+#include "util/Exception.h"
 #include "ConsoleCommand.h"
 #include "CoreIncludes.h"
 #include "TclThreadManager.h"
@@ -63,8 +64,8 @@
         }
         catch (Tcl::tcl_error const &e)
         {   COUT(1) << "Tcl (IRC) error: " << e.what();   }
-        catch (std::exception const &e)
-        {   COUT(1) << "Error while initializing Tcl (IRC): " << e.what();   }
+        catch (...)
+        {   COUT(1) << "Error while initializing Tcl (IRC): " << Exception::handleMessage();   }
 
         this->nickname_ = "orx" + multi_cast<std::string>(static_cast<unsigned int>(rand()));
         TclThreadManager::execute(threadID, "set nickname " + this->nickname_);
@@ -93,8 +94,8 @@
         }
         catch (Tcl::tcl_error const &e)
         {   COUT(1) << "Tcl (IRC) error: " << e.what();   }
-        catch (std::exception const &e)
-        {   COUT(1) << "Error while executing Tcl (IRC): " << e.what();   }
+        catch (...)
+        {   COUT(1) << "Error while executing Tcl (IRC): " << Exception::handleMessage();   }
 
         return false;
     }

Modified: code/trunk/src/libraries/core/Loader.cc
===================================================================
--- code/trunk/src/libraries/core/Loader.cc	2009-09-13 13:07:19 UTC (rev 5746)
+++ code/trunk/src/libraries/core/Loader.cc	2009-09-19 21:17:51 UTC (rev 5747)
@@ -186,21 +186,14 @@
             COUT(1) << "Loading aborted." << std::endl;
             return false;
         }
-        catch (std::exception& ex)
+        catch (...)
         {
             COUT(1) << std::endl;
             COUT(1) << "An error occurred in Loader.cc while loading " << file->getFilename() << ":" << std::endl;
-            COUT(1) << ex.what() << std::endl;
+            COUT(1) << Exception::handleMessage() << std::endl;
             COUT(1) << "Loading aborted." << std::endl;
             return false;
         }
-        catch (...)
-        {
-            COUT(1) << std::endl;
-            COUT(1) << "An unknown error occurred in Loader.cc while loading " << file->getFilename() << ":" << std::endl;
-            COUT(1) << "Loading aborted." << std::endl;
-            return false;
-        }
     }
 
     void Loader::unload(const XMLFile* file, const ClassTreeMask& mask)

Modified: code/trunk/src/libraries/core/TclBind.cc
===================================================================
--- code/trunk/src/libraries/core/TclBind.cc	2009-09-13 13:07:19 UTC (rev 5746)
+++ code/trunk/src/libraries/core/TclBind.cc	2009-09-19 21:17:51 UTC (rev 5747)
@@ -34,6 +34,7 @@
 
 #include "SpecialConfig.h"
 #include "util/Debug.h"
+#include "util/Exception.h"
 #include "util/StringUtils.h"
 #include "CommandExecutor.h"
 #include "ConsoleCommand.h"
@@ -91,10 +92,8 @@
             }
             catch (Tcl::tcl_error const &e)
             {   COUT(1) << "Tcl error while creating Tcl-interpreter: " << e.what() << std::endl;   }
-            catch (std::exception const &e)
-            {   COUT(1) << "Error while creating Tcl-interpreter: " << e.what() << std::endl;   }
             catch (...)
-            {   COUT(1) << "Error while creating Tcl-interpreter." << std::endl;   }
+            {   COUT(1) << "Error while creating Tcl-interpreter: " << Exception::handleMessage() << std::endl;   }
         }
     }
 
@@ -114,10 +113,8 @@
         }
         catch (Tcl::tcl_error const &e)
         {   COUT(1) << "Tcl error while creating Tcl-interpreter: " << e.what() << std::endl; COUT(1) << "Error: Tcl isn't properly initialized. Orxonox might possibly not work like that." << std::endl;   }
-        catch (std::exception const &e)
-        {   COUT(1) << "Error while creating Tcl-interpreter: " << e.what() << std::endl; COUT(1) << "Error: Tcl isn't properly initialized. Orxonox might possibly not work like that." << std::endl;   }
         catch (...)
-        {   COUT(1) << "Error while creating Tcl-interpreter." << std::endl; COUT(1) << "Error: Tcl isn't properly initialized. Orxonox might possibly not work like that." << std::endl;   }
+        {   COUT(1) << "Error while creating Tcl-interpreter: " << Exception::handleMessage() << std::endl; COUT(1) << "Error: Tcl isn't properly initialized. Orxonox might possibly not work like that." << std::endl;   }
 
         return interpreter;
     }
@@ -177,8 +174,8 @@
             }
             catch (Tcl::tcl_error const &e)
             {   COUT(1) << "tcl> Error: " << e.what() << std::endl;   }
-            catch (std::exception const &e)
-            {   COUT(1) << "Error while executing Tcl: " << e.what() << std::endl;   }
+            catch (...)
+            {   COUT(1) << "Error while executing Tcl: " << Exception::handleMessage() << std::endl;   }
         }
 
         return "";
@@ -198,8 +195,8 @@
         }
         catch (Tcl::tcl_error const &e)
         {   COUT(1) << "Tcl error: " << e.what() << std::endl;   }
-        catch (std::exception const &e)
-        {   COUT(1) << "Error while executing Tcl: " << e.what() << std::endl;   }
+        catch (...)
+        {   COUT(1) << "Error while executing Tcl: " << Exception::handleMessage() << std::endl;   }
 
         return false;
     }

Modified: code/trunk/src/libraries/core/TclThreadManager.cc
===================================================================
--- code/trunk/src/libraries/core/TclThreadManager.cc	2009-09-13 13:07:19 UTC (rev 5746)
+++ code/trunk/src/libraries/core/TclThreadManager.cc	2009-09-19 21:17:51 UTC (rev 5747)
@@ -36,6 +36,7 @@
 #include <cpptcl/cpptcl.h>
 
 #include "util/Convert.h"
+#include "util/Exception.h"
 #include "Clock.h"
 #include "CommandExecutor.h"
 #include "ConsoleCommand.h"
@@ -284,10 +285,8 @@
         }
         catch (const Tcl::tcl_error& e)
         {   bundle->interpreter_ = 0; COUT(1) << "Tcl error while creating Tcl-interpreter (" << id_string << "): " << e.what() << std::endl;   }
-        catch (const std::exception& e)
-        {   bundle->interpreter_ = 0; COUT(1) << "Error while creating Tcl-interpreter (" << id_string << "): " << e.what() << std::endl;   }
         catch (...)
-        {   bundle->interpreter_ = 0; COUT(1) << "An error occurred while creating a new Tcl-interpreter (" << id_string << ")" << std::endl;   }
+        {   bundle->interpreter_ = 0; COUT(1) << "Error while creating Tcl-interpreter (" << id_string << "): " << Exception::handleMessage() << std::endl;   }
     }
 
     /**

Modified: code/trunk/src/libraries/core/XMLPort.h
===================================================================
--- code/trunk/src/libraries/core/XMLPort.h	2009-09-13 13:07:19 UTC (rev 5746)
+++ code/trunk/src/libraries/core/XMLPort.h	2009-09-19 21:17:51 UTC (rev 5747)
@@ -590,15 +590,11 @@
                                                     COUT(1) << "An error occurred while loading object, abort loading..." << std::endl;
                                                     throw ex;
                                                 }
-                                                catch (std::exception& ex)
+                                                catch (...)
                                                 {
                                                     COUT(1) << "An error occurred while loading object:" << std::endl;
-                                                    COUT(1) << ex.what() << std::endl;
+                                                    COUT(1) << Exception::handleMessage() << std::endl;
                                                 }
-                                                catch (...)
-                                                {
-                                                    COUT(1) << "An unknown error occurred while loading object." << std::endl;
-                                                }
                                             }
                                         }
                                         else

Modified: code/trunk/src/libraries/core/input/InputDevice.h
===================================================================
--- code/trunk/src/libraries/core/input/InputDevice.h	2009-09-13 13:07:19 UTC (rev 5746)
+++ code/trunk/src/libraries/core/input/InputDevice.h	2009-09-19 21:17:51 UTC (rev 5747)
@@ -41,6 +41,7 @@
 #include <ois/OISInputManager.h>
 
 #include "util/Debug.h"
+#include "util/Exception.h"
 #include "core/Clock.h"
 #include "InputState.h"
 
@@ -144,7 +145,8 @@
             }
             catch (...)
             {
-                COUT(1) << this->getClassName() << " destruction failed! Potential resource leak!" << std::endl;
+                COUT(1) << this->getClassName() << " destruction failed: " << Exception::handleMessage() << std::endl
+                        << "    Potential resource leak!" << std::endl;
             }
         }
 

Modified: code/trunk/src/libraries/core/input/InputManager.cc
===================================================================
--- code/trunk/src/libraries/core/input/InputManager.cc	2009-09-13 13:07:19 UTC (rev 5746)
+++ code/trunk/src/libraries/core/input/InputManager.cc	2009-09-19 21:17:51 UTC (rev 5747)
@@ -329,7 +329,8 @@
             }
             catch (...)
             {
-                CCOUT(1) << className << " destruction failed! Potential resource leak!" << std::endl;
+                COUT(1) << className << " destruction failed: " << Exception::handleMessage() << std::endl
+                        << "    Potential resource leak!" << std::endl;
             }
         }
         devices_.resize(InputDeviceEnumerator::FirstJoyStick);
@@ -341,7 +342,8 @@
         }
         catch (...)
         {
-            CCOUT(1) << "OIS::InputManager destruction failed! Potential resource leak!" << std::endl;
+            COUT(1) << "OIS::InputManager destruction failed" << Exception::handleMessage() << std::endl
+                    << "    Potential resource leak!" << std::endl;
         }
         oisInputManager_ = NULL;
 

Modified: code/trunk/src/libraries/tools/ResourceLocation.cc
===================================================================
--- code/trunk/src/libraries/tools/ResourceLocation.cc	2009-09-13 13:07:19 UTC (rev 5746)
+++ code/trunk/src/libraries/tools/ResourceLocation.cc	2009-09-19 21:17:51 UTC (rev 5747)
@@ -96,9 +96,9 @@
             Ogre::ResourceGroupManager::getSingleton().removeResourceLocation(
                 this->getPath(), this->getResourceGroup());
         }
-        catch (const std::exception& ex)
+        catch (...)
         {
-            COUT(1) << "Removing of a ResourceLocation failed: " << ex.what() << std::endl;
+            COUT(1) << "Removing of a ResourceLocation failed: " << Exception::handleMessage() << std::endl;
         }
     }
 }

Modified: code/trunk/src/libraries/util/CMakeLists.txt
===================================================================
--- code/trunk/src/libraries/util/CMakeLists.txt	2009-09-13 13:07:19 UTC (rev 5746)
+++ code/trunk/src/libraries/util/CMakeLists.txt	2009-09-19 21:17:51 UTC (rev 5747)
@@ -73,6 +73,7 @@
   DEFINE_SYMBOL
     "UTIL_SHARED_BUILD"
   LINK_LIBRARIES
+    ${CEGUI_LIBRARY}
     ${OGRE_LIBRARY}
   SOURCE_FILES
     ${UTIL_SRC_FILES} ${UTIL_HDR_FILES}

Modified: code/trunk/src/libraries/util/Exception.cc
===================================================================
--- code/trunk/src/libraries/util/Exception.cc	2009-09-13 13:07:19 UTC (rev 5746)
+++ code/trunk/src/libraries/util/Exception.cc	2009-09-19 21:17:51 UTC (rev 5747)
@@ -33,6 +33,7 @@
 */
 
 #include "Exception.h"
+#include <CEGUIExceptions.h>
 
 namespace orxonox
 {
@@ -92,4 +93,30 @@
     {
         return getDescription().c_str();
     }
+
+    /*static*/ std::string Exception::handleMessage()
+    {
+        try
+        {
+            // rethrow
+            throw;
+        }
+        catch (const std::exception& ex)
+        {
+            return ex.what();
+        }
+        catch (const CEGUI::Exception& ex)
+        {
+#if CEGUI_VERSION_MAJOR == 0 && CEGUI_VERSION_MINOR < 6
+            return GeneralException(ex.getMessage().c_str()).getDescription();
+#else
+            return GeneralException(ex.getMessage().c_str(), ex.getLine(),
+                ex.getFileName().c_str(), ex.getName().c_str()).getDescription();
+#endif
+        }
+        catch (...)
+        {
+            return "Unknown exception";
+        }
+    }
 }

Modified: code/trunk/src/libraries/util/Exception.h
===================================================================
--- code/trunk/src/libraries/util/Exception.h	2009-09-13 13:07:19 UTC (rev 5746)
+++ code/trunk/src/libraries/util/Exception.h	2009-09-19 21:17:51 UTC (rev 5747)
@@ -82,6 +82,15 @@
         //! Returns the filename in which the exception occurred.
         virtual const std::string& getFilename()        const { return this->filename_; }
 
+        /**
+        @brief
+            Retrieves information from an exception caught with "..."
+            Works for std::exception and CEGUI::Exception
+        @remarks
+            Never ever call this function without an exception in the stack!
+        */
+        static std::string handleMessage();
+
     protected:
         std::string description_;             //!< User typed text about why the exception occurred
         unsigned int lineNumber_;             //!< Line on which the exception occurred

Modified: code/trunk/src/orxonox/graphics/ParticleEmitter.cc
===================================================================
--- code/trunk/src/orxonox/graphics/ParticleEmitter.cc	2009-09-13 13:07:19 UTC (rev 5746)
+++ code/trunk/src/orxonox/graphics/ParticleEmitter.cc	2009-09-19 21:17:51 UTC (rev 5747)
@@ -109,15 +109,15 @@
             try
             {
                 this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), this->source_, this->LOD_);
-                this->attachOgreObject(this->particles_->getParticleSystem());
-                this->particles_->setVisible(this->isVisible());
-                this->particles_->setEnabled(this->isActive());
             }
             catch (...)
             {
-                COUT(1) << "Error: Couln't load particle effect \"" << this->source_ << "\"" << std::endl;
-                this->particles_ = 0;
+                COUT(1) << "Error: Couln't load particle effect \"" << this->source_ << "\" because:" << std::endl
+                        << Exception::handleMessage() << std::endl;
             }
+            this->attachOgreObject(this->particles_->getParticleSystem());
+            this->particles_->setVisible(this->isVisible());
+            this->particles_->setEnabled(this->isActive());
         }
     }
 

Modified: code/trunk/src/orxonox/worldentities/BigExplosion.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/BigExplosion.cc	2009-09-13 13:07:19 UTC (rev 5746)
+++ code/trunk/src/orxonox/worldentities/BigExplosion.cc	2009-09-19 21:17:51 UTC (rev 5747)
@@ -73,7 +73,7 @@
             }
             catch (...)
             {
-                COUT(1) << "Error: Couln't load particle effect in BigExplosion." << std::endl;
+                COUT(1) << "Error: Couln't load particle effect in BigExplosion: " << Exception::handleMessage() << std::endl;
                 this->initZero();
             }
         }
@@ -96,42 +96,18 @@
 
     void BigExplosion::init()
     {
-        Identifier* idDE1 = Class(MovableEntity);
-        BaseObject* oDE1 = idDE1->fabricate(this);
-        this->debrisEntity1_ = orxonox_cast<MovableEntity*>(oDE1);
+        this->debrisEntity1_ = new MovableEntity(this);
+        this->debrisEntity2_ = new MovableEntity(this);
+        this->debrisEntity3_ = new MovableEntity(this);
+        this->debrisEntity4_ = new MovableEntity(this);
 
-        Identifier* idDE2 = Class(MovableEntity);
-        BaseObject* oDE2 = idDE2->fabricate(this);
-        this->debrisEntity2_ = orxonox_cast<MovableEntity*>(oDE2);
+        this->debris1_ = new Model(this);
+        this->debris2_ = new Model(this);
+        this->debris3_ = new Model(this);
+        this->debris4_ = new Model(this);
 
-        Identifier* idDE3 = Class(MovableEntity);
-        BaseObject* oDE3 = idDE3 ->fabricate(this);
-        this->debrisEntity3_ = orxonox_cast<MovableEntity*>(oDE3);
+        this->explosion_ = new StaticEntity(this);
 
-        Identifier* idDE4 = Class(MovableEntity);
-        BaseObject* oDE4 = idDE4->fabricate(this);
-        this->debrisEntity4_ = orxonox_cast<MovableEntity*>(oDE4);
-
-        Identifier* idD1 = Class(Model);
-        BaseObject* oD1 = idD1->fabricate(this);
-        this->debris1_ = orxonox_cast<Model*>(oD1);
-
-        Identifier* idD2 = Class(Model);
-        BaseObject* oD2 = idD2->fabricate(this);
-        this->debris2_ = orxonox_cast<Model*>(oD2);
-
-        Identifier* idD3 = Class(Model);
-        BaseObject* oD3 = idD3->fabricate(this);
-        this->debris3_ = orxonox_cast<Model*>(oD3);
-
-        Identifier* idD4 = Class(Model);
-        BaseObject* oD4 = idD4->fabricate(this);
-        this->debris4_ = orxonox_cast<Model*>(oD4);
-
-        Identifier* id6 = Class(StaticEntity);
-        BaseObject* object4 = id6->fabricate(this);
-        this->explosion_ = orxonox_cast<StaticEntity*>(object4);
-
         this->debrisSmoke1_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/smoke7", this->LOD_);
         this->debrisSmoke2_ =  new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/smoke7", this->LOD_);
         this->debrisSmoke3_ =  new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/smoke7", this->LOD_);
@@ -199,23 +175,12 @@
 
         for(int i=0;i<10;i++)
         {
-            Identifier* idf1 = Class(Model);
-            BaseObject* obj1 = idf1->fabricate(this);
-            Model* part1 = orxonox_cast<Model*>(obj1);
+            Model* part1 = new Model(this);
+            Model* part2 = new Model(this);
 
+            MovableEntity* partEntity1 = new MovableEntity(this);
+            MovableEntity* partEntity2 = new MovableEntity(this);
 
-            Identifier* idf2 = Class(Model);
-            BaseObject* obj2 = idf2->fabricate(this);
-            Model* part2 = orxonox_cast<Model*>(obj2);
-
-            Identifier* idf3 = Class(MovableEntity);
-            BaseObject* obj3 = idf3->fabricate(this);
-            MovableEntity* partEntity1 = orxonox_cast<MovableEntity*>(obj3);
-
-            Identifier* idf4 = Class(MovableEntity);
-            BaseObject* obj4 = idf4->fabricate(this);
-            MovableEntity* partEntity2 = orxonox_cast<MovableEntity*>(obj4);
-
             partEntity1->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(10,100));
             partEntity1->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());
             partEntity1->setScale(rnd(1, 3));
@@ -227,7 +192,6 @@
             part1->setMeshSource("SmallPart1.mesh");
             part2->setMeshSource("SmallPart2.mesh");
 
-
             partEntity1->attach(part1);
             partEntity2->attach(part2);
 

Modified: code/trunk/src/orxonox/worldentities/ExplosionChunk.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/ExplosionChunk.cc	2009-09-13 13:07:19 UTC (rev 5746)
+++ code/trunk/src/orxonox/worldentities/ExplosionChunk.cc	2009-09-19 21:17:51 UTC (rev 5747)
@@ -60,7 +60,7 @@
             }
             catch (...)
             {
-                COUT(1) << "Error: Couln't load particle effect in ExplosionChunk." << std::endl;
+                COUT(1) << "Error: Couln't load particle effect in ExplosionChunk: " << Exception::handleMessage() << std::endl;
                 this->fire_ = 0;
                 this->smoke_ = 0;
             }




More information about the Orxonox-commit mailing list