Index: /trunk/src/lib/event/event_handler.cc
===================================================================
--- /trunk/src/lib/event/event_handler.cc	(revision 6618)
+++ /trunk/src/lib/event/event_handler.cc	(revision 6619)
@@ -262,5 +262,5 @@
     SDL_WM_GrabInput(SDL_GRAB_OFF);
   else
-    ;//SDL_WM_GrabInput(SDL_GRAB_ON);
+    SDL_WM_GrabInput(SDL_GRAB_ON);
 }
 
Index: /trunk/src/lib/particles/Makefile.am
===================================================================
--- /trunk/src/lib/particles/Makefile.am	(revision 6618)
+++ /trunk/src/lib/particles/Makefile.am	(revision 6619)
@@ -4,12 +4,10 @@
 noinst_LIBRARIES = libORXparticles.a
 
-libORXparticles_a_SOURCES = particle_engine.cc \
-                            particle_emitter.cc \
+libORXparticles_a_SOURCES = particle_emitter.cc \
                             particle_system.cc \
                             quick_animation.cc
 
 
-noinst_HEADERS= particle_engine.h \
-                particle_emitter.h \
+noinst_HEADERS= particle_emitter.h \
                 particle_system.h \
                 quick_animation.h
Index: /trunk/src/lib/particles/engine/particle_engine.cc
===================================================================
--- /trunk/src/lib/particles/engine/particle_engine.cc	(revision 6619)
+++ /trunk/src/lib/particles/engine/particle_engine.cc	(revision 6619)
@@ -0,0 +1,455 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   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, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: ...
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+#include "particle_engine.h"
+
+#include "class_list.h"
+
+#include "list.h"
+#include "debug.h"
+#include "stdlibincl.h"
+#include "load_param.h"
+
+using namespace std;
+
+/**
+ *  standard constructor
+*/
+ParticleEngine::ParticleEngine ()
+{
+   this->setClassID(CL_PARTICLE_ENGINE, "ParticleEngine");
+   this->setName("ParticleEngine");
+
+   this->systemList = new tList<ParticleSystem>;
+   this->emitterList = new tList<ParticleEmitter>;
+   this->connectionList = new tList<ParticleConnection>;
+}
+
+/**
+ *  the singleton reference to this class
+*/
+ParticleEngine* ParticleEngine::singletonRef = NULL;
+
+/**
+ *  deletes all the system, emitters, connections and Lists
+*/
+ParticleEngine::~ParticleEngine ()
+{
+  /// @todo we must not do this, because PNoe does it for us
+  /// or we do this with help from ClassList, which essentially makes much more sense
+
+  // delete all remaining systems
+//   tIterator<ParticleSystem>* sysIt = this->systemList->getIterator();
+//   ParticleSystem* tmpSys = sysIt->firstElement();
+//   while(tmpSys)
+//     {
+//       delete tmpSys;
+//       tmpSys = sysIt->nextElement();
+//     }
+//   delete sysIt;
+   delete this->systemList;
+//
+   // delete all remaining emitters
+   tIterator<ParticleEmitter>* emitIt = this->emitterList->getIterator();
+   ParticleEmitter* tmpEmit = emitIt->firstElement();
+   while(tmpEmit)
+     {
+       delete tmpEmit;
+       tmpEmit = emitIt->nextElement();
+     }
+   delete emitIt;
+   delete this->emitterList;
+
+  // there should be no more Connections
+  if (this->connectionList->getSize() == 0)
+    delete this->connectionList;
+  else
+    PRINTF(2)("The Connection List is not empty. This should not happen.\n");
+
+  ParticleEngine::singletonRef = NULL;
+}
+
+/**
+  \brief loads the ParticleEngines settings and connections between particles and emitters
+* @param root the XML-element to load this from.
+ */
+void ParticleEngine::loadParams(const TiXmlElement* root)
+{
+  LOAD_PARAM_START_CYCLE(root, element);
+  {
+    LoadParam_CYCLE(element, "connect", this, ParticleEngine, addConnection)
+        .describe("connects an Emitter to a System (emitterName, systemName)");
+  }
+  LOAD_PARAM_END_CYCLE(element);
+}
+
+/**
+ *  Adds a System to the System list.
+
+   this is done automatically when creating a ParticleSystem
+*/
+void ParticleEngine::addSystem(ParticleSystem* system)
+{
+  this->systemList->add(system);
+}
+
+/**
+ *  Adds an emitter to the emitterList
+
+   this is done automatically when creating a ParticleEmitter
+*/
+void ParticleEngine::addEmitter(ParticleEmitter* emitter)
+{
+  this->emitterList->add(emitter);
+}
+
+/**
+* @brief Connects a ParticleSystem to a ParticleSystem thus emitting Particles.
+* @param emitter the Emitter to connect to the System
+* @param system the System to connect to the Emitter
+*/
+void ParticleEngine::addConnection(const char* emitter, const char* system)
+{
+  ParticleEmitter* tmpEmit = dynamic_cast<ParticleEmitter*>(ClassList::getObject(emitter, CL_PARTICLE_EMITTER));//this->getEmitterByName(emitter);
+  ParticleSystem* tmpSys = dynamic_cast<ParticleSystem*>(ClassList::getObject(system, CL_PARTICLE_SYSTEM));//this->getSystemByName(system);
+
+  if (tmpEmit != NULL && tmpSys != NULL)
+    this->addConnection(tmpEmit, tmpSys);
+  else
+  {
+    if (tmpEmit == NULL)
+      PRINTF(2)("Emitter %s not found in the List of emitters, not connecting to %s\n", emitter, system);
+    if (tmpEmit == NULL)
+      PRINTF(2)("System %s not found in the List of emitters, not connecting to %s\n", system, emitter);
+  }
+}
+
+/**
+ *  Connects a ParticleSystem to a ParticleSystem thus emitting Particles.
+ * @param emitter the Emitter to connect to the System
+ * @param system the System to connect to the Emitter
+*/
+void ParticleEngine::addConnection(ParticleEmitter* emitter, ParticleSystem* system)
+{
+  // look, if we have already added this connection
+  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+  ParticleConnection* tmpConnection = tmpConIt->firstElement();
+  while(tmpConnection)
+    {
+      if (tmpConnection->emitter == emitter && tmpConnection->system == system)
+        {
+          PRINTF(2)("Connection between Emitter and System already exists.\n");
+          delete tmpConIt;
+          return;
+        }
+
+      tmpConnection = tmpConIt->nextElement();
+    }
+  delete tmpConIt;
+
+
+
+  ParticleConnection* tmpCon = new ParticleConnection;
+  tmpCon->emitter = emitter;
+  tmpCon->system = system;
+
+  this->connectionList->add(tmpCon);
+}
+
+/**
+ *  Removes a system from the systemList and also removes all Connections to the System
+ * @param system The ParticleSystem to delete
+*/
+bool ParticleEngine::removeSystem(ParticleSystem* system)
+{
+  // remove any connections, that have this system within
+  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+  ParticleConnection* tmpConnection = tmpConIt->firstElement();
+  while(tmpConnection != NULL)
+    {
+      if (tmpConnection->system == system)
+        this->breakConnection(tmpConnection);
+      tmpConnection = tmpConIt->nextElement();
+    }
+  delete tmpConIt;
+
+  // remove the System from the systemList.
+  this->systemList->remove(system);
+}
+
+/**
+ *  removes an emitter from the emitterList and also from all Connections it is attached to.
+ * @param emitter the ParticleEmitter to remove.
+*/
+bool ParticleEngine::removeEmitter(ParticleEmitter* emitter)
+{
+  // remove any connections, that have this emitter within
+  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+  ParticleConnection* tmpConnection = tmpConIt->firstElement();
+  while(tmpConnection != NULL)
+    {
+      if (tmpConnection->emitter == emitter)
+        this->breakConnection(tmpConnection);
+      tmpConnection = tmpConIt->nextElement();
+    }
+  delete tmpConIt;
+
+  // remove the emitter from the emitterList
+  this->emitterList->remove(emitter);
+}
+
+
+/**
+ *  removes a Connection between an Emitter and a System
+ * @param connection the connection to remove
+ *
+ * \see bool ParticleEngine::breakConnection(ParticleEmitter* emitter, ParticleSystem* system)
+ */
+bool ParticleEngine::breakConnection(ParticleConnection* connection)
+{
+  this->connectionList->remove(connection);
+  return true;
+}
+
+/**
+ *  removes a Connection between an Emitter and a System
+ * @param emitter The emitter of the connection to remove
+ * @param system The system of the connection to remove
+ * @returns true, if the connection was broken, false if the conntection was not found
+ *
+ * only if both system and emitter are in the connection the Connection will be broken
+*/
+bool ParticleEngine::breakConnection(ParticleEmitter* emitter, ParticleSystem* system)
+{
+  // look, if we have already added this connection
+  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+  ParticleConnection* tmpConnection = tmpConIt->firstElement();
+  while(tmpConnection)
+    {
+    if (tmpConnection->emitter == emitter && tmpConnection->system == system)
+      {
+        this->breakConnection(tmpConnection);
+        delete tmpConIt;
+        return true;
+      }
+    tmpConnection = tmpConIt->nextElement();
+    }
+  delete tmpConIt;
+  return false;
+}
+
+/**
+ *  removes a Connection between an Emitter and a System
+ * @param emitter The emitter of the connections to remove
+ * @returns the count of connections that were broken, 0 if no conntection was not found
+ */
+unsigned int ParticleEngine::breakConnections(ParticleEmitter* emitter)
+{
+  unsigned int retVal = 0;
+  // look, if we have already added this connection
+  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+  ParticleConnection* tmpConnection = tmpConIt->firstElement();
+  while(tmpConnection)
+  {
+    if (tmpConnection->emitter == emitter)
+    {
+      this->breakConnection(tmpConnection);
+      retVal++;
+    }
+    tmpConnection = tmpConIt->nextElement();
+  }
+  delete tmpConIt;
+  return retVal;
+}
+
+
+/**
+ *  removes a Connection between an Emitter and a System
+ * @param system The system of the connections to remove
+ * @returns the count of connections that were broken, 0 if no conntection was not found
+ */
+unsigned int ParticleEngine::breakConnections(ParticleSystem* system)
+{
+  unsigned int retVal = 0;
+  // look, if we have already added this connection
+  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+  ParticleConnection* tmpConnection = tmpConIt->firstElement();
+  while(tmpConnection)
+  {
+    if (tmpConnection->system == system)
+    {
+      this->breakConnection(tmpConnection);
+      retVal++;
+    }
+    tmpConnection = tmpConIt->nextElement();
+  }
+  delete tmpConIt;
+  return retVal;
+}
+
+/**
+ *  this function ticks all the ParticleSystems, so an animation will flow
+ * @param dt passed since last tick
+*/
+void ParticleEngine::tick(float dt)
+{
+  // ticks all the ParticleSystems
+//   tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
+//   ParticleSystem* tmpSys = tmpIt->firstElement();
+//   while(tmpSys)
+//     {
+//       tmpSys->tick(dt);
+//       tmpSys = tmpIt->nextElement();
+//     }
+//   delete tmpIt;
+
+  // add new Particles to each System connected to an Emitter.
+  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+  ParticleConnection* tmpConnection = tmpConIt->firstElement();
+  while(tmpConnection)
+    {
+      tmpConnection->emitter->tick(dt, tmpConnection->system);
+      tmpConnection = tmpConIt->nextElement();
+    }
+  delete tmpConIt;
+}
+
+/**
+ *  draws all the systems and their Particles.
+*/
+void ParticleEngine::draw() const
+{
+  /*
+  tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
+  ParticleSystem* tmpSys = tmpIt->firstElement();
+  while(tmpSys)
+    {
+      tmpSys->draw();
+      tmpSys = tmpIt->nextElement();
+    }
+  delete tmpIt;*/
+
+}
+
+/**
+ * @param number the n-th system to return
+ * @returns the system called by number or NULL if not found
+*/
+ParticleSystem* ParticleEngine::getSystemByNumber(unsigned int number) const
+{
+  int count = 0;
+  tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
+  ParticleSystem* tmpSys = tmpIt->firstElement();
+  while(tmpSys)
+    {
+      count++;
+      if ( count == number)
+        {
+          delete tmpIt;
+          return tmpSys;
+        }
+      tmpSys = tmpIt->nextElement();
+    }
+  delete tmpIt;
+  return NULL;
+}
+
+/**
+ * @param number the n-th emitter to return
+ * @returns the emitter called by number or NULL if not found
+*/
+ParticleEmitter* ParticleEngine::getEmitterByNumber(unsigned int number) const
+{
+  int count = 0;
+  tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator();
+  ParticleEmitter* tmpEmit = tmpIt->firstElement();
+  while(tmpEmit)
+    {
+      count++;
+      if ( count == number)
+        {
+          delete tmpIt;
+          return tmpEmit;
+        }
+      tmpEmit = tmpIt->nextElement();
+    }
+  delete tmpIt;
+  return NULL;
+}
+
+/**
+ *  outputs some nice debug information
+*/
+void ParticleEngine::debug()
+{
+  PRINT(0)("+-----------------------------------+\n");
+  PRINT(0)("+ PARTICLE-ENGINE DEBUG INFORMATION +\n");
+  PRINT(0)("+-----------------------------------+\n");
+  PRINT(0)(" Reference: %p\n", ParticleEngine::singletonRef);
+  PRINT(0)(" Count: Emitters: %d; Systems: %d, Connections: %d\n",
+  this->emitterList->getSize(), this->systemList->getSize(), this->connectionList->getSize());
+
+  if (this->connectionList->getSize() > 0)
+  {
+    PRINT(0)(" Connections:\n");
+    PRINT(0)(" -----------------------------------\n");
+
+    tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+    ParticleConnection* tmpConnection = tmpConIt->firstElement();
+    while(tmpConnection)
+    {
+      PRINT(0)(" Emitter '%s' emitts into System '%s'\n", tmpConnection->emitter->getName(), tmpConnection->system->getName());
+      tmpConnection = tmpConIt->nextElement();
+    }
+    delete tmpConIt;
+  }
+
+  if (this->systemList->getSize() > 0)
+  {
+    tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
+    ParticleSystem* tmpSys = tmpIt->firstElement();
+    while(tmpSys)
+    {
+      tmpSys->debug();
+      tmpSys = tmpIt->nextElement();
+    }
+    delete tmpIt;
+  }
+  else
+  {
+    PRINT(0)("NO SYSTEMS\n");
+  }
+  if (this->emitterList->getSize() > 0)
+  {
+    tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator();
+    ParticleEmitter* tmpEmit = tmpIt->firstElement();
+    while(tmpEmit)
+    {
+      tmpEmit->debug();
+      tmpEmit = tmpIt->nextElement();
+    }
+    delete tmpIt;
+  }
+  else
+  {
+    PRINTF(0)("NO EMITTERS\n");
+  }
+
+  PRINT(0)("+--------------------------------PE-+\n");
+
+}
+
Index: /trunk/src/lib/particles/engine/particle_engine.h
===================================================================
--- /trunk/src/lib/particles/engine/particle_engine.h	(revision 6619)
+++ /trunk/src/lib/particles/engine/particle_engine.h	(revision 6619)
@@ -0,0 +1,72 @@
+/*!
+ * @file particle_engine.h
+  *  Definition of the ParticleEngine
+*/
+
+#ifndef _PARTICLE_ENGINE_H
+#define _PARTICLE_ENGINE_H
+
+#include "base_object.h"
+
+#include "particle_system.h"
+#include "particle_emitter.h"
+
+#include "parser/tinyxml/tinyxml.h"
+
+// FORWARD DECLARATION
+template<class T> class tList;
+
+//! A ParticleConnection enables us to emitt from any emitter into any other particleSystem
+typedef struct ParticleConnection
+{
+  ParticleEmitter*    emitter;     //!< The emitter to emit system from.
+  ParticleSystem*     system;      //!< The Particles emitted from emitter.
+};
+
+//! The physicsEngine handles and stores Systems and Emitters.
+/**
+   It is responsible for driving on the Particles (tick)
+   It draw particles (draw)
+   and it emitts particles into the system
+*/
+class ParticleEngine : public BaseObject {
+
+ public:
+  virtual ~ParticleEngine();
+  /** @returns a Pointer to the only object of this Class */
+  inline static ParticleEngine* getInstance() { if (!singletonRef) singletonRef = new ParticleEngine();  return singletonRef; };
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  void tick(float dt);
+  void draw() const;
+
+  void addSystem(ParticleSystem* system);
+  void addEmitter(ParticleEmitter* emitter);
+  void addConnection(ParticleEmitter* emitter, ParticleSystem* system);
+  void addConnection(const char* emitter, const char* system);
+
+
+  bool removeSystem(ParticleSystem* system);
+  bool removeEmitter(ParticleEmitter* emitter);
+  bool breakConnection(ParticleConnection* connection);
+  bool breakConnection(ParticleEmitter* emitter, ParticleSystem* system);
+  unsigned int breakConnections(ParticleEmitter* emitter);
+  unsigned int breakConnections(ParticleSystem* system);
+
+   ParticleSystem* getSystemByNumber(unsigned int number) const;
+   ParticleEmitter* getEmitterByNumber(unsigned int number) const;
+
+  void debug();
+
+ private:
+  ParticleEngine();
+  static ParticleEngine* singletonRef;        //!< The reference to the engine.
+
+  tList<ParticleSystem>* systemList;          //!< A list of Systems handled by the ParticleEngine.
+  tList<ParticleEmitter>* emitterList;        //!< A list of Emitters handled by the ParticleEngine.
+
+  tList<ParticleConnection>* connectionList;  //!< A list of Connections between Systems and Emitters.
+};
+
+#endif /* _PARTICLE_ENGINE_H */
Index: /trunk/src/lib/particles/particle_emitter.cc
===================================================================
--- /trunk/src/lib/particles/particle_emitter.cc	(revision 6618)
+++ /trunk/src/lib/particles/particle_emitter.cc	(revision 6619)
@@ -19,5 +19,4 @@
 
 #include "particle_system.h"
-#include "particle_engine.h"
 
 #include "load_param.h"
@@ -44,5 +43,4 @@
   this->setEmissionVelocity(velocity);
 
-  ParticleEngine::getInstance()->addEmitter(this);
 }
 
@@ -57,6 +55,4 @@
    if (root != NULL)
      this->loadParams(root);
-
-   ParticleEngine::getInstance()->addEmitter(this);
 }
 
@@ -68,5 +64,4 @@
 ParticleEmitter::~ParticleEmitter ()
 {
-  ParticleEngine::getInstance()->removeEmitter(this);
 }
 
@@ -84,4 +79,6 @@
   this->setSize(PARTICLE_EMITTER_DEFAULT_SIZE);
 
+  this->system = NULL;
+
   this->saveTime = 0.0;
 }
@@ -118,4 +115,13 @@
 
   LoadParam(root, "emission-direction", this, ParticleEmitter, setDirection);
+}
+
+void ParticleEmitter::setSystem(ParticleSystem* system)
+{
+  if (system != NULL)
+    system->addEmitter(this);
+  else if (this->system != NULL)
+    this->system->removeEmitter(this);
+  this->system = system;
 }
 
Index: /trunk/src/lib/particles/particle_emitter.h
===================================================================
--- /trunk/src/lib/particles/particle_emitter.h	(revision 6618)
+++ /trunk/src/lib/particles/particle_emitter.h	(revision 6619)
@@ -21,5 +21,5 @@
 
 //! The form of the Emitter to emit from
-  typedef enum EMITTER_TYPE
+typedef enum EMITTER_TYPE
 {
   EMITTER_DOT     = 1,
@@ -30,7 +30,8 @@
 
 //! A class to handle an Emitter.
-class ParticleEmitter : public PNode {
-
- public:
+class ParticleEmitter : public PNode
+{
+  friend class ParticleSystem;
+public:
   ParticleEmitter(const Vector& direction, float angle = .5,
                   float emissionRate = 1.0, float velocity = 1.0);
@@ -46,4 +47,7 @@
   void tick(float dt, ParticleSystem* system);
 
+  void setSystem(ParticleSystem* system);
+  ParticleSystem* getSystem() const { return this->system; };
+
   /* controlling the behavour: these can be used as Animation interfaces */
   void setType(EMITTER_TYPE type);
@@ -56,5 +60,6 @@
   void setEmissionMomentum(float momentum, float randomMomentum = 0.0);
 
-  void setDirection(float x, float y, float z) { this->direction = Vector(x,y,z); }; //!< todo this should be done via PNODE
+  void setDirection(float x, float y, float z) { this->direction = Vector(x,y,z); }
+  ; //!< todo this should be done via PNODE
 
   /** @returns the type of the emitter */
@@ -77,5 +82,8 @@
   void debug() const;
 
- private:
+
+private:
+  ParticleSystem* system;            //!< The ParticleSystem this Emitter Emits into.
+
   EMITTER_TYPE    type;              //!< The type of emitter this is.
   float           emitterSize;       //!< The size of the emitter (not for EMITTER_DOT).
Index: unk/src/lib/particles/particle_engine.cc
===================================================================
--- /trunk/src/lib/particles/particle_engine.cc	(revision 6618)
+++ 	(revision )
@@ -1,455 +1,0 @@
-/*
-   orxonox - the future of 3D-vertical-scrollers
-
-   Copyright (C) 2004 orx
-
-   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, or (at your option)
-   any later version.
-
-   ### File Specific:
-   main-programmer: ...
-   co-programmer: ...
-*/
-
-#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
-
-#include "particle_engine.h"
-
-#include "class_list.h"
-
-#include "list.h"
-#include "debug.h"
-#include "stdlibincl.h"
-#include "load_param.h"
-
-using namespace std;
-
-/**
- *  standard constructor
-*/
-ParticleEngine::ParticleEngine ()
-{
-   this->setClassID(CL_PARTICLE_ENGINE, "ParticleEngine");
-   this->setName("ParticleEngine");
-
-   this->systemList = new tList<ParticleSystem>;
-   this->emitterList = new tList<ParticleEmitter>;
-   this->connectionList = new tList<ParticleConnection>;
-}
-
-/**
- *  the singleton reference to this class
-*/
-ParticleEngine* ParticleEngine::singletonRef = NULL;
-
-/**
- *  deletes all the system, emitters, connections and Lists
-*/
-ParticleEngine::~ParticleEngine ()
-{
-  /// @todo we must not do this, because PNoe does it for us
-  /// or we do this with help from ClassList, which essentially makes much more sense
-
-  // delete all remaining systems
-//   tIterator<ParticleSystem>* sysIt = this->systemList->getIterator();
-//   ParticleSystem* tmpSys = sysIt->firstElement();
-//   while(tmpSys)
-//     {
-//       delete tmpSys;
-//       tmpSys = sysIt->nextElement();
-//     }
-//   delete sysIt;
-   delete this->systemList;
-//
-   // delete all remaining emitters
-   tIterator<ParticleEmitter>* emitIt = this->emitterList->getIterator();
-   ParticleEmitter* tmpEmit = emitIt->firstElement();
-   while(tmpEmit)
-     {
-       delete tmpEmit;
-       tmpEmit = emitIt->nextElement();
-     }
-   delete emitIt;
-   delete this->emitterList;
-
-  // there should be no more Connections
-  if (this->connectionList->getSize() == 0)
-    delete this->connectionList;
-  else
-    PRINTF(2)("The Connection List is not empty. This should not happen.\n");
-
-  ParticleEngine::singletonRef = NULL;
-}
-
-/**
-  \brief loads the ParticleEngines settings and connections between particles and emitters
-* @param root the XML-element to load this from.
- */
-void ParticleEngine::loadParams(const TiXmlElement* root)
-{
-  LOAD_PARAM_START_CYCLE(root, element);
-  {
-    LoadParam_CYCLE(element, "connect", this, ParticleEngine, addConnection)
-        .describe("connects an Emitter to a System (emitterName, systemName)");
-  }
-  LOAD_PARAM_END_CYCLE(element);
-}
-
-/**
- *  Adds a System to the System list.
-
-   this is done automatically when creating a ParticleSystem
-*/
-void ParticleEngine::addSystem(ParticleSystem* system)
-{
-  this->systemList->add(system);
-}
-
-/**
- *  Adds an emitter to the emitterList
-
-   this is done automatically when creating a ParticleEmitter
-*/
-void ParticleEngine::addEmitter(ParticleEmitter* emitter)
-{
-  this->emitterList->add(emitter);
-}
-
-/**
-* @brief Connects a ParticleSystem to a ParticleSystem thus emitting Particles.
-* @param emitter the Emitter to connect to the System
-* @param system the System to connect to the Emitter
-*/
-void ParticleEngine::addConnection(const char* emitter, const char* system)
-{
-  ParticleEmitter* tmpEmit = dynamic_cast<ParticleEmitter*>(ClassList::getObject(emitter, CL_PARTICLE_EMITTER));//this->getEmitterByName(emitter);
-  ParticleSystem* tmpSys = dynamic_cast<ParticleSystem*>(ClassList::getObject(system, CL_PARTICLE_SYSTEM));//this->getSystemByName(system);
-
-  if (tmpEmit != NULL && tmpSys != NULL)
-    this->addConnection(tmpEmit, tmpSys);
-  else
-  {
-    if (tmpEmit == NULL)
-      PRINTF(2)("Emitter %s not found in the List of emitters, not connecting to %s\n", emitter, system);
-    if (tmpEmit == NULL)
-      PRINTF(2)("System %s not found in the List of emitters, not connecting to %s\n", system, emitter);
-  }
-}
-
-/**
- *  Connects a ParticleSystem to a ParticleSystem thus emitting Particles.
- * @param emitter the Emitter to connect to the System
- * @param system the System to connect to the Emitter
-*/
-void ParticleEngine::addConnection(ParticleEmitter* emitter, ParticleSystem* system)
-{
-  // look, if we have already added this connection
-  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
-  ParticleConnection* tmpConnection = tmpConIt->firstElement();
-  while(tmpConnection)
-    {
-      if (tmpConnection->emitter == emitter && tmpConnection->system == system)
-        {
-          PRINTF(2)("Connection between Emitter and System already exists.\n");
-          delete tmpConIt;
-          return;
-        }
-
-      tmpConnection = tmpConIt->nextElement();
-    }
-  delete tmpConIt;
-
-
-
-  ParticleConnection* tmpCon = new ParticleConnection;
-  tmpCon->emitter = emitter;
-  tmpCon->system = system;
-
-  this->connectionList->add(tmpCon);
-}
-
-/**
- *  Removes a system from the systemList and also removes all Connections to the System
- * @param system The ParticleSystem to delete
-*/
-bool ParticleEngine::removeSystem(ParticleSystem* system)
-{
-  // remove any connections, that have this system within
-  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
-  ParticleConnection* tmpConnection = tmpConIt->firstElement();
-  while(tmpConnection != NULL)
-    {
-      if (tmpConnection->system == system)
-        this->breakConnection(tmpConnection);
-      tmpConnection = tmpConIt->nextElement();
-    }
-  delete tmpConIt;
-
-  // remove the System from the systemList.
-  this->systemList->remove(system);
-}
-
-/**
- *  removes an emitter from the emitterList and also from all Connections it is attached to.
- * @param emitter the ParticleEmitter to remove.
-*/
-bool ParticleEngine::removeEmitter(ParticleEmitter* emitter)
-{
-  // remove any connections, that have this emitter within
-  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
-  ParticleConnection* tmpConnection = tmpConIt->firstElement();
-  while(tmpConnection != NULL)
-    {
-      if (tmpConnection->emitter == emitter)
-        this->breakConnection(tmpConnection);
-      tmpConnection = tmpConIt->nextElement();
-    }
-  delete tmpConIt;
-
-  // remove the emitter from the emitterList
-  this->emitterList->remove(emitter);
-}
-
-
-/**
- *  removes a Connection between an Emitter and a System
- * @param connection the connection to remove
- *
- * \see bool ParticleEngine::breakConnection(ParticleEmitter* emitter, ParticleSystem* system)
- */
-bool ParticleEngine::breakConnection(ParticleConnection* connection)
-{
-  this->connectionList->remove(connection);
-  return true;
-}
-
-/**
- *  removes a Connection between an Emitter and a System
- * @param emitter The emitter of the connection to remove
- * @param system The system of the connection to remove
- * @returns true, if the connection was broken, false if the conntection was not found
- *
- * only if both system and emitter are in the connection the Connection will be broken
-*/
-bool ParticleEngine::breakConnection(ParticleEmitter* emitter, ParticleSystem* system)
-{
-  // look, if we have already added this connection
-  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
-  ParticleConnection* tmpConnection = tmpConIt->firstElement();
-  while(tmpConnection)
-    {
-    if (tmpConnection->emitter == emitter && tmpConnection->system == system)
-      {
-        this->breakConnection(tmpConnection);
-        delete tmpConIt;
-        return true;
-      }
-    tmpConnection = tmpConIt->nextElement();
-    }
-  delete tmpConIt;
-  return false;
-}
-
-/**
- *  removes a Connection between an Emitter and a System
- * @param emitter The emitter of the connections to remove
- * @returns the count of connections that were broken, 0 if no conntection was not found
- */
-unsigned int ParticleEngine::breakConnections(ParticleEmitter* emitter)
-{
-  unsigned int retVal = 0;
-  // look, if we have already added this connection
-  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
-  ParticleConnection* tmpConnection = tmpConIt->firstElement();
-  while(tmpConnection)
-  {
-    if (tmpConnection->emitter == emitter)
-    {
-      this->breakConnection(tmpConnection);
-      retVal++;
-    }
-    tmpConnection = tmpConIt->nextElement();
-  }
-  delete tmpConIt;
-  return retVal;
-}
-
-
-/**
- *  removes a Connection between an Emitter and a System
- * @param system The system of the connections to remove
- * @returns the count of connections that were broken, 0 if no conntection was not found
- */
-unsigned int ParticleEngine::breakConnections(ParticleSystem* system)
-{
-  unsigned int retVal = 0;
-  // look, if we have already added this connection
-  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
-  ParticleConnection* tmpConnection = tmpConIt->firstElement();
-  while(tmpConnection)
-  {
-    if (tmpConnection->system == system)
-    {
-      this->breakConnection(tmpConnection);
-      retVal++;
-    }
-    tmpConnection = tmpConIt->nextElement();
-  }
-  delete tmpConIt;
-  return retVal;
-}
-
-/**
- *  this function ticks all the ParticleSystems, so an animation will flow
- * @param dt passed since last tick
-*/
-void ParticleEngine::tick(float dt)
-{
-  // ticks all the ParticleSystems
-//   tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
-//   ParticleSystem* tmpSys = tmpIt->firstElement();
-//   while(tmpSys)
-//     {
-//       tmpSys->tick(dt);
-//       tmpSys = tmpIt->nextElement();
-//     }
-//   delete tmpIt;
-
-  // add new Particles to each System connected to an Emitter.
-  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
-  ParticleConnection* tmpConnection = tmpConIt->firstElement();
-  while(tmpConnection)
-    {
-      tmpConnection->emitter->tick(dt, tmpConnection->system);
-      tmpConnection = tmpConIt->nextElement();
-    }
-  delete tmpConIt;
-}
-
-/**
- *  draws all the systems and their Particles.
-*/
-void ParticleEngine::draw() const
-{
-  /*
-  tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
-  ParticleSystem* tmpSys = tmpIt->firstElement();
-  while(tmpSys)
-    {
-      tmpSys->draw();
-      tmpSys = tmpIt->nextElement();
-    }
-  delete tmpIt;*/
-
-}
-
-/**
- * @param number the n-th system to return
- * @returns the system called by number or NULL if not found
-*/
-ParticleSystem* ParticleEngine::getSystemByNumber(unsigned int number) const
-{
-  int count = 0;
-  tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
-  ParticleSystem* tmpSys = tmpIt->firstElement();
-  while(tmpSys)
-    {
-      count++;
-      if ( count == number)
-        {
-          delete tmpIt;
-          return tmpSys;
-        }
-      tmpSys = tmpIt->nextElement();
-    }
-  delete tmpIt;
-  return NULL;
-}
-
-/**
- * @param number the n-th emitter to return
- * @returns the emitter called by number or NULL if not found
-*/
-ParticleEmitter* ParticleEngine::getEmitterByNumber(unsigned int number) const
-{
-  int count = 0;
-  tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator();
-  ParticleEmitter* tmpEmit = tmpIt->firstElement();
-  while(tmpEmit)
-    {
-      count++;
-      if ( count == number)
-        {
-          delete tmpIt;
-          return tmpEmit;
-        }
-      tmpEmit = tmpIt->nextElement();
-    }
-  delete tmpIt;
-  return NULL;
-}
-
-/**
- *  outputs some nice debug information
-*/
-void ParticleEngine::debug()
-{
-  PRINT(0)("+-----------------------------------+\n");
-  PRINT(0)("+ PARTICLE-ENGINE DEBUG INFORMATION +\n");
-  PRINT(0)("+-----------------------------------+\n");
-  PRINT(0)(" Reference: %p\n", ParticleEngine::singletonRef);
-  PRINT(0)(" Count: Emitters: %d; Systems: %d, Connections: %d\n",
-  this->emitterList->getSize(), this->systemList->getSize(), this->connectionList->getSize());
-
-  if (this->connectionList->getSize() > 0)
-  {
-    PRINT(0)(" Connections:\n");
-    PRINT(0)(" -----------------------------------\n");
-
-    tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
-    ParticleConnection* tmpConnection = tmpConIt->firstElement();
-    while(tmpConnection)
-    {
-      PRINT(0)(" Emitter '%s' emitts into System '%s'\n", tmpConnection->emitter->getName(), tmpConnection->system->getName());
-      tmpConnection = tmpConIt->nextElement();
-    }
-    delete tmpConIt;
-  }
-
-  if (this->systemList->getSize() > 0)
-  {
-    tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
-    ParticleSystem* tmpSys = tmpIt->firstElement();
-    while(tmpSys)
-    {
-      tmpSys->debug();
-      tmpSys = tmpIt->nextElement();
-    }
-    delete tmpIt;
-  }
-  else
-  {
-    PRINT(0)("NO SYSTEMS\n");
-  }
-  if (this->emitterList->getSize() > 0)
-  {
-    tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator();
-    ParticleEmitter* tmpEmit = tmpIt->firstElement();
-    while(tmpEmit)
-    {
-      tmpEmit->debug();
-      tmpEmit = tmpIt->nextElement();
-    }
-    delete tmpIt;
-  }
-  else
-  {
-    PRINTF(0)("NO EMITTERS\n");
-  }
-
-  PRINT(0)("+--------------------------------PE-+\n");
-
-}
-
Index: unk/src/lib/particles/particle_engine.h
===================================================================
--- /trunk/src/lib/particles/particle_engine.h	(revision 6618)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*!
- * @file particle_engine.h
-  *  Definition of the ParticleEngine
-*/
-
-#ifndef _PARTICLE_ENGINE_H
-#define _PARTICLE_ENGINE_H
-
-#include "base_object.h"
-
-#include "particle_system.h"
-#include "particle_emitter.h"
-
-#include "parser/tinyxml/tinyxml.h"
-
-// FORWARD DECLARATION
-template<class T> class tList;
-
-//! A ParticleConnection enables us to emitt from any emitter into any other particleSystem
-typedef struct ParticleConnection
-{
-  ParticleEmitter*    emitter;     //!< The emitter to emit system from.
-  ParticleSystem*     system;      //!< The Particles emitted from emitter.
-};
-
-//! The physicsEngine handles and stores Systems and Emitters.
-/**
-   It is responsible for driving on the Particles (tick)
-   It draw particles (draw)
-   and it emitts particles into the system
-*/
-class ParticleEngine : public BaseObject {
-
- public:
-  virtual ~ParticleEngine();
-  /** @returns a Pointer to the only object of this Class */
-  inline static ParticleEngine* getInstance() { if (!singletonRef) singletonRef = new ParticleEngine();  return singletonRef; };
-
-  virtual void loadParams(const TiXmlElement* root);
-
-  void tick(float dt);
-  void draw() const;
-
-  void addSystem(ParticleSystem* system);
-  void addEmitter(ParticleEmitter* emitter);
-  void addConnection(ParticleEmitter* emitter, ParticleSystem* system);
-  void addConnection(const char* emitter, const char* system);
-
-
-  bool removeSystem(ParticleSystem* system);
-  bool removeEmitter(ParticleEmitter* emitter);
-  bool breakConnection(ParticleConnection* connection);
-  bool breakConnection(ParticleEmitter* emitter, ParticleSystem* system);
-  unsigned int breakConnections(ParticleEmitter* emitter);
-  unsigned int breakConnections(ParticleSystem* system);
-
-   ParticleSystem* getSystemByNumber(unsigned int number) const;
-   ParticleEmitter* getEmitterByNumber(unsigned int number) const;
-
-  void debug();
-
- private:
-  ParticleEngine();
-  static ParticleEngine* singletonRef;        //!< The reference to the engine.
-
-  tList<ParticleSystem>* systemList;          //!< A list of Systems handled by the ParticleEngine.
-  tList<ParticleEmitter>* emitterList;        //!< A list of Emitters handled by the ParticleEngine.
-
-  tList<ParticleConnection>* connectionList;  //!< A list of Connections between Systems and Emitters.
-};
-
-#endif /* _PARTICLE_ENGINE_H */
Index: /trunk/src/lib/particles/particle_system.cc
===================================================================
--- /trunk/src/lib/particles/particle_system.cc	(revision 6618)
+++ /trunk/src/lib/particles/particle_system.cc	(revision 6619)
@@ -19,5 +19,4 @@
 
 #include "particle_emitter.h"
-#include "particle_engine.h"
 
 #include "field.h"
@@ -69,7 +68,4 @@
 ParticleSystem::~ParticleSystem()
 {
-  // delete what has to be deleted here
-   ParticleEngine::getInstance()->removeSystem(this);
-
    // deleting all the living Particles
    while (this->particles)
@@ -108,5 +104,4 @@
   this->glID = NULL;
   this->setType(PARTICLE_DEFAULT_TYPE, 1);
-  ParticleEngine::getInstance()->addSystem(this);
 
   this->toList(OM_ENVIRON);
@@ -297,4 +292,7 @@
 void ParticleSystem::addEmitter(ParticleEmitter* emitter)
 {
+  assert (emitter != NULL);
+  if (emitter->getSystem() != NULL)
+    emitter->getSystem()->removeEmitter(emitter);
   this->emitters.push_back(emitter);
 }
Index: /trunk/src/story_entities/game_world.cc
===================================================================
--- /trunk/src/story_entities/game_world.cc	(revision 6618)
+++ /trunk/src/story_entities/game_world.cc	(revision 6619)
@@ -47,5 +47,4 @@
 #include "shell_command.h"
 
-#include "particle_engine.h"
 #include "graphics_engine.h"
 #include "event_handler.h"
@@ -339,5 +338,4 @@
     this->dataTank->localCamera->tick(this->dtS);
     AnimationPlayer::getInstance()->tick(this->dtS);
-    ParticleEngine::getInstance()->tick(this->dtS);
     PhysicsEngine::getInstance()->tick(this->dtS);
 
@@ -414,6 +412,4 @@
   engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01));
   engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01_PROJ));
-  /* draws the particles */
-  ParticleEngine::getInstance()->draw();
 
   if( unlikely( this->showBV))
Index: /trunk/src/story_entities/game_world_data.cc
===================================================================
--- /trunk/src/story_entities/game_world_data.cc	(revision 6618)
+++ /trunk/src/story_entities/game_world_data.cc	(revision 6619)
@@ -44,5 +44,4 @@
 #include "load_param.h"
 
-#include "particle_engine.h"
 #include "graphics_engine.h"
 #include "event_handler.h"
@@ -115,5 +114,4 @@
   /* initialize some graphics engines and graphical elements */
   AnimationPlayer::getInstance();
-  ParticleEngine::getInstance();
   PhysicsEngine::getInstance();
 }
@@ -279,5 +277,5 @@
   LoadParamXML(root, "LightManager", LightManager::getInstance(), LightManager, loadParams);
 
-  LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams);
+//  LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams);
   //LoadParamXML(root, "PhysicsEngine", PhysicsEngine::getInstance(), PhysicsEngine, loadParams);
 
@@ -301,5 +299,4 @@
   /* delete some garphics and scene eingines */
   delete LightManager::getInstance();
-  delete ParticleEngine::getInstance();
   delete AnimationPlayer::getInstance();
   delete PhysicsEngine::getInstance();
Index: /trunk/src/world_entities/projectiles/bomb.cc
===================================================================
--- /trunk/src/world_entities/projectiles/bomb.cc	(revision 6618)
+++ /trunk/src/world_entities/projectiles/bomb.cc	(revision 6619)
@@ -25,5 +25,4 @@
 #include "object_manager.h"
 
-#include "particle_engine.h"
 #include "particle_emitter.h"
 #include "particle_system.h"
Index: /trunk/src/world_entities/projectiles/guided_missile.cc
===================================================================
--- /trunk/src/world_entities/projectiles/guided_missile.cc	(revision 6618)
+++ /trunk/src/world_entities/projectiles/guided_missile.cc	(revision 6619)
@@ -23,5 +23,4 @@
 #include "class_list.h"
 
-#include "particle_engine.h"
 #include "particle_emitter.h"
 #include "particle_system.h"
@@ -113,5 +112,5 @@
   }
 
-  ParticleEngine::getInstance()->addConnection(this->emitter, GuidedMissile::trailParticles);
+  this->emitter->setSystem(GuidedMissile::trailParticles);
 
   this->updateNode(0);
@@ -123,5 +122,5 @@
 void GuidedMissile::deactivate()
 {
-  ParticleEngine::getInstance()->breakConnections(this->emitter);
+  this->emitter->setSystem(NULL);
   this->lifeCycle = 0.0;
 
@@ -184,6 +183,5 @@
   PRINTF(5)("DESTROY GuidedMissile\n");
   this->lifeCycle = .95; //!< @todo calculate this usefully.
-  ParticleEngine::getInstance()->breakConnection(this->emitter, GuidedMissile::trailParticles);
-  ParticleEngine::getInstance()->addConnection(this->emitter, GuidedMissile::explosionParticles);
+  this->emitter->setSystem(GuidedMissile::explosionParticles);
 
   this->emitter->setEmissionRate(1000.0);
Index: /trunk/src/world_entities/projectiles/laser.cc
===================================================================
--- /trunk/src/world_entities/projectiles/laser.cc	(revision 6618)
+++ /trunk/src/world_entities/projectiles/laser.cc	(revision 6619)
@@ -24,5 +24,4 @@
 #include "model.h"
 
-#include "particle_engine.h"
 #include "particle_emitter.h"
 #include "particle_system.h"
@@ -93,5 +92,6 @@
 void Laser::deactivate()
 {
-  ParticleEngine::getInstance()->breakConnections(this->emitter);
+  assert (Laser::explosionParticles != NULL);
+  Laser::explosionParticles->removeEmitter(this->emitter);
   this->lifeCycle = 0.0;
 
@@ -130,5 +130,6 @@
   PRINTF(5)("DESTROY Laser\n");
   this->lifeCycle = .95; //!< @todo calculate this usefully.
-  ParticleEngine::getInstance()->addConnection(this->emitter, Laser::explosionParticles);
+
+  this->emitter->setSystem(Laser::explosionParticles);
 }
 
Index: /trunk/src/world_entities/projectiles/rocket.cc
===================================================================
--- /trunk/src/world_entities/projectiles/rocket.cc	(revision 6618)
+++ /trunk/src/world_entities/projectiles/rocket.cc	(revision 6619)
@@ -23,5 +23,4 @@
 #include "class_list.h"
 
-#include "particle_engine.h"
 #include "particle_emitter.h"
 #include "particle_system.h"
@@ -110,5 +109,5 @@
   }
 
-  ParticleEngine::getInstance()->addConnection(this->emitter, Rocket::trailParticles);
+  this->emitter->setSystem(Rocket::trailParticles);
 
   this->updateNode(0);
@@ -120,5 +119,5 @@
 void Rocket::deactivate()
 {
-  ParticleEngine::getInstance()->breakConnections(this->emitter);
+  this->emitter->setSystem(NULL);
   this->lifeCycle = 0.0;
   this->toList(OM_NULL);
@@ -158,6 +157,5 @@
   PRINTF(5)("DESTROY Rocket\n");
   this->lifeCycle = .95; //!< @todo calculate this usefully.
-  ParticleEngine::getInstance()->breakConnection(this->emitter, Rocket::trailParticles);
-  ParticleEngine::getInstance()->addConnection(this->emitter, Rocket::explosionParticles);
+  this->emitter->setSystem(Rocket::explosionParticles);
 
   this->emitter->setEmissionRate(1000.0);
Index: /trunk/src/world_entities/projectiles/test_bullet.cc
===================================================================
--- /trunk/src/world_entities/projectiles/test_bullet.cc	(revision 6618)
+++ /trunk/src/world_entities/projectiles/test_bullet.cc	(revision 6619)
@@ -23,5 +23,4 @@
 #include "class_list.h"
 
-#include "particle_engine.h"
 #include "particle_emitter.h"
 #include "particle_system.h"
@@ -105,5 +104,5 @@
   }
 
-  ParticleEngine::getInstance()->addConnection(this->emitter, TestBullet::trailParticles);
+  this->emitter->setSystem(TestBullet::trailParticles);
 
   this->emitter->setEmissionRate(20.0);
@@ -114,5 +113,5 @@
 void TestBullet::deactivate()
 {
-  ParticleEngine::getInstance()->breakConnections(this->emitter);
+  this->emitter->setSystem(NULL);
   this->lifeCycle = 0.0;
   this->toList(OM_NULL);
@@ -157,6 +156,5 @@
   PRINTF(5)("DESTROY TestBullet\n");
   this->lifeCycle = .95; //!< @todo calculate this usefully.
-  ParticleEngine::getInstance()->breakConnection(this->emitter, TestBullet::trailParticles);
-  ParticleEngine::getInstance()->addConnection(this->emitter, TestBullet::explosionParticles);
+  this->emitter->setSystem(TestBullet::explosionParticles);
 
   this->emitter->setEmissionRate(30.0);
