Index: trunk/src/ability.cc
===================================================================
--- trunk/src/ability.cc	(revision 9391)
+++ trunk/src/ability.cc	(revision 9406)
@@ -1,5 +1,5 @@
 
 
-/* 
+/*
    orxonox - the future of 3D-vertical-scrollers
 
@@ -20,5 +20,5 @@
 
 
-using namespace std;
+
 
 
Index: trunk/src/ai/ai.cc
===================================================================
--- trunk/src/ai/ai.cc	(revision 9391)
+++ trunk/src/ai/ai.cc	(revision 9406)
@@ -20,5 +20,5 @@
 
 
-using namespace std;
+
 
 
Index: trunk/src/defs/class_id.h
===================================================================
--- trunk/src/defs/class_id.h	(revision 9391)
+++ trunk/src/defs/class_id.h	(revision 9406)
@@ -127,4 +127,5 @@
   CL_NETWORK_MANAGER            =    0x00000050,
   CL_SHARED_NETWORK_DATA        =    0x00000051,
+  CL_NETWORK_SETTINGS           =    0x00000052,
   CL_ATMOSPHERIC_ENGINE         =    0x00000061,
 
@@ -422,4 +423,5 @@
   CL_PLAYER_STATS               =    0x00000d09,
   CL_SIMPLE_SYNC                =    0x00000d0a,
+  CL_NETWORK_MONITOR            =    0x00000d0b,
 
 
Index: trunk/src/defs/globals.h
===================================================================
--- trunk/src/defs/globals.h	(revision 9391)
+++ trunk/src/defs/globals.h	(revision 9406)
@@ -47,4 +47,5 @@
 
 #define   CONFIG_NAME_FULLSCREEN           "Fullscreen-mode"
+#define   CONFIG_NAME_NO_RENDER            "Norender-mode"
 #define   CONFIG_NAME_RESOLUTION           "Resolution"
 #define   CONFIG_NAME_WIREFRAME            "WireFrame-mode"
Index: trunk/src/lib/Makefile.am
===================================================================
--- trunk/src/lib/Makefile.am	(revision 9391)
+++ trunk/src/lib/Makefile.am	(revision 9406)
@@ -31,7 +31,7 @@
 	collision_detection \
 	collision_reaction \
+	gui \
 	network \
 	parser \
 	shell \
-	script_engine \
-	gui
+	script_engine
Index: trunk/src/lib/collision_detection/aabb.cc
===================================================================
--- trunk/src/lib/collision_detection/aabb.cc	(revision 9391)
+++ trunk/src/lib/collision_detection/aabb.cc	(revision 9406)
@@ -19,5 +19,5 @@
 #include "vector.h"
 
-using namespace std;
+
 
 
Index: trunk/src/lib/collision_detection/aabb_tree_node.cc
===================================================================
--- trunk/src/lib/collision_detection/aabb_tree_node.cc	(revision 9391)
+++ trunk/src/lib/collision_detection/aabb_tree_node.cc	(revision 9406)
@@ -34,5 +34,5 @@
 
 
-using namespace std;
+
 
 
@@ -262,6 +262,4 @@
     const int* triangleIndexes, int length)
 {
-
-  Vector         axis[3];                            //!< the references to the obb axis
   Matrix         covMat(  box.covarianceMatrix  );   //!< covariance matrix (in the matrix dataform)
 
@@ -501,5 +499,5 @@
   if( this->overlapTest(this->bvElement, treeNode->bvElement, nodeA, nodeB))
   {
-    PRINTF(5)("collision @ lvl %i, object %s vs. %s, (%p, %p)\n", this->depth, nodeA->getClassName(), nodeB->getClassName(), this->nodeLeft, this->nodeRight);
+    PRINTF(5)("collision @ lvl %i, object %s::%s vs. %s::%s, (%p, %p)\n", this->depth, nodeA->getClassCName(), nodeA->getCName(), nodeB->getClassCName(), nodeA->getCName(), this->nodeLeft, this->nodeRight);
 
 
Index: trunk/src/lib/collision_detection/bounding_sphere.cc
===================================================================
--- trunk/src/lib/collision_detection/bounding_sphere.cc	(revision 9391)
+++ trunk/src/lib/collision_detection/bounding_sphere.cc	(revision 9406)
@@ -18,5 +18,5 @@
 #include "bounding_sphere.h"
 
-using namespace std;
+
 
 
Index: trunk/src/lib/collision_detection/bounding_volume.cc
===================================================================
--- trunk/src/lib/collision_detection/bounding_volume.cc	(revision 9391)
+++ trunk/src/lib/collision_detection/bounding_volume.cc	(revision 9406)
@@ -18,5 +18,5 @@
 #include "bounding_volume.h"
 
-using namespace std;
+
 
 
Index: trunk/src/lib/collision_detection/bv_tree.cc
===================================================================
--- trunk/src/lib/collision_detection/bv_tree.cc	(revision 9391)
+++ trunk/src/lib/collision_detection/bv_tree.cc	(revision 9406)
@@ -18,5 +18,5 @@
 #include "bv_tree.h"
 
-using namespace std;
+
 
 
Index: trunk/src/lib/collision_detection/bv_tree_node.cc
===================================================================
--- trunk/src/lib/collision_detection/bv_tree_node.cc	(revision 9391)
+++ trunk/src/lib/collision_detection/bv_tree_node.cc	(revision 9406)
@@ -18,5 +18,5 @@
 #include "bv_tree_node.h"
 
-using namespace std;
+
 
 
Index: trunk/src/lib/collision_detection/cd_engine.cc
===================================================================
--- trunk/src/lib/collision_detection/cd_engine.cc	(revision 9391)
+++ trunk/src/lib/collision_detection/cd_engine.cc	(revision 9406)
@@ -34,5 +34,5 @@
 #include "bsp_entity.h"
 
-using namespace std;
+
 
 
@@ -45,5 +45,5 @@
 
   this->bAbordOnFirstCollision = false;
-  
+
   this->terrain = NULL;
 }
@@ -86,5 +86,6 @@
         if( likely((*entity2) != this->terrain))
         {
-          PRINTF(5)("checking object %s (%s) against %s (%s)\n", (*entity1)->getClassName(), (*entity1)->getName(), (*entity2)->getClassName(), (*entity2)->getName());
+          PRINTF(5)("checking object %s (%s) against %s (%s)\n",
+            (*entity1)->getClassCName(), (*entity1)->getCName(), (*entity2)->getClassCName(), (*entity2)->getCName());
           tree = (*entity1)->getOBBTree();
           if( likely(tree != NULL) && (*entity2)->getOBBTree() != NULL)
@@ -113,5 +114,5 @@
       for(entityIterator = list1.begin(); entityIterator != list1.end(); entityIterator++)
       {
-//         PRINTF(0)("Checking: %s a %s\n", (*entityIterator)->getName(), (*entityIterator)->getClassName());
+//         PRINTF(0)("Checking: %s a %s\n", (*entityIterator)->getName(), (*entityIterator)->getClassCName());
         (dynamic_cast<BspEntity*>(*bspIterator)->getBspManager())->checkCollision(*entityIterator);
       }
Index: trunk/src/lib/collision_detection/obb.cc
===================================================================
--- trunk/src/lib/collision_detection/obb.cc	(revision 9391)
+++ trunk/src/lib/collision_detection/obb.cc	(revision 9406)
@@ -19,5 +19,5 @@
 #include "vector.h"
 
-using namespace std;
+
 
 
Index: trunk/src/lib/collision_detection/obb_tree.cc
===================================================================
--- trunk/src/lib/collision_detection/obb_tree.cc	(revision 9391)
+++ trunk/src/lib/collision_detection/obb_tree.cc	(revision 9406)
@@ -25,5 +25,5 @@
 #include "p_node.h"
 
-using namespace std;
+
 
 
Index: trunk/src/lib/collision_detection/obb_tree_node.cc
===================================================================
--- trunk/src/lib/collision_detection/obb_tree_node.cc	(revision 9391)
+++ trunk/src/lib/collision_detection/obb_tree_node.cc	(revision 9406)
@@ -33,5 +33,5 @@
 
 
-using namespace std;
+
 
 
@@ -434,4 +434,5 @@
     }
   }
+  delete [] triangleCenter;
   PRINTF(4)("\nPartition1: got \t%i Vertices \nPartition2: got \t%i Vertices\n", partition1.size(), partition2.size());
 
@@ -476,10 +477,10 @@
     return;
 
-  float distanceMax = this->bvElement->radius + ((OBBTreeNode*)treeNode)->bvElement->radius;
-  float distance = fabs((nodeA->getAbsCoor() - nodeB->getAbsCoor()).len());
+//   float distanceMax = this->bvElement->radius + ((OBBTreeNode*)treeNode)->bvElement->radius;
+//   float distance = fabs((nodeA->getAbsCoor() - nodeB->getAbsCoor()).len());
 
 
 //   if( distance < distanceMax)
-//     PRINTF(0)(" %s (%s: group %i) vs %s (%s: group %i): distanceMax: %f, distance: %f\n", nodeA->getClassName(), nodeA->getName(), nodeA->getOMListNumber(), nodeB->getClassName(),  nodeB->getName(), nodeB->getOMListNumber(), distanceMax, distance);
+//     PRINTF(0)(" %s (%s: group %i) vs %s (%s: group %i): distanceMax: %f, distance: %f\n", nodeA->getClassCName(), nodeA->getName(), nodeA->getOMListNumber(), nodeB->getClassCName(),  nodeB->getName(), nodeB->getOMListNumber(), distanceMax, distance);
 
 
@@ -504,5 +505,5 @@
   if( this->overlapTest(this->bvElement, treeNode->bvElement, nodeA, nodeB))
   {
-    PRINTF(5)("collision @ lvl %i, object %s vs. %s, (%p, %p)\n", this->depth, nodeA->getClassName(), nodeB->getClassName(), this->nodeLeft, this->nodeRight);
+    PRINTF(5)("collision @ lvl %i, object %s vs. %s, (%p, %p)\n", this->depth, nodeA->getClassCName(), nodeB->getClassCName(), this->nodeLeft, this->nodeRight);
 
 
@@ -806,5 +807,5 @@
       if( this->obbTree->getOwner() != NULL)
       {
-        PRINTF(4)("debug poly draw: depth: %i, mode: %i, entity-name: %s, class: %s\n", depth, drawMode, this->obbTree->getOwner()->getName(), this->obbTree->getOwner()->getClassName());
+        PRINTF(4)("debug poly draw: depth: %i, mode: %i, entity-name: %s, class: %s\n", depth, drawMode, this->obbTree->getOwner()->getCName(), this->obbTree->getOwner()->getClassCName());
       }
       else
Index: trunk/src/lib/collision_reaction/collision.cc
===================================================================
--- trunk/src/lib/collision_reaction/collision.cc	(revision 9391)
+++ trunk/src/lib/collision_reaction/collision.cc	(revision 9406)
@@ -19,5 +19,5 @@
 #include "debug.h"
 
-using namespace std;
+
 
 
Index: trunk/src/lib/collision_reaction/collision_event.cc
===================================================================
--- trunk/src/lib/collision_reaction/collision_event.cc	(revision 9391)
+++ trunk/src/lib/collision_reaction/collision_event.cc	(revision 9406)
@@ -19,5 +19,5 @@
 #include "debug.h"
 
-using namespace std;
+
 
 
Index: trunk/src/lib/collision_reaction/collision_handle.cc
===================================================================
--- trunk/src/lib/collision_reaction/collision_handle.cc	(revision 9391)
+++ trunk/src/lib/collision_reaction/collision_handle.cc	(revision 9406)
@@ -29,5 +29,5 @@
 #include "debug.h"
 
-using namespace std;
+
 
 
@@ -178,5 +178,5 @@
 
  c->registerCollisionEvent(collisionEvent);
- PRINTF(5)("Registering Collision Event: %s, %s\n", collisionEvent->getEntityA()->getClassName(), collisionEvent->getEntityB()->getClassName());
+ PRINTF(5)("Registering Collision Event: %s, %s\n", collisionEvent->getEntityA()->getClassCName(), collisionEvent->getEntityB()->getClassCName());
 }
 
@@ -204,5 +204,5 @@
 
   // collision reaction calculations (for every collision there will be a reaction)
-  vector<Collision*>::iterator it = this->collisionList.begin();
+  std::vector<Collision*>::iterator it = this->collisionList.begin();
   for(; it < this->collisionList.end(); it++) {
     if( !(*it)->isDispatched())
@@ -227,24 +227,24 @@
 bool CollisionHandle::filterCollisionEvent(CollisionEvent* collisionEvent)
 {
-  vector<long>::iterator it = this->targetList.begin();
+  std::vector<long>::iterator it = this->targetList.begin();
   for(; it < this->targetList.end(); it++)
   {
 //     if(collisionEvent->getEntityB()->isA(CL_AIMING_SYSTEM) || collisionEvent->getEntityA()->isA(CL_AIMING_SYSTEM))
 //     {
-//        PRINTF(0)("I am: %s colliding with: %s\n", owner->getClassName(), collisionEvent->getEntityB()->getClassName(), *it);
+//        PRINTF(0)("I am: %s colliding with: %s\n", owner->getClassCName(), collisionEvent->getEntityB()->getClassCName(), *it);
 //        if( collisionEvent->getEntityA() == this->owner) {
-//          PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassName(),
-//          collisionEvent->getEntityB()->getClassName(), *it);
+//          PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassCName(),
+//          collisionEvent->getEntityB()->getClassCName(), *it);
 //          if( collisionEvent->getEntityB()->isA((ClassID)(*it))) {
-//            PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(),
-//            collisionEvent->getEntityB()->getClassName(), *it);
+//            PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassCName(),
+//            collisionEvent->getEntityB()->getClassCName(), *it);
 //             }
 //        }
 //        else {
-//          PRINTF(0)("I am not owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassName(),
-//          collisionEvent->getEntityB()->getClassName(), *it);
+//          PRINTF(0)("I am not owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassCName(),
+//          collisionEvent->getEntityB()->getClassCName(), *it);
 //          if( collisionEvent->getEntityA()->isA((ClassID)(*it))) {
-//            PRINTF(0)("I'm not owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(),
-//            collisionEvent->getEntityA()->getClassName(), *it);
+//            PRINTF(0)("I'm not owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassCName(),
+//            collisionEvent->getEntityA()->getClassCName(), *it);
 //             }
 //        }
@@ -254,12 +254,12 @@
     if( collisionEvent->getEntityA() == this->owner) {
       if( collisionEvent->getEntityB()->isA((ClassID)(*it))) {
-        PRINTF(5)("I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(),
-                  collisionEvent->getEntityB()->getClassName(), *it);
+        PRINTF(5)("I am: %s colliding with: %s is a %i filter ok\n", owner->getClassCName(),
+                  collisionEvent->getEntityB()->getClassCName(), *it);
         return true; }
     }
     else {
       if( collisionEvent->getEntityA()->isA((ClassID)(*it))) {
-        PRINTF(5)("I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(),
-                  collisionEvent->getEntityA()->getClassName(), *it);
+        PRINTF(5)("I am: %s colliding with: %s is a %i filter ok\n", owner->getClassCName(),
+                  collisionEvent->getEntityA()->getClassCName(), *it);
       return true; }
     }
@@ -276,5 +276,5 @@
 bool CollisionHandle::filterCollision(Collision* collision)
 {
-  vector<long>::iterator it = this->targetList.begin();
+  std::vector<long>::iterator it = this->targetList.begin();
   for(; it < this->targetList.end(); it++)
   {
@@ -282,19 +282,19 @@
 //     if(collision->getEntityB()->isA(CL_AIMING_SYSTEM) || collision->getEntityA()->isA(CL_AIMING_SYSTEM))
 //     {
-//       PRINTF(0)("Shared!!! I am: %s colliding with: %s\n", owner->getClassName(), collision->getEntityB()->getClassName(), *it);
+//       PRINTF(0)("Shared!!! I am: %s colliding with: %s\n", owner->getClassCName(), collision->getEntityB()->getClassCName(), *it);
 //       if( collision->getEntityA() == this->owner) {
-//         PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassName(),
-//         collision->getEntityB()->getClassName(), *it);
+//         PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassCName(),
+//         collision->getEntityB()->getClassCName(), *it);
 //         if( collision->getEntityB()->isA((ClassID)(*it))) {
-//           PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(),
-//           collision->getEntityB()->getClassName(), *it);
+//           PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassCName(),
+//           collision->getEntityB()->getClassCName(), *it);
 //         }
 //       }
 //       else {
-//         PRINTF(0)("I'm not owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassName(),
-//         collision->getEntityB()->getClassName(), *it);
+//         PRINTF(0)("I'm not owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassCName(),
+//         collision->getEntityB()->getClassCName(), *it);
 //         if( collision->getEntityA()->isA((ClassID)(*it))) {
-//           PRINTF(0)("I'm not owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(),
-//           collision->getEntityA()->getClassName(), *it);
+//           PRINTF(0)("I'm not owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassCName(),
+//           collision->getEntityA()->getClassCName(), *it);
 //         }
 //       }
Index: trunk/src/lib/collision_reaction/collision_reaction.cc
===================================================================
--- trunk/src/lib/collision_reaction/collision_reaction.cc	(revision 9391)
+++ trunk/src/lib/collision_reaction/collision_reaction.cc	(revision 9406)
@@ -19,5 +19,5 @@
 
 
-using namespace std;
+
 
 
Index: trunk/src/lib/collision_reaction/cr_engine.cc
===================================================================
--- trunk/src/lib/collision_reaction/cr_engine.cc	(revision 9391)
+++ trunk/src/lib/collision_reaction/cr_engine.cc	(revision 9406)
@@ -27,5 +27,5 @@
 #include "debug.h"
 
-using namespace std;
+
 
 
@@ -61,8 +61,8 @@
   this->reset();
 
-  vector<Collision*>::iterator it1 = this->collisionsUnused.begin();
+  std::vector<Collision*>::iterator it1 = this->collisionsUnused.begin();
   for(; it1 < this->collisionsUnused.end(); it1++)
     delete *it1;
-  vector<CollisionEvent*>::iterator it2 = this->collisionEventsUnused.begin();
+  std::vector<CollisionEvent*>::iterator it2 = this->collisionEventsUnused.begin();
   for(; it2 < this->collisionEventsUnused.end(); it2++)
     delete *it2;
@@ -92,5 +92,5 @@
   // first clear all CollisionHandles
 
-  vector<CollisionHandle*>::iterator it = this->collisionHandles.begin();
+  std::vector<CollisionHandle*>::iterator it = this->collisionHandles.begin();
   for(; it < this->collisionHandles.end(); it++)
   {
@@ -159,9 +159,9 @@
 void CREngine::flushCollisions()
 {
-  vector<Collision*>::iterator it1 = this->collisionsUsed.begin();
+  std::vector<Collision*>::iterator it1 = this->collisionsUsed.begin();
   for(; it1 < this->collisionsUsed.end(); it1++)
     this->collisionsUnused.push_back(*it1);
 
-  vector<CollisionEvent*>::iterator it2 = this->collisionEventsUsed.begin();
+  std::vector<CollisionEvent*>::iterator it2 = this->collisionEventsUsed.begin();
   for(; it2 < this->collisionEventsUsed.end(); it2++)
     this->collisionEventsUnused.push_back(*it2);
Index: trunk/src/lib/collision_reaction/cr_object_damage.cc
===================================================================
--- trunk/src/lib/collision_reaction/cr_object_damage.cc	(revision 9391)
+++ trunk/src/lib/collision_reaction/cr_object_damage.cc	(revision 9406)
@@ -26,5 +26,5 @@
 #include "debug.h"
 
-using namespace std;
+
 
 
@@ -57,6 +57,6 @@
 
   PRINTF(4)("Dealing damage - Handling collision: %s vs %s\n",
-            collision->getEntityA()->getClassName(),
-            collision->getEntityB()->getClassName());
+            collision->getEntityA()->getClassCName(),
+            collision->getEntityB()->getClassCName());
 
   // the collision damage been dealed by the entity
@@ -64,5 +64,5 @@
     damage = collision->getEntityB()->getDamage();
     collision->getEntityA()->hit(damage, collision->getEntityB());
-    PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityA()->getClassName());
+    PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityA()->getClassCName());
   }
 
@@ -70,5 +70,5 @@
     damage = collision->getEntityA()->getDamage();
     collision->getEntityB()->hit(damage, collision->getEntityA());
-    PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityB()->getClassName());
+    PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityB()->getClassCName());
   }
 
Index: trunk/src/lib/collision_reaction/cr_physics_full_walk.cc
===================================================================
--- trunk/src/lib/collision_reaction/cr_physics_full_walk.cc	(revision 9391)
+++ trunk/src/lib/collision_reaction/cr_physics_full_walk.cc	(revision 9406)
@@ -33,5 +33,5 @@
 #include "cr_defs.h"
 
-using namespace std;
+
 
 
Index: trunk/src/lib/collision_reaction/cr_physics_ground_walk.cc
===================================================================
--- trunk/src/lib/collision_reaction/cr_physics_ground_walk.cc	(revision 9391)
+++ trunk/src/lib/collision_reaction/cr_physics_ground_walk.cc	(revision 9406)
@@ -33,5 +33,5 @@
 #include "cr_defs.h"
 
-using namespace std;
+
 
 
Index: trunk/src/lib/coord/p_node.cc
===================================================================
--- trunk/src/lib/coord/p_node.cc	(revision 9391)
+++ trunk/src/lib/coord/p_node.cc	(revision 9406)
@@ -21,4 +21,6 @@
 #include "class_list.h"
 
+#include "netdefs.h"
+
 #include <algorithm>
 #include "compiler.h"
@@ -27,6 +29,4 @@
 #include "glincl.h"
 #include "color.h"
-
-#include "synchronizeable.h"
 
 /**
@@ -77,5 +77,5 @@
 PNode::~PNode ()
 {
-  PRINTF(4)("delete %s::%s\n", this->getClassName(), this->getName());
+  PRINTF(4)("delete %s::%s\n", this->getClassCName(), this->getCName());
   // remove the Node, delete it's children (if required).
   std::list<PNode*>::iterator deleteNode;
@@ -91,6 +91,6 @@
       {
         PRINTF(4)("%s::%s deletes %s::%s\n",
-                  this->getClassName(), this->getName(),
-                  (*deleteNode)->getClassName(), (*deleteNode)->getName());
+                  this->getClassCName(), this->getCName(),
+                  (*deleteNode)->getClassCName(), (*deleteNode)->getCName());
         delete (*deleteNode);
       }
@@ -98,6 +98,6 @@
       {
         PRINTF(4)("%s::%s reparents %s::%s\n",
-                  this->getClassName(), this->getName(),
-                  (*deleteNode)->getClassName(), (*deleteNode)->getName());
+                  this->getClassCName(), this->getCName(),
+                  (*deleteNode)->getClassCName(), (*deleteNode)->getCName());
         (*deleteNode)->reparent();
       }
@@ -106,6 +106,6 @@
     {
       PRINTF(4)("%s::%s deletes PNode: %s::%s\n",
-                this->getClassName(), this->getName(),
-                (*deleteNode)->getClassName(), (*deleteNode)->getName());
+                this->getClassCName(), this->getCName(),
+                (*deleteNode)->getClassCName(), (*deleteNode)->getCName());
       delete (*deleteNode);
     }
@@ -509,5 +509,5 @@
   {
     PRINTF(1)("Tried to reparent to own child '%s::%s' to '%s::%s'.\n",
-              this->getClassName(), this->getName(), child->getClassName(), child->getName());
+              this->getClassCName(), this->getCName(), child->getClassCName(), child->getCName());
     child->parent = NULL;
     child->parentCoorChanged();
@@ -519,10 +519,10 @@
 {
   PNode* tmpNode = node->parent;
-  printf("entering seek PNode loop for name: %s, uid: %i\n", node->getName(), node->getUniqueID());
+  printf("entering seek PNode loop for name: %s, uid: %i\n", node->getCName(), node->getUniqueID());
   if(tmpNode)
-    printf("  @node name: %s, uid: %d\n", tmpNode->getName(), tmpNode->getUniqueID());
+    printf("  @node name: %s, uid: %d\n", tmpNode->getCName(), tmpNode->getUniqueID());
   while( tmpNode != NULL && tmpNode->getUniqueID() == NET_UID_UNASSIGNED)
   {
-    printf("  @node name: %s, uid: %d\n", tmpNode->getName(), tmpNode->getUniqueID());
+    printf("  @node name: %s, uid: %d\n", tmpNode->getCName(), tmpNode->getUniqueID());
     tmpNode = tmpNode->parent;
   }
@@ -604,7 +604,7 @@
         (*reparenter)->parentMode & PNODE_REPARENT_ON_PARENTS_REMOVE)
     {
-      printf("TEST----------------%s ---- %s\n", this->getClassName(), (*reparenter)->getClassName());
+      printf("TEST----------------%s ---- %s\n", this->getClassCName(), (*reparenter)->getClassCName());
       (*reparenter)->reparent();
-      printf("REPARENTED TO: %s::%s\n",(*reparenter)->getParent()->getClassName(),(*reparenter)->getParent()->getName());
+      printf("REPARENTED TO: %s::%s\n",(*reparenter)->getParent()->getClassCName(),(*reparenter)->getParent()->getCName());
     }
   }
@@ -628,5 +628,5 @@
   else
     PRINTF(2)("Not Found PNode's (%s::%s) new Parent by Name: %s\n",
-        this->getClassName(), this->getName(), parentName.c_str());
+        this->getClassCName(), this->getCName(), parentName.c_str());
 }
 
@@ -785,5 +785,5 @@
           delete this->toCoordinate;
           this->toCoordinate = NULL;
-          PRINTF(5)("SmoothMove of %s finished\n", this->getName());
+          PRINTF(5)("SmoothMove of %s finished\n", this->getCName());
         }
       }
@@ -793,5 +793,5 @@
         if (unlikely (shiftLen >= 1.0))
           shiftLen = 1.0;
-        //printf("%s::%s %f\n", this->getClassName(), this->getName(), this->toStep );
+        //printf("%s::%s %f\n", this->getClassCName(), this->getName(), this->toStep );
         Quaternion rotQuat = Quaternion::quatSlerp(this->relDirection,*this->toDirection, shiftLen);
         if (this->relDirection.distance(rotQuat) > PNODE_ITERATION_DELTA)
@@ -804,5 +804,5 @@
           delete this->toDirection;
           this->toDirection = NULL;
-          PRINTF(5)("SmoothRotate of %s finished\n", this->getName());
+          PRINTF(5)("SmoothRotate of %s finished\n", this->getCName());
           this->bRelDirChanged = true;
         }
@@ -812,5 +812,5 @@
       this->lastAbsCoordinate = this->absCoordinate;
 
-      PRINTF(5)("PNode::update - '%s::%s' - (%f, %f, %f)\n", this->getClassName(), this->getName(),
+      PRINTF(5)("PNode::update - '%s::%s' - (%f, %f, %f)\n", this->getClassCName(), this->getCName(),
                 this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z);
 
@@ -840,5 +840,5 @@
     else // Nodes without a Parent are handled faster :: MOST LIKELY THE NULLPARENT
     {
-      PRINTF(4)("update ParentLess Node (%s::%s) - (%f, %f, %f)\n", this->getClassName(), this->getName(),
+      PRINTF(4)("update ParentLess Node (%s::%s) - (%f, %f, %f)\n", this->getClassCName(), this->getCName(),
                 this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z);
       if (this->bRelCoorChanged)
@@ -913,6 +913,6 @@
 
   PRINT(0)("PNode(%s::%s) - absCoord: (%0.2f, %0.2f, %0.2f), relCoord(%0.2f, %0.2f, %0.2f), direction(%0.2f, %0.2f, %0.2f) - %s - %d childs\n",
-           this->getClassName(),
-           this->getName(),
+           this->getClassCName(),
+           this->getCName(),
            this->absCoordinate.x,
            this->absCoordinate.y,
@@ -1090,5 +1090,5 @@
 {
   Synchronizeable::varChangeHandler( id );
-  
+
   if ( std::find( id.begin(), id.end(), relCoordinate_handle ) != id.end() )
   {
Index: trunk/src/lib/coord/p_node.h
===================================================================
--- trunk/src/lib/coord/p_node.h	(revision 9391)
+++ trunk/src/lib/coord/p_node.h	(revision 9406)
@@ -20,5 +20,4 @@
 
 #include "base_object.h"
-#include "stdincl.h"
 #include "synchronizeable.h"
 
@@ -112,5 +111,5 @@
   /** @returns the absolute position */
   inline const Vector& getLastAbsCoor () const { return this->lastAbsCoordinate; };
-  
+
   void shiftCoor (const Vector& shift);
   void shiftCoor (float x, float y, float z) { this->shiftCoor(Vector(x, y, z)); };
Index: trunk/src/lib/event/event_handler.cc
===================================================================
--- trunk/src/lib/event/event_handler.cc	(revision 9391)
+++ trunk/src/lib/event/event_handler.cc	(revision 9406)
@@ -207,5 +207,5 @@
       else
       {
-        PRINTF(2)("%s::%s was already subscribed to state %d event %d\n", el->getClassName(), el->getName(), i, eventType);
+        PRINTF(2)("%s::%s was already subscribed to state %d event %d\n", el->getClassCName(), el->getCName(), i, eventType);
       }
   }
@@ -216,5 +216,5 @@
     else
     {
-      PRINTF(2)("%s::%s was already subscribed to state %d event %d\n", el->getClassName(), el->getName(), state, eventType);
+      PRINTF(2)("%s::%s was already subscribed to state %d event %d\n", el->getClassCName(), el->getCName(), state, eventType);
     }
   }
@@ -463,5 +463,10 @@
   {
     PRINT(4)("=  Event dispatcher msg: This event has been consumed\n");
-    PRINT(4)("=  Got Event nr %i, for state %i (%d registered) to %s::%s(%p)\n", event.type, i, state, this->listeners[state][event.type][i]->getClassName(), this->listeners[state][event.type][i]->getName(), this->listeners[state][event.type][i]);
+    PRINT(4)("=  Got Event nr %i, for state %i (%d registered) to %s::%s(%p)\n",
+      event.type,
+      i, state,
+      this->listeners[state][event.type][i]->getClassCName(),
+      this->listeners[state][event.type][i]->getCName(),
+      this->listeners[state][event.type][i]);
     PRINT(4)("=======================================================\n");
     this->listeners[state][event.type][i]->process(event);
@@ -563,5 +568,5 @@
         EVToKeyName(j).c_str(), j,
         ELStateToString((elState)i).c_str(), i,
-        this->listeners[i][j][evl]->getName(), this->listeners[i][j][evl]);
+        this->listeners[i][j][evl]->getCName(), this->listeners[i][j][evl]);
   }
   PRINT(0)("============================EH=\n");
Index: trunk/src/lib/event/key_mapper.cc
===================================================================
--- trunk/src/lib/event/key_mapper.cc	(revision 9391)
+++ trunk/src/lib/event/key_mapper.cc	(revision 9406)
@@ -31,5 +31,5 @@
 
 
-using namespace std;
+
 
 
Index: trunk/src/lib/graphics/effects/atmospheric_engine.cc
===================================================================
--- trunk/src/lib/graphics/effects/atmospheric_engine.cc	(revision 9391)
+++ trunk/src/lib/graphics/effects/atmospheric_engine.cc	(revision 9406)
@@ -25,5 +25,5 @@
 
 
-using namespace std;
+
 
 /**
@@ -116,5 +116,5 @@
         std::list<BaseObject*>::const_iterator it;
         for (it = weatherEffects->begin(); it != weatherEffects->end(); it++) {
-            /*      printf("%s::%s \n", (*it)->getClassName(), (*it)->getName());*/
+            /*      printf("%s::%s \n", (*it)->getClassCName(), (*it)->getName());*/
             dynamic_cast<WeatherEffect*>(*it)->tick(dt);
         }
Index: trunk/src/lib/graphics/effects/cloud_effect.cc
===================================================================
--- trunk/src/lib/graphics/effects/cloud_effect.cc	(revision 9391)
+++ trunk/src/lib/graphics/effects/cloud_effect.cc	(revision 9406)
@@ -40,5 +40,5 @@
 float     CloudEffect::fadeTime;
 
-using namespace std;
+
 
 SHELL_COMMAND(activate, CloudEffect, activateCloud);
Index: trunk/src/lib/graphics/effects/fog_effect.cc
===================================================================
--- trunk/src/lib/graphics/effects/fog_effect.cc	(revision 9391)
+++ trunk/src/lib/graphics/effects/fog_effect.cc	(revision 9406)
@@ -28,5 +28,5 @@
 SHELL_COMMAND(fadeout, FogEffect, fadeOutFog);
 
-using namespace std;
+
 
 CREATE_SCRIPTABLE_CLASS(FogEffect, CL_FOG_EFFECT,
Index: trunk/src/lib/graphics/effects/graphics_effect.cc
===================================================================
--- trunk/src/lib/graphics/effects/graphics_effect.cc	(revision 9391)
+++ trunk/src/lib/graphics/effects/graphics_effect.cc	(revision 9406)
@@ -23,5 +23,5 @@
 
 
-using namespace std;
+
 
 
Index: trunk/src/lib/graphics/effects/lense_flare.cc
===================================================================
--- trunk/src/lib/graphics/effects/lense_flare.cc	(revision 9391)
+++ trunk/src/lib/graphics/effects/lense_flare.cc	(revision 9406)
@@ -34,5 +34,5 @@
 
 
-using namespace std;
+
 
 
Index: trunk/src/lib/graphics/effects/lightning_effect.cc
===================================================================
--- trunk/src/lib/graphics/effects/lightning_effect.cc	(revision 9391)
+++ trunk/src/lib/graphics/effects/lightning_effect.cc	(revision 9406)
@@ -34,5 +34,5 @@
 SHELL_COMMAND(deactivate, LightningEffect, deactivateLightning);
 
-using namespace std;
+
 
 CREATE_SCRIPTABLE_CLASS(LightningEffect, CL_LIGHTNING_EFFECT,
@@ -130,6 +130,4 @@
 
     //load sound
-    if (this->thunderBuffer != NULL)
-        ResourceManager::getInstance()->unload(this->thunderBuffer);
     this->thunderBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/thunder.wav", WAV);
 
Index: trunk/src/lib/graphics/effects/rain_effect.cc
===================================================================
--- trunk/src/lib/graphics/effects/rain_effect.cc	(revision 9391)
+++ trunk/src/lib/graphics/effects/rain_effect.cc	(revision 9406)
@@ -39,5 +39,5 @@
 SHELL_COMMAND(stopraining, RainEffect, stopRaining);
 
-using namespace std;
+
 
 CREATE_SCRIPTABLE_CLASS(RainEffect, CL_RAIN_EFFECT,
Index: trunk/src/lib/graphics/effects/snow_effect.cc
===================================================================
--- trunk/src/lib/graphics/effects/snow_effect.cc	(revision 9391)
+++ trunk/src/lib/graphics/effects/snow_effect.cc	(revision 9406)
@@ -1,14 +1,14 @@
 /*
-	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.
+        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: hdavid, amaechler
+        main-programmer: hdavid, amaechler
 */
 
@@ -35,5 +35,4 @@
 SHELL_COMMAND(deactivate, SnowEffect, deactivateSnow);
 
-using namespace std;
 
 CREATE_SCRIPTABLE_CLASS(SnowEffect, CL_SNOW_EFFECT,
@@ -46,20 +45,19 @@
 SnowEffect::SnowEffect(const TiXmlElement* root)
 {
-	this->setClassID(CL_SNOW_EFFECT, "SnowEffect");
-
-	this->init();
-
-	if (root != NULL)
-		this->loadParams(root);
-
-	//load wind sound
-	if (this->snowWindForce >= 1) {
-		if (this->windBuffer != NULL)
-			ResourceManager::getInstance()->unload(this->windBuffer);
-	  this->windBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/wind.wav", WAV);
-	}
+        this->setClassID(CL_SNOW_EFFECT, "SnowEffect");
+
+        this->init();
+
+        if (root != NULL)
+                this->loadParams(root);
+
+        this->windBuffer = NULL;
+        //load wind sound
+        if (this->snowWindForce >= 1) {
+          this->windBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/wind.wav", WAV);
+        }
 
   if(snowActivate) {
-		this->activate();
+                this->activate();
     SnowEffect::snowParticles->precache((int) this->snowLife);
   }
@@ -69,5 +67,5 @@
 SnowEffect::~SnowEffect()
 {
-	this->deactivate();
+        this->deactivate();
 }
 
@@ -76,52 +74,52 @@
 void SnowEffect::loadParams(const TiXmlElement* root)
 {
-	WeatherEffect::loadParams(root);
-
-	LoadParam(root, "numParticles", this, SnowEffect, numParticles);
-	LoadParam(root, "materialTexture", this, SnowEffect, materialTexture);
-	LoadParam(root, "lifeSpans", this, SnowEffect, lifeSpan);
-	LoadParam(root, "radius", this, SnowEffect, radius);
-	LoadParam(root, "mass", this, SnowEffect, mass);
-	LoadParam(root, "emissionRate", this, SnowEffect, emissionRate);
-	LoadParam(root, "emissionVelocity", this, SnowEffect, emissionVelocity);
-	LoadParam(root, "wind", this, SnowEffect, wind);
-	LoadParam(root, "size", this, SnowEffect, size);
-	LoadParam(root, "coord", this, SnowEffect, coord);
+        WeatherEffect::loadParams(root);
+
+        LoadParam(root, "numParticles", this, SnowEffect, numParticles);
+        LoadParam(root, "materialTexture", this, SnowEffect, materialTexture);
+        LoadParam(root, "lifeSpans", this, SnowEffect, lifeSpan);
+        LoadParam(root, "radius", this, SnowEffect, radius);
+        LoadParam(root, "mass", this, SnowEffect, mass);
+        LoadParam(root, "emissionRate", this, SnowEffect, emissionRate);
+        LoadParam(root, "emissionVelocity", this, SnowEffect, emissionVelocity);
+        LoadParam(root, "wind", this, SnowEffect, wind);
+        LoadParam(root, "size", this, SnowEffect, size);
+        LoadParam(root, "coord", this, SnowEffect, coord);
   LoadParam(root, "cloudcolor", this, SnowEffect, setCloudColor);
   LoadParam(root, "skycolor", this, SnowEffect, setSkyColor);
   LoadParam(root, "fadetime", this, SnowEffect, setFadeTime);
 
-	LOAD_PARAM_START_CYCLE(root, element);
-	{
-		LoadParam_CYCLE(element, "option", this, SnowEffect, setSnowOption);
-	}
-	LOAD_PARAM_END_CYCLE(element);
+        LOAD_PARAM_START_CYCLE(root, element);
+        {
+                LoadParam_CYCLE(element, "option", this, SnowEffect, setSnowOption);
+        }
+        LOAD_PARAM_END_CYCLE(element);
 }
 
 void SnowEffect::init()
 {
-	this->emitter = new PlaneEmitter();
-
-	// Default values
-	this->snowActivate = false;
-	this->snowMove = false;
-	this->particles = 12000;
-	this->texture = "maps/snow_flake_01_32x32.png";
-	this->snowLife = 8;
-	this->randomLife = 2;
-	this->snowRadius = 3.5;
-	this->randomRadius = 1;
-	this->snowMass = 1.0;
-	this->randomMass = 0.3;
-	this->rate = 900;
-	this->velocity = -100;
-	this->randomVelocity = 5;
-	this->angle = 0.5;
-	this->randomAngle = 0.2;
-	this->alpha = 0.5;
-	this->snowSize = Vector2D(2500, 2500);
-	this->snowCoord = Vector(100,450,400);
-	this->snowWindForce = 1;
-  
+        this->emitter = new PlaneEmitter();
+
+        // Default values
+        this->snowActivate = false;
+        this->snowMove = false;
+        this->particles = 12000;
+        this->texture = "maps/snow_flake_01_32x32.png";
+        this->snowLife = 8;
+        this->randomLife = 2;
+        this->snowRadius = 3.5;
+        this->randomRadius = 1;
+        this->snowMass = 1.0;
+        this->randomMass = 0.3;
+        this->rate = 900;
+        this->velocity = -100;
+        this->randomVelocity = 5;
+        this->angle = 0.5;
+        this->randomAngle = 0.2;
+        this->alpha = 0.5;
+        this->snowSize = Vector2D(2500, 2500);
+        this->snowCoord = Vector(100,450,400);
+        this->snowWindForce = 1;
+
   this->fadeTime = 10;
   this->cloudColor = Vector(0.2f, 0.2f, 0.2f);
@@ -131,31 +129,31 @@
 void SnowEffect::activate()
 {
-	PRINTF(3)("Activating SnowEffect\n");
-
-	this->snowActivate = true;
-
-	SnowEffect::snowParticles = new SpriteParticles(particles);
-	SnowEffect::snowParticles->setName("SnowEffectTrailParticles");
-	SnowEffect::snowParticles->setMaterialTexture(texture);
-	SnowEffect::snowParticles->setLifeSpan(snowLife, randomLife);
-	SnowEffect::snowParticles->setRadius(0.0, snowRadius, randomRadius);
-	SnowEffect::snowParticles->setRadius(0.2, snowRadius, randomRadius*0.8);
-	SnowEffect::snowParticles->setRadius(1.0, snowRadius, randomRadius*0.5);
-	SnowEffect::snowParticles->setMass(0, snowMass, randomMass);
-	SnowEffect::snowParticles->setColor(0,1, 1, 1, alpha);
-	SnowEffect::snowParticles->setColor(.5, .6, .6, .6, alpha/2);
-	SnowEffect::snowParticles->setColor(1, .0, .0, .0, .0);
-
-	this->emitter->setSystem(SnowEffect::snowParticles);
-
-	this->emitter->setRelCoor(snowCoord);
-	this->emitter->setEmissionRate(rate);
-	this->emitter->setEmissionVelocity(velocity, randomVelocity);
-	this->emitter->setSpread(angle * this->snowWindForce , randomAngle * this->snowWindForce);
-	this->emitter->setSize(snowSize);
+        PRINTF(3)("Activating SnowEffect\n");
+
+        this->snowActivate = true;
+
+        SnowEffect::snowParticles = new SpriteParticles(particles);
+        SnowEffect::snowParticles->setName("SnowEffectTrailParticles");
+        SnowEffect::snowParticles->setMaterialTexture(texture);
+        SnowEffect::snowParticles->setLifeSpan(snowLife, randomLife);
+        SnowEffect::snowParticles->setRadius(0.0, snowRadius, randomRadius);
+        SnowEffect::snowParticles->setRadius(0.2, snowRadius, randomRadius*0.8);
+        SnowEffect::snowParticles->setRadius(1.0, snowRadius, randomRadius*0.5);
+        SnowEffect::snowParticles->setMass(0, snowMass, randomMass);
+        SnowEffect::snowParticles->setColor(0,1, 1, 1, alpha);
+        SnowEffect::snowParticles->setColor(.5, .6, .6, .6, alpha/2);
+        SnowEffect::snowParticles->setColor(1, .0, .0, .0, .0);
+
+        this->emitter->setSystem(SnowEffect::snowParticles);
+
+        this->emitter->setRelCoor(snowCoord);
+        this->emitter->setEmissionRate(rate);
+        this->emitter->setEmissionVelocity(velocity, randomVelocity);
+        this->emitter->setSpread(angle * this->snowWindForce , randomAngle * this->snowWindForce);
+        this->emitter->setSize(snowSize);
 
   if (this->snowWindForce != 0)
     this->soundSource.play(this->windBuffer, 0.1f * this->snowWindForce, true);
-  
+
   // Store cloud- and sky color before the snow
   this->oldCloudColor = CloudEffect::cloudColor;
@@ -171,12 +169,12 @@
 void SnowEffect::deactivate()
 {
-	PRINTF(3)("Deactivating SnowEffect\n");
-
-	this->snowActivate = false;
-	this->emitter->setSystem(NULL);
-
-	if (this->windBuffer != NULL)
-		ResourceManager::getInstance()->unload(this->windBuffer);
-  
+        PRINTF(3)("Deactivating SnowEffect\n");
+
+        this->snowActivate = false;
+        this->emitter->setSystem(NULL);
+
+        if (this->windBuffer != NULL)
+                ResourceManager::getInstance()->unload(this->windBuffer);
+
   // Restore the old cloud- and sky color
   CloudEffect::changeCloudColor(this->oldCloudColor, this->fadeTime);
@@ -186,50 +184,50 @@
 void SnowEffect::draw() const
 {
-	if (!this->snowActivate)
-		return;
+        if (!this->snowActivate)
+                return;
 }
 
 void SnowEffect::tick(float dt)
 {
-	if (!this->snowActivate)
-		return;
-
-	/*
-	float distance = (State::getCameraNode()->getAbsCoor() - Vector(snowCoord.x, State::getCameraNode()->getAbsCoor().y, snowCoord.z)).len();
-
-	if(activated)
-	{
-	if(distance > 0.3*snowSize.x || distance > 0.3*snowSize.y)
-			this->deactivate();
-	else if(distance > 0.25*snowSize.x || distance > 0.25*snowSize.y)
-	this->alpha = 0.15;
-	else if(distance > 0.2*snowSize.x || distance > 0.2*snowSize.y)
-	this->alpha = 0.25;
-	else if(distance > 0.1*snowSize.x || distance > 0.1*snowSize.y)
-	this->alpha = 0.4;
-
-	SnowEffect::snowParticles->setColor(0,1, 1, 1, alpha);
-	SnowEffect::snowParticles->setColor(.5, .6, .6, .6, alpha/2);
-	SnowEffect::snowParticles->setColor(1, .0, .0, .0, .0);
-	}
-	else
-	{
-	if(distance < 0.3*snowSize.x || distance < 0.3*snowSize.y )
-	this->activate();
-	if( distance < 0.25*snowSize.x || distance < 0.25*snowSize.y )
-	this->alpha = 0.25;
-	else if( distance < 0.2*snowSize.x || distance < 0.2*snowSize.y )
-	this->alpha = 0.4;
-	else if( distance < 0.1*snowSize.x || distance < 0.1*snowSize.y )
-	this->alpha = 0.5;
-
-	SnowEffect::snowParticles->setColor(0,1, 1, 1, alpha);
-	SnowEffect::snowParticles->setColor(.5, .6, .6, .6, alpha/2);
-	SnowEffect::snowParticles->setColor(1, .0, .0, .0, .0);
-	}*/
-
-	if (this->snowMove) {
-		this->snowCoord = State::getCameraNode()->getAbsCoor();
-		this->emitter->setRelCoor(this->snowCoord.x , this->snowCoord.y+300, this->snowCoord.z);
-	}
-}
+        if (!this->snowActivate)
+                return;
+
+        /*
+        float distance = (State::getCameraNode()->getAbsCoor() - Vector(snowCoord.x, State::getCameraNode()->getAbsCoor().y, snowCoord.z)).len();
+
+        if(activated)
+        {
+        if(distance > 0.3*snowSize.x || distance > 0.3*snowSize.y)
+                        this->deactivate();
+        else if(distance > 0.25*snowSize.x || distance > 0.25*snowSize.y)
+        this->alpha = 0.15;
+        else if(distance > 0.2*snowSize.x || distance > 0.2*snowSize.y)
+        this->alpha = 0.25;
+        else if(distance > 0.1*snowSize.x || distance > 0.1*snowSize.y)
+        this->alpha = 0.4;
+
+        SnowEffect::snowParticles->setColor(0,1, 1, 1, alpha);
+        SnowEffect::snowParticles->setColor(.5, .6, .6, .6, alpha/2);
+        SnowEffect::snowParticles->setColor(1, .0, .0, .0, .0);
+        }
+        else
+        {
+        if(distance < 0.3*snowSize.x || distance < 0.3*snowSize.y )
+        this->activate();
+        if( distance < 0.25*snowSize.x || distance < 0.25*snowSize.y )
+        this->alpha = 0.25;
+        else if( distance < 0.2*snowSize.x || distance < 0.2*snowSize.y )
+        this->alpha = 0.4;
+        else if( distance < 0.1*snowSize.x || distance < 0.1*snowSize.y )
+        this->alpha = 0.5;
+
+        SnowEffect::snowParticles->setColor(0,1, 1, 1, alpha);
+        SnowEffect::snowParticles->setColor(.5, .6, .6, .6, alpha/2);
+        SnowEffect::snowParticles->setColor(1, .0, .0, .0, .0);
+        }*/
+
+        if (this->snowMove) {
+                this->snowCoord = State::getCameraNode()->getAbsCoor();
+                this->emitter->setRelCoor(this->snowCoord.x , this->snowCoord.y+300, this->snowCoord.z);
+        }
+}
Index: trunk/src/lib/graphics/effects/snow_effect.h
===================================================================
--- trunk/src/lib/graphics/effects/snow_effect.h	(revision 9391)
+++ trunk/src/lib/graphics/effects/snow_effect.h	(revision 9406)
@@ -101,31 +101,31 @@
 
 private:
-    int         particles;
+    int               particles;
     std::string       texture;
-    float       snowLife, randomLife;
-    float       snowRadius, randomRadius;
-    float       snowMass, randomMass;
-    float         rate;
-    float         velocity, randomVelocity;
-    float         angle, randomAngle;
-    float         alpha;
-    float         fadeTime;
-    Vector        snowCoord;
-    Vector2D      snowSize;
-    int       snowWindForce;
+    float             snowLife, randomLife;
+    float             snowRadius, randomRadius;
+    float             snowMass, randomMass;
+    float             rate;
+    float             velocity, randomVelocity;
+    float             angle, randomAngle;
+    float             alpha;
+    float             fadeTime;
+    Vector            snowCoord;
+    Vector2D          snowSize;
+    int               snowWindForce;
 
-    bool        snowMove;
-    bool        snowActivate;
+    bool              snowMove;
+    bool              snowActivate;
 
     PlaneEmitter*     emitter;
 
     static SpriteParticles*   snowParticles;
-    OrxSound::SoundSource   soundSource;
+    OrxSound::SoundSource     soundSource;
     OrxSound::SoundBuffer*    windBuffer;
 
-    Vector oldSkyColor;
-    Vector oldCloudColor;
-    Vector skyColor;
-    Vector cloudColor;
+    Vector            oldSkyColor;
+    Vector            oldCloudColor;
+    Vector            skyColor;
+    Vector            cloudColor;
 };
 
Index: trunk/src/lib/graphics/effects/sun_effect.cc
===================================================================
--- trunk/src/lib/graphics/effects/sun_effect.cc	(revision 9391)
+++ trunk/src/lib/graphics/effects/sun_effect.cc	(revision 9406)
@@ -21,5 +21,5 @@
 
 
-using namespace std;
+
 
 
Index: trunk/src/lib/graphics/effects/volfog_effect.cc
===================================================================
--- trunk/src/lib/graphics/effects/volfog_effect.cc	(revision 9391)
+++ trunk/src/lib/graphics/effects/volfog_effect.cc	(revision 9406)
@@ -47,5 +47,5 @@
 
 
-using namespace std;
+
 
 CREATE_FACTORY(VolFogEffect, CL_VOLFOG_EFFECT);
Index: trunk/src/lib/graphics/effects/weather_effect.cc
===================================================================
--- trunk/src/lib/graphics/effects/weather_effect.cc	(revision 9391)
+++ trunk/src/lib/graphics/effects/weather_effect.cc	(revision 9406)
@@ -21,5 +21,5 @@
 
 
-using namespace std;
+
 
 
Index: trunk/src/lib/graphics/graphics_engine.cc
===================================================================
--- trunk/src/lib/graphics/graphics_engine.cc	(revision 9391)
+++ trunk/src/lib/graphics/graphics_engine.cc	(revision 9406)
@@ -50,8 +50,7 @@
  #include "static_model.h"
 #endif
-using namespace std;
 
 SHELL_COMMAND(wireframe, GraphicsEngine, wireframe);
-
+SHELL_COMMAND(fps, GraphicsEngine, toggleFPSdisplay);
 
 /**
@@ -67,4 +66,5 @@
   this->bDisplayFPS = false;
   this->bAntialiasing = false;
+  this->bDedicated = false;
   this->minFPS = 9999;
   this->maxFPS = 0;
@@ -164,4 +164,8 @@
   MultiType textures = Preferences::getInstance()->getString(CONFIG_SECTION_VIDEO_ADVANCED, CONFIG_NAME_TEXTURES, "1");
   Texture::setTextureEnableState(textures.getBool());
+
+  // check it is a dedicated network node: so no drawings are made
+  MultiType dedicated = Preferences::getInstance()->getString(CONFIG_SECTION_VIDEO, CONFIG_NAME_NO_RENDER, "0");
+  this->bDedicated = dedicated.getBool();
 
   // searching for a usefull resolution
@@ -604,12 +608,13 @@
 }
 
+/**
+ * this draws the graphics engines graphics effecs
+ */
 void GraphicsEngine::draw() const
 {
-  //  LightManager::getInstance()->draw();
-
-  if (this->graphicsEffects != NULL)
+  if( this->graphicsEffects != NULL)
   {
     //draw the graphics effects
-    list<BaseObject*>::const_iterator it;
+    std::list<BaseObject*>::const_iterator it;
     for (it = this->graphicsEffects->begin(); it != this->graphicsEffects->end(); it++)
       dynamic_cast<GraphicsEffect*>(*it)->draw();
@@ -618,4 +623,10 @@
   Render2D::getInstance()->draw(E2D_LAYER_BOTTOM, E2D_LAYER_ABOVE_ALL);
   Shader::restoreShader();
+}
+
+
+void GraphicsEngine::toggleFPSdisplay()
+{
+  this->displayFPS(!this->bDisplayFPS);
 }
 
Index: trunk/src/lib/graphics/graphics_engine.h
===================================================================
--- trunk/src/lib/graphics/graphics_engine.h	(revision 9391)
+++ trunk/src/lib/graphics/graphics_engine.h	(revision 9406)
@@ -46,4 +46,5 @@
     void toggleFullscreen();
     static void setBackgroundColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha = 1.0);
+    inline bool isDedicated() { return this->bDedicated; }
 
     inline void setAntialiasing(bool flag) { this->bAntialiasing = flag; }
@@ -74,4 +75,5 @@
     void drawBackgroundElements() const;
     void draw() const;
+    void toggleFPSdisplay();
     void displayFPS(bool display);
 
@@ -113,4 +115,5 @@
     bool                       particlesEnabled;   //!< If particles should be enabled.
     bool                       bAntialiasing;      //!< true if antialiasing enabled
+    bool                       bDedicated;         //!< true if this server is a dedicated server and should not render the scene
 
     int                        particlesValue;     //!< How many particles
Index: trunk/src/lib/graphics/importer/bsp_file.cc
===================================================================
--- trunk/src/lib/graphics/importer/bsp_file.cc	(revision 9391)
+++ trunk/src/lib/graphics/importer/bsp_file.cc	(revision 9406)
@@ -40,5 +40,5 @@
 #include <vector>
 
-using namespace std;
+
 
 
@@ -96,5 +96,5 @@
   if (stat( name , &results) == 0) {
     PRINTF(0)("BSP FILE: Datei %s gefunden. \n", name);
-    ifstream bspFile (name, ios::in | ios::binary);
+    std::ifstream bspFile (name, std::ios::in | std::ios::binary);
     bspFile.read(this->header, 260);
     PRINTF(0)("BSP FILE: BSPVersion: %i. \n", ((int *)(header) )[1]);
Index: trunk/src/lib/graphics/importer/grid.cc
===================================================================
--- trunk/src/lib/graphics/importer/grid.cc	(revision 9391)
+++ trunk/src/lib/graphics/importer/grid.cc	(revision 9406)
@@ -18,5 +18,5 @@
 #include "grid.h"
 
-using namespace std;
+
 
 
Index: trunk/src/lib/graphics/importer/interactive_model.cc
===================================================================
--- trunk/src/lib/graphics/importer/interactive_model.cc	(revision 9391)
+++ trunk/src/lib/graphics/importer/interactive_model.cc	(revision 9406)
@@ -20,5 +20,5 @@
 #include "glincl.h"
 
-using namespace std;
+
 
 /**
Index: trunk/src/lib/graphics/importer/material.cc
===================================================================
--- trunk/src/lib/graphics/importer/material.cc	(revision 9391)
+++ trunk/src/lib/graphics/importer/material.cc	(revision 9406)
@@ -88,5 +88,5 @@
 Material::~Material()
 {
-  PRINTF(5)("delete Material %s.\n", this->getName());
+  PRINTF(5)("delete Material %s.\n", this->getCName());
 
   if (this->ambientTexture != NULL)
@@ -217,5 +217,5 @@
 void Material::setIllum (int illum)
 {
-  PRINTF(4)("setting illumModel of Material %s to %i\n", this->getName(), illum);
+  PRINTF(4)("setting illumModel of Material %s to %i\n", this->getCName(), illum);
   this->illumModel = illum;
 }
@@ -229,5 +229,5 @@
 void Material::setDiffuse (float r, float g, float b)
 {
-  PRINTF(4)("setting Diffuse Color of Material %s to r=%f g=%f b=%f.\n", this->getName(), r, g, b);
+  PRINTF(4)("setting Diffuse Color of Material %s to r=%f g=%f b=%f.\n", this->getCName(), r, g, b);
   this->diffuse = Color(r, g, b, this->diffuse.a() );
 }
@@ -242,5 +242,5 @@
 void Material::setAmbient (float r, float g, float b)
 {
-  PRINTF(4)("setting Ambient Color of Material %s to r=%f g=%f b=%f.\n", this->getName(), r, g, b);
+  PRINTF(4)("setting Ambient Color of Material %s to r=%f g=%f b=%f.\n", this->getCName(), r, g, b);
   this->ambient = Color(r, g, b, 1.0);
 }
@@ -254,5 +254,5 @@
 void Material::setSpecular (float r, float g, float b)
 {
-  PRINTF(4)("setting Specular Color of Material %s to r=%f g=%f b=%f.\n", this->getName(), r, g, b);
+  PRINTF(4)("setting Specular Color of Material %s to r=%f g=%f b=%f.\n", this->getCName(), r, g, b);
   this->specular = Color (r, g, b, 1.0);
 }
@@ -273,5 +273,5 @@
 void Material::setTransparency (float trans)
 {
-  PRINTF(4)("setting Transparency of Material %s to %f.\n", this->getName(), trans);
+  PRINTF(4)("setting Transparency of Material %s to %f.\n", this->getCName(), trans);
   this->diffuse.a() = trans;
 }
@@ -455,5 +455,5 @@
 void Material::debug() const
 {
-  PRINT(0)("Debug Material: %s\n", this->getName());
+  PRINT(0)("Debug Material: %s\n", this->getCName());
   PRINT(0)("illumModel: %d ; ShiniNess %f\n", this->illumModel, shininess);
   PRINT(0)("diffuseColor: "); diffuse.debug();
Index: trunk/src/lib/graphics/importer/md2/md2Model.cc
===================================================================
--- trunk/src/lib/graphics/importer/md2/md2Model.cc	(revision 9391)
+++ trunk/src/lib/graphics/importer/md2/md2Model.cc	(revision 9406)
@@ -22,5 +22,5 @@
 
 
-using namespace std;
+
 
 //! the model anorms
Index: trunk/src/lib/graphics/importer/md3/md3_animation_cfg.cc
===================================================================
--- trunk/src/lib/graphics/importer/md3/md3_animation_cfg.cc	(revision 9391)
+++ trunk/src/lib/graphics/importer/md3/md3_animation_cfg.cc	(revision 9406)
@@ -19,14 +19,12 @@
 #include "md3_animation.h"
 
-#include "tokenizer.h"
+#include "substring.h"
 #include "helper_functions.h"
 
 #include "debug.h"
 
-#include <stdio.h>
-#include <stdlib.h>
-
-
-using namespace std;
+
+
+
 
 namespace md3
@@ -100,6 +98,5 @@
         if( inHeader && line.find("sex") == 0) {
           //parse line: sex [m | f | ...]
-          std::vector<std::string> tokens;
-          Tokenizer::tokenize(line, tokens, " \t\n\r\f/");
+          SubString tokens(line, " \t\n\r\f/");
 
           std::string sexStr = tokens.back();
@@ -117,6 +114,5 @@
         else if( inHeader && line.find("headoffset") == 0) {
           // parse line: headoffset X Y Z
-          std::vector<std::string> tokens;
-          Tokenizer::tokenize(line, tokens, " \t\n\r\f/");
+          SubString tokens(line, " \t\n\r\f/");
 
           float z = atof(tokens.back().c_str()); tokens.pop_back();
@@ -130,6 +126,5 @@
         else if( inHeader && line.find("footsteps") == 0) {
           //parse line: footsteps [normal | mech | ...]
-          std::vector<std::string> tokens;
-          Tokenizer::tokenize(line, tokens, " \t\n\r\f/");
+          SubString tokens (line, " \t\n\r\f/");
 
           this->footsteps = tokens.back();
@@ -190,6 +185,5 @@
     // parse the line:
     // first frame, num frames, looping frames, frames per second (fps)
-    std::vector<std::string> tokens;
-    Tokenizer::tokenize(line, tokens, " \t\n\r\f/");
+    SubString tokens(line, " \t\n\r\f/");
 
     anim->fps = atoi(tokens.back().c_str()); tokens.pop_back();
Index: trunk/src/lib/graphics/importer/model.cc
===================================================================
--- trunk/src/lib/graphics/importer/model.cc	(revision 9391)
+++ trunk/src/lib/graphics/importer/model.cc	(revision 9406)
@@ -20,5 +20,5 @@
 #include "glincl.h"
 
-using namespace std;
+
 
 /**
Index: trunk/src/lib/graphics/importer/primitive_model.cc
===================================================================
--- trunk/src/lib/graphics/importer/primitive_model.cc	(revision 9391)
+++ trunk/src/lib/graphics/importer/primitive_model.cc	(revision 9406)
@@ -21,5 +21,5 @@
 #include "debug.h"
 
-using namespace std;
+
 
 /**
Index: trunk/src/lib/graphics/importer/static_model.cc
===================================================================
--- trunk/src/lib/graphics/importer/static_model.cc	(revision 9391)
+++ trunk/src/lib/graphics/importer/static_model.cc	(revision 9406)
@@ -23,5 +23,5 @@
 #include <stdarg.h>
 
-using namespace std;
+
 
 
@@ -161,7 +161,7 @@
 {
   PRINTF(4)("Deleting Model ");
-  if (this->getName())
-  {
-    PRINT(4)("%s\n", this->getName());
+  if (!this->getName().empty())
+  {
+    PRINT(4)("%s\n", this->getCName());
   }
   else
@@ -178,5 +178,5 @@
 
   //! @todo do we really have to delete this material??
-  list<ModelMaterial*>::iterator modMat;
+  std::list<ModelMaterial*>::iterator modMat;
   for(modMat = this->materialList.begin(); modMat != this->materialList.end(); modMat++)
   {
@@ -214,5 +214,5 @@
 void StaticModel::rebuild()
 {
-  PRINTF(3)("Rebuilding Model '%s'\n", this->getName());
+  PRINTF(3)("Rebuilding Model '%s'\n", this->getCName());
   this->finalize();
 }
@@ -266,5 +266,5 @@
     tmpGroup = tmpGroup->next;
   }
-  PRINTF(2)("Model number %i in %s not Found.\n", groupNumber, this->getName());
+  PRINTF(2)("Model number %i in %s not Found.\n", groupNumber, this->getCName());
   return;
 }
@@ -291,5 +291,5 @@
     tmpGroup = tmpGroup->next;
   }
-  PRINTF(2)("Model Named %s in %s not Found.\n", groupName.c_str(), this->getName());
+  PRINTF(2)("Model Named %s in %s not Found.\n", groupName.c_str(), this->getCName());
   return;
 }
@@ -358,5 +358,5 @@
 Material* StaticModel::findMaterialByName(const std::string& materialName)
 {
-  list<ModelMaterial*>::iterator modMat;
+  std::list<ModelMaterial*>::iterator modMat;
   for  (modMat = this->materialList.begin(); modMat != this->materialList.end(); modMat++)
     if (materialName == (*modMat)->material->getName())
@@ -748,5 +748,5 @@
         {
           tmpFace->material->select();
-          PRINTF(5)("using material %s for coming Faces.\n", tmpFace->material->getName());
+          PRINTF(5)("using material %s for coming Faces.\n", tmpFace->material->getCName());
         }
       }
@@ -840,5 +840,5 @@
       else if( tmpFace->vertexCount > 4) {
         if (!warned)        {
-          PRINTF(2)("This model (%s) got over 4 vertices per face <=> conflicts in the CD engine!\n", this->getName());
+          PRINTF(2)("This model (%s) got over 4 vertices per face <=> conflicts in the CD engine!\n", this->getCName());
           warned = true;
         }
Index: trunk/src/lib/graphics/importer/texture.cc
===================================================================
--- trunk/src/lib/graphics/importer/texture.cc	(revision 9391)
+++ trunk/src/lib/graphics/importer/texture.cc	(revision 9406)
@@ -230,5 +230,5 @@
   if (this->data->getStoredImage() != NULL)
   {
-    PRINTF(3)("Reloading Texture of %s '%s'\n", this->getClassName(), this->getName());
+    PRINTF(3)("Reloading Texture of %s '%s'\n", this->getClassCName(), this->getCName());
     this->setTexture(Texture::loadTexToGL(this->data->getStoredImage()));
   }
Index: trunk/src/lib/graphics/importer/texture_sequence.cc
===================================================================
--- trunk/src/lib/graphics/importer/texture_sequence.cc	(revision 9391)
+++ trunk/src/lib/graphics/importer/texture_sequence.cc	(revision 9406)
@@ -225,5 +225,5 @@
 bool TextureSequence::rebuild()
 {
-  PRINTF(3)("Reloading TextureSequence of %s '%s'\n", this->getClassName(), this->getName());
+  PRINTF(3)("Reloading TextureSequence of %s '%s'\n", this->getClassCName(), this->getCName());
 
   for (unsigned int i = 0; i < this->textures.size(); i++)
Index: trunk/src/lib/graphics/importer/vertex_array_model.cc
===================================================================
--- trunk/src/lib/graphics/importer/vertex_array_model.cc	(revision 9391)
+++ trunk/src/lib/graphics/importer/vertex_array_model.cc	(revision 9406)
@@ -23,5 +23,5 @@
 #include "tc.h"
 
-using namespace std;
+
 
 /////////////
@@ -116,5 +116,5 @@
 VertexArrayModel::~VertexArrayModel()
 {
-  PRINTF(4)("Deleting VertexArrayModel %s\n", this->getName());
+  PRINTF(4)("Deleting VertexArrayModel %s\n", this->getCName());
 }
 
@@ -127,5 +127,5 @@
 void VertexArrayModel::draw() const
 {
-  PRINTF(4)("drawing 3D-VertexArrayModel %s\n", this->getName());
+  PRINTF(4)("drawing 3D-VertexArrayModel %s\n", this->getCName());
   glEnableClientState(GL_VERTEX_ARRAY );
   glEnableClientState(GL_TEXTURE_COORD_ARRAY );
@@ -343,5 +343,5 @@
 void VertexArrayModel::debug() const
 {
-  PRINT(0)("VertexArrayModel (%s): debug\n", this->getName());
+  PRINT(0)("VertexArrayModel (%s): debug\n", this->getCName());
   PRINT(0)("Stripes: %d; Indices: %d; Vertices: %d; Normals %d; TextCoords %d; Colors %d\n",
             this->stripes.size(),
Index: trunk/src/lib/graphics/render2D/element_2d.cc
===================================================================
--- trunk/src/lib/graphics/render2D/element_2d.cc	(revision 9391)
+++ trunk/src/lib/graphics/render2D/element_2d.cc	(revision 9406)
@@ -104,5 +104,5 @@
       deleteNode = tmp;
       tmp++;
-      //      printf("TEST::%s(%s) %s\n", (*deleteNode)->getName(), (*deleteNode)->getClassName(), this->getName());
+      //      printf("TEST::%s(%s) %s\n", (*deleteNode)->getName(), (*deleteNode)->getClassCName(), this->getName());
       if ((this->parentMode & E2D_PROHIBIT_CHILD_DELETE) ||
           ((*deleteNode)->parentMode & E2D_PROHIBIT_DELETE_WITH_PARENT))
@@ -214,7 +214,7 @@
   {
     PRINTF(2)("Unable to set %s to layer %s, because it's parent(%s) is of higher layer %s\n",
-              this->getName(),
+              this->getCName(),
               Element2D::layer2DToChar(layer),
-              this->parent->getName(),
+              this->parent->getCName(),
               Element2D::layer2DToChar(this->parent->getLayer()));
     layer = this->parent->getLayer();
@@ -602,6 +602,6 @@
       {
         PRINTF(2)("Layer '%s' of Child(%s::%s) lower than parents(%s::%s) layer '%s'. updating...\n",
-                  Element2D::layer2DToChar(child->getLayer()),child->getClassName(), child->getName(),
-                  this->getClassName(), this->getName(), Element2D::layer2DToChar(this->layer));
+                  Element2D::layer2DToChar(child->getLayer()),child->getClassCName(), child->getCName(),
+                  this->getClassCName(), this->getCName(), Element2D::layer2DToChar(this->layer));
         child->layer = this->layer;
         this->children.push_front(child);
@@ -627,5 +627,5 @@
     {
       PRINTF(1)("Tried to reparent2D to own child '%s::%s' to '%s::%s'.\n",
-                this->getClassName(), this->getName(), child->getClassName(), child->getName());
+                this->getClassCName(), this->getCName(), child->getClassCName(), child->getCName());
       child->parent = NULL;
     }
@@ -701,5 +701,5 @@
     {
       (*reparenter)->reparent2D();
-      PRINTF(5)("REPARENTED TO: %s::%s\n",(*reparenter)->getParent2D()->getClassName(),(*reparenter)->getParent2D()->getName());
+      PRINTF(5)("REPARENTED TO: %s::%s\n",(*reparenter)->getParent2D()->getClassCName(),(*reparenter)->getParent2D()->getCName());
     }
   }
@@ -723,5 +723,5 @@
   else
     PRINTF(2)("Not Found Element2D's (%s::%s) new Parent by Name: %s\n",
-              this->getClassName(), this->getName(), parentName.c_str());
+              this->getClassCName(), this->getCName(), parentName.c_str());
 }
 
@@ -865,5 +865,5 @@
         Vector2D tmp = *this->toCoordinate;
         this->setRelCoor2D(tmp);
-        PRINTF(5)("SmoothMove of %s finished\n", this->getName());
+        PRINTF(5)("SmoothMove of %s finished\n", this->getCName());
       }
     }
@@ -879,5 +879,5 @@
         float tmp = *this->toDirection;
         this->setRelDir2D(tmp);
-        PRINTF(5)("SmoothRotate of %s finished\n", this->getName());
+        PRINTF(5)("SmoothRotate of %s finished\n", this->getCName());
       }
     }
@@ -893,5 +893,5 @@
         delete this->toSize;
         this->toSize = NULL;
-        PRINTF(5)("SmoothRotate of %s finished\n", this->getName());
+        PRINTF(5)("SmoothRotate of %s finished\n", this->getCName());
       }
     }
@@ -900,5 +900,5 @@
     this->lastAbsCoordinate = this->absCoordinate;
 
-    PRINTF(5)("Element2D::update - %s - (%f, %f)\n", this->getName(), this->absCoordinate.x, this->absCoordinate.y);
+    PRINTF(5)("Element2D::update - %s - (%f, %f)\n", this->getCName(), this->absCoordinate.x, this->absCoordinate.y);
 
 
@@ -937,5 +937,5 @@
                  projectPos+1,
                  projectPos+2);
-      //       printf("%s::%s  == %f %f %f :: %f %f\n", this->getClassName(), this->getName(),
+      //       printf("%s::%s  == %f %f %f :: %f %f\n", this->getClassCName(), this->getName(),
       //              this->bindNode->getAbsCoor().x,
       //              this->bindNode->getAbsCoor().y,
@@ -1026,6 +1026,6 @@
     PRINT(0)(" -");
   PRINT(0)("E2D(%s::%s);AC:(%0.2f, %0.2f);RC:(%0.2f, %0.2f);AD(%0.2f)->%s;Layer:(%s)\n",
-           this->getClassName(),
-           this->getName(),
+           this->getClassCName(),
+           this->getCName(),
            this->absCoordinate.x,
            this->absCoordinate.y,
Index: trunk/src/lib/graphics/render2D/image_plane.cc
===================================================================
--- trunk/src/lib/graphics/render2D/image_plane.cc	(revision 9391)
+++ trunk/src/lib/graphics/render2D/image_plane.cc	(revision 9406)
@@ -25,5 +25,5 @@
 
 
-using namespace std;
+
 
 
Index: trunk/src/lib/graphics/render2D/render_2d.cc
===================================================================
--- trunk/src/lib/graphics/render2D/render_2d.cc	(revision 9391)
+++ trunk/src/lib/graphics/render2D/render_2d.cc	(revision 9406)
@@ -22,5 +22,5 @@
 #include "element_2d.h"
 
-using namespace std;
+
 
 /**
Index: trunk/src/lib/graphics/shader.cc
===================================================================
--- trunk/src/lib/graphics/shader.cc	(revision 9391)
+++ trunk/src/lib/graphics/shader.cc	(revision 9406)
@@ -32,5 +32,5 @@
 #endif
 
-using namespace std;
+
 
 
Index: trunk/src/lib/graphics/spatial_separation/quadtree.cc
===================================================================
--- trunk/src/lib/graphics/spatial_separation/quadtree.cc	(revision 9391)
+++ trunk/src/lib/graphics/spatial_separation/quadtree.cc	(revision 9406)
@@ -24,5 +24,5 @@
 #include "debug.h"
 
-using namespace std;
+
 #define QUADTREE_MATERIAL_COUNT       4
 
Index: trunk/src/lib/graphics/spatial_separation/quadtree_node.cc
===================================================================
--- trunk/src/lib/graphics/spatial_separation/quadtree_node.cc	(revision 9391)
+++ trunk/src/lib/graphics/spatial_separation/quadtree_node.cc	(revision 9406)
@@ -26,5 +26,5 @@
 #include "util/list.h"
 
-using namespace std;
+
 
 
Index: trunk/src/lib/graphics/spatial_separation/spatial_separation.cc
===================================================================
--- trunk/src/lib/graphics/spatial_separation/spatial_separation.cc	(revision 9391)
+++ trunk/src/lib/graphics/spatial_separation/spatial_separation.cc	(revision 9406)
@@ -23,5 +23,5 @@
 #include "compiler.h"
 
-using namespace std;
+
 
 
Index: trunk/src/lib/graphics/text_engine/limited_width_text.cc
===================================================================
--- trunk/src/lib/graphics/text_engine/limited_width_text.cc	(revision 9391)
+++ trunk/src/lib/graphics/text_engine/limited_width_text.cc	(revision 9406)
@@ -160,4 +160,4 @@
 void LimitedWidthText::debug() const
 {
-  printf("Debug %s::%s \n", this->getClassName(), this->getName() );
+  printf("Debug %s::%s \n", this->getClassCName(), this->getCName() );
 }
Index: trunk/src/lib/graphics/text_engine/multi_line_text.cc
===================================================================
--- trunk/src/lib/graphics/text_engine/multi_line_text.cc	(revision 9391)
+++ trunk/src/lib/graphics/text_engine/multi_line_text.cc	(revision 9406)
@@ -152,5 +152,5 @@
 void MultiLineText::debug() const
 {
- printf("Debug %s::%s: %d lines\n", this->getClassName(), this->getName(), this->getLineCount());
+ printf("Debug %s::%s: %d lines\n", this->getClassCName(), this->getCName(), this->getLineCount());
 
  std::string tmpText = this->text();
Index: trunk/src/lib/graphics/text_engine/text.cc
===================================================================
--- trunk/src/lib/graphics/text_engine/text.cc	(revision 9391)
+++ trunk/src/lib/graphics/text_engine/text.cc	(revision 9406)
@@ -28,9 +28,10 @@
  */
 Text::Text(const std::string& fontFile, unsigned int textSize)
-    : _font(fontFile, FONT_DEFAULT_RENDER_SIZE)
+    // : _font(fontFile, FONT_DEFAULT_RENDER_SIZE)
 {
   this->setClassID(CL_TEXT, "Text");
 
   // initialize this Text
+  this->setFont(fontFile, FONT_DEFAULT_RENDER_SIZE);
   this->_size = textSize;
   this->setSizeY2D(textSize);
@@ -278,5 +279,5 @@
 void Text::debug() const
 {
-  PRINT(0)("=== TEXT: %s (with Font:'%s')  displaying %s ===\n", this->getName(), this->_font.getName(), this->_text.c_str());
+  PRINT(0)("=== TEXT: %s (with Font:'%s')  displaying %s ===\n", this->getCName(), this->_font.getCName(), this->_text.c_str());
   //  PRINT(0)("Color: r=%0.2f g=%0.2f b=%0.2f a=%0.2f\n", this->_color.r(), this->_color.g(), this->_color.b(), this->_color.a());
 }
Index: trunk/src/lib/graphics/text_engine/text_engine.cc
===================================================================
--- trunk/src/lib/graphics/text_engine/text_engine.cc	(revision 9391)
+++ trunk/src/lib/graphics/text_engine/text_engine.cc	(revision 9406)
@@ -26,5 +26,5 @@
 #include "font.h"
 
-using namespace std;
+
 
 #include <stdlib.h>
@@ -122,5 +122,5 @@
 void TextEngine::debug() const
 {
-  const list<BaseObject*>* textList = ClassList::getList(CL_TEXT);
+  const std::list<BaseObject*>* textList = ClassList::getList(CL_TEXT);
   if (textList != NULL)
   {
@@ -130,5 +130,5 @@
     PRINT(0)("Reference: %p; Text Counts: %d\n", this, textList->size());
 
-    list<BaseObject*>::const_iterator text;
+    std::list<BaseObject*>::const_iterator text;
     for ( text = textList->begin(); text != textList->end(); text++)
       dynamic_cast<Text*>(*text)->debug();
Index: trunk/src/lib/gui/gl/Makefile.am
===================================================================
--- trunk/src/lib/gui/gl/Makefile.am	(revision 9391)
+++ trunk/src/lib/gui/gl/Makefile.am	(revision 9406)
@@ -13,5 +13,4 @@
 		\
 		glgui_handler.cc \
-		signal_connector.cc \
 		glgui_mainwidget.cc \
 		glgui_widget.cc \
@@ -38,5 +37,4 @@
 		glmenu/glmenu_imagescreen.h \
 		\
-		signal_connector.h \
 		glgui.h \
 		glgui_defs.h \
Index: trunk/src/lib/gui/gl/glgui_button.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_button.cc	(revision 9391)
+++ trunk/src/lib/gui/gl/glgui_button.cc	(revision 9406)
@@ -79,10 +79,10 @@
   {
     GLGuiWidget::clicking(pos);
-    emit(clicked());
+    clicked.emit();
   }
   void GLGuiButton::releasing(const Vector2D& pos, bool focused)
   {
     GLGuiWidget::releasing(pos, focused);
-    emit(released());
+    released.emit();
   }
 
@@ -103,7 +103,7 @@
     {
       if (event.bPressed)
-        emit(pushed());
+        clicked.emit();
       else
-        emit(released());
+        released.emit();
       return true;
     }
Index: trunk/src/lib/gui/gl/glgui_button.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_button.h	(revision 9391)
+++ trunk/src/lib/gui/gl/glgui_button.h	(revision 9406)
@@ -42,6 +42,6 @@
       virtual bool processEvent(const Event& event);
 
-      DeclareSignal0(clicked);
-      DeclareSignal0(released);
+      sigslot::signal0<> clicked;
+      sigslot::signal0<> released;
 
 
Index: trunk/src/lib/gui/gl/glgui_checkbutton.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_checkbutton.cc	(revision 9391)
+++ trunk/src/lib/gui/gl/glgui_checkbutton.cc	(revision 9406)
@@ -55,5 +55,5 @@
   {
     this->bActive = bActive;
-    emit(this->toggled(this->bActive));
+    this->toggled.emit(this->bActive);
   }
 
Index: trunk/src/lib/gui/gl/glgui_checkbutton.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_checkbutton.h	(revision 9391)
+++ trunk/src/lib/gui/gl/glgui_checkbutton.h	(revision 9406)
@@ -34,5 +34,5 @@
     virtual void update() {};
 
-    DeclareSignal1(toggled, bool);
+    sigslot::signal1<bool> toggled;
 
   protected:
Index: trunk/src/lib/gui/gl/glgui_frame.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_frame.cc	(revision 9391)
+++ trunk/src/lib/gui/gl/glgui_frame.cc	(revision 9406)
@@ -57,5 +57,5 @@
     else
     {
-      PRINTF(2)("Frame %s is already filled, not filling with %s\n", this->getName(), widget->getName());
+      PRINTF(2)("Frame %s is already filled, not filling with %s\n", this->getCName(), widget->getCName());
     }
   }
Index: trunk/src/lib/gui/gl/glgui_image.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_image.h	(revision 9391)
+++ trunk/src/lib/gui/gl/glgui_image.h	(revision 9406)
@@ -34,5 +34,5 @@
     virtual void draw() const;
 
-    DeclareSignal0(imageChanged);
+    sigslot::signal0<> imageChanged;
 
   protected:
Index: trunk/src/lib/gui/gl/glgui_inputline.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_inputline.cc	(revision 9391)
+++ trunk/src/lib/gui/gl/glgui_inputline.cc	(revision 9406)
@@ -124,5 +124,5 @@
     this->resize();
     this->setFrontColor(Color(1,1,1,1), true);
-    emit(this->textChanged(this->_text.text()));
+    this->textChanged.emit(this->_text.text());
   }
 
@@ -146,5 +146,5 @@
   void GLGuiInputLine::pushEnter()
   {
-    emit(this->enterPushed(this->_text.text()));
+    this->enterPushed.emit(this->_text.text());
     if (this->_clearOnEnter)
       this->clear();
Index: trunk/src/lib/gui/gl/glgui_inputline.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_inputline.h	(revision 9391)
+++ trunk/src/lib/gui/gl/glgui_inputline.h	(revision 9406)
@@ -49,6 +49,6 @@
     virtual bool processEvent(const Event& event);
 
-    DeclareSignal1(textChanged, const std::string&);
-    DeclareSignal1(enterPushed, const std::string&);
+    sigslot::signal1<const std::string&> textChanged;
+    sigslot::signal1<const std::string&> enterPushed;
 
   protected:
Index: trunk/src/lib/gui/gl/glgui_slider.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_slider.cc	(revision 9391)
+++ trunk/src/lib/gui/gl/glgui_slider.cc	(revision 9406)
@@ -77,5 +77,5 @@
     this->_handle.setCenter(this->sliderPosition(), borderTop() + (this->getSizeY2D() - borderTop() - borderBottom()) / 2.0);
 
-    emit(valueChanged(this->_value));
+    valueChanged.emit(this->_value);
   }
 
@@ -90,5 +90,5 @@
     {
       this->_minValue = minimum;
-      emit(rangeChanged(this->_minValue, this->_maxValue));
+      rangeChanged.emit(this->_minValue, this->_maxValue);
     }
     if (this->value() < this->min())
@@ -107,5 +107,5 @@
     {
       this->_maxValue = maximum;
-      emit(rangeChanged(this->_minValue, this->_maxValue));
+      rangeChanged.emit(this->_minValue, this->_maxValue);
     }
     if (this->value() > this->max())
@@ -126,5 +126,5 @@
       this->_minValue = minimum;
       this->_maxValue = maximum;
-      emit(rangeChanged(this->_minValue, this->_maxValue));
+      rangeChanged.emit(this->_minValue, this->_maxValue);
     }
     if (this->value() < this->min())
Index: trunk/src/lib/gui/gl/glgui_slider.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_slider.h	(revision 9391)
+++ trunk/src/lib/gui/gl/glgui_slider.h	(revision 9406)
@@ -51,6 +51,6 @@
     virtual void draw() const;
 
-    DeclareSignal1(valueChanged, float);
-    DeclareSignal2(rangeChanged, float, float);
+    sigslot::signal1<float> valueChanged;
+    sigslot::signal2<float, float> rangeChanged;
 
   protected:
Index: trunk/src/lib/gui/gl/glgui_text.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_text.cc	(revision 9391)
+++ trunk/src/lib/gui/gl/glgui_text.cc	(revision 9406)
@@ -113,5 +113,5 @@
     this->resize();
     this->setFrontColor(_changedTextColor, true);
-    emit(this->textChanged(this->_text.text()));
+    this->textChanged.emit(this->_text.text());
   }
 
Index: trunk/src/lib/gui/gl/glgui_text.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_text.h	(revision 9391)
+++ trunk/src/lib/gui/gl/glgui_text.h	(revision 9406)
@@ -33,4 +33,5 @@
     void setChangedTextColor(const Color& color);
 
+    void setLineWidth(float lineWidth) { this->_text.setLineWidth(lineWidth); };
     void setDotsPosition(LimitedWidthText::DotsPosition dotsPosition) { this->_text.setDotsPosition(dotsPosition); };
 
@@ -40,5 +41,5 @@
     virtual void draw() const;
 
-    DeclareSignal1(textChanged, const std::string&);
+    sigslot::signal1<const std::string&> textChanged;
 
   protected:
Index: trunk/src/lib/gui/gl/glgui_textfield.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_textfield.cc	(revision 9391)
+++ trunk/src/lib/gui/gl/glgui_textfield.cc	(revision 9406)
@@ -112,5 +112,5 @@
     this->resize();
     this->setFrontColor(_changedTextColor, true);
-    emit(this->textChanged(this->_text.text()));
+    this->textChanged.emit(this->_text.text());
   }
 
Index: trunk/src/lib/gui/gl/glgui_textfield.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_textfield.h	(revision 9391)
+++ trunk/src/lib/gui/gl/glgui_textfield.h	(revision 9406)
@@ -38,5 +38,5 @@
     virtual void draw() const;
 
-    DeclareSignal1(textChanged, const std::string&);
+    sigslot::signal1<const std::string&> textChanged;
 
   protected:
Index: trunk/src/lib/gui/gl/glgui_widget.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_widget.cc	(revision 9391)
+++ trunk/src/lib/gui/gl/glgui_widget.cc	(revision 9406)
@@ -288,17 +288,4 @@
     this->setWidgetSize(Vector2D(x, y));
   }
-
-
-
-  void GLGuiWidget::connect(GLGuiWidget* sender, Signal& signal, BaseObject* receiver, Slot executor)
-  {
-    sender->connect(signal, receiver, executor);
-  }
-
-  void GLGuiWidget::connect(Signal& signal, BaseObject* receiver, Slot executor)
-  {
-    signal.push_back(SignalConnector(receiver, executor));
-  }
-
 
   void GLGuiWidget::show()
@@ -806,5 +793,5 @@
     //this->_currentStyle = this->_style[state];
     this->_state = state;
-    PRINTF(4)("%s::%s Switches to state %s\n", this->getClassName(), this->getName(), OrxGui::StateString[state].c_str());
+    PRINTF(4)("%s::%s Switches to state %s\n", this->getClassCName(), this->getCName(), OrxGui::StateString[state].c_str());
 
     this->animateBack();
@@ -874,7 +861,7 @@
   void GLGuiWidget::debug(unsigned int level) const
   {
-    PRINT(0)("Debug of %s::%s - WidgetPart ", this->getClassName(), this->getName());
+    PRINT(0)("Debug of %s::%s - WidgetPart ", this->getClassCName(), this->getCName());
     if (_parent != NULL)
-      PRINT(0)("- Parent %s::%s ", _parent->getClassName(), _parent->getName());
+      PRINT(0)("- Parent %s::%s ", _parent->getClassCName(), _parent->getCName());
     PRINT(0)("- State: %s", StateString[_state].c_str());
 
Index: trunk/src/lib/gui/gl/glgui_widget.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_widget.h	(revision 9391)
+++ trunk/src/lib/gui/gl/glgui_widget.h	(revision 9406)
@@ -17,5 +17,5 @@
 
 #include "event.h"
-#include "signal_connector.h"
+#include "sigslot/signal.h"
 
 namespace OrxGui
@@ -70,9 +70,4 @@
     void release(const Vector2D& pos);
     bool clickable() const { return this->_clickable; };
-
-    static void connect(GLGuiWidget* sender, Signal& signal, BaseObject* receiver, Slot executor);
-    void connect(Signal& signal, BaseObject* receiver, Slot executor);
-
-    void disconnect(GLGuiWidget* sender, Signal& signal, BaseObject* receiver);
 
     OrxGui::State state() const { return this->_state; };
Index: trunk/src/lib/gui/gl/glmenu/glmenu_imagescreen.cc
===================================================================
--- trunk/src/lib/gui/gl/glmenu/glmenu_imagescreen.cc	(revision 9391)
+++ trunk/src/lib/gui/gl/glmenu/glmenu_imagescreen.cc	(revision 9406)
@@ -27,5 +27,5 @@
 CREATE_FACTORY(GLMenuImageScreen, CL_GLMENU_IMAGE_SCREEN);
 
-using namespace std;
+
 /**
  * @param root The Element to load the GLMenu from
Index: trunk/src/lib/gui/gl/signal_connector.cc
===================================================================
--- trunk/src/lib/gui/gl/signal_connector.cc	(revision 9391)
+++ 	(revision )
@@ -1,180 +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: Benjamin Grauer
-   co-programmer: ...
-*/
-
-//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
-
-#include "signal_connector.h"
-
-namespace OrxGui
-{
-
-  /**
-   * @brief creates a clean SignalConnector
-   */
-  SignalConnector::SignalConnector( )
-  {
-    this->object = NULL;
-    this->exec = NULL;
-  }
-
-  /**
-   * @brief Creates a SignalConnector out of an ObjectPointer, and an Executor.
-   * @param object the Object the Executor will apply to.
-   * @param executor the Executor that will be executed.
-   * @return a new SignalConnector.
-   */
-  SignalConnector::SignalConnector(BaseObject* object, const Executor* executor)
-  {
-    this->object = object;
-    this->exec = executor;
-  };
-
-  /**
-   * @brief Creates a SignalConnector as a copy of another one.
-   * @param signalConnector The SignalConnector to copy.
-   */
-  SignalConnector::SignalConnector(const SignalConnector& signalConnector)
-  {
-    this->object = signalConnector.object;
-    this->exec = (signalConnector.exec == NULL) ? NULL : signalConnector.exec->clone();
-  }
-
-  /**
-   * @brief deletes a SignalConnector.
-   *
-   * frees the stored executor
-   */
-  SignalConnector::~SignalConnector()
-  {
-    delete exec;
-  }
-
-  /**
-   * @brief assignes a SignalConnector to the current one
-   * @param signalConnector the SignalConnector to assign to this one
-   * @return A Reference to this SignalConnector.
-   */
-  SignalConnector& SignalConnector::operator=(const SignalConnector& signalConnector)
-  {
-    delete this->exec;
-    this->object = signalConnector.object;
-    this->exec = (signalConnector.exec == NULL) ? NULL : signalConnector.exec->clone();
-
-    return *this;
-  }
-
-
-  /**
-   * @brief compares two SignalConnectors.
-   * @param signalConnector the SignalConnector to compare against this one.
-   * @return true if the Connectors are the same.
-   */
-  bool SignalConnector::operator==(const SignalConnector& signalConnector) const
-  {
-    return (this->object == signalConnector.object /* && this->exec == signalConnector.exec */ );
-  }
-
-
-  /**
-   * @brief Executes the SignalConnector.
-   */
-  void SignalConnector::operator()() const
-  {
-    if (this->isValid())
-    {
-      static int count = 0;
-      (*this->exec)(this->object, count, NULL);
-    }
-  }
-
-  /**
-   * @brief Executes the SignalConnector.
-   * @param value0 First Value.
-   */
-  void SignalConnector::operator()(const MultiType& value0) const
-  {
-    if (exec != NULL && object != NULL)
-    {
-      static int count = 1;
-      (*this->exec)(this->object, count, (void*)&value0);
-    }
-  }
-
-  /**
-   * @brief Executes the SignalConnector.
-   * @param value0 First Value
-   * @param value1 Second Value
-   */
-  void SignalConnector::operator()(const MultiType& value0, const MultiType& value1) const
-  {
-    if (exec != NULL && object != NULL)
-    {
-      static int count = 2;
-      MultiType mt[] = { value0, value1 };
-      (*this->exec)(this->object, count, mt);
-    }
-  }
-
-  /**
-   * @brief Executes the SignalConnector.
-   * @param value0 First Value
-   * @param value1 Second Value
-   * @param value2 Third Value
-   */
-  void SignalConnector::operator()(const MultiType& value0, const MultiType& value1, const MultiType& value2) const
-  {
-    if (exec != NULL && object != NULL)
-    {
-      static int count = 3;
-      MultiType mt[] = { value0, value1, value2 };
-      (*this->exec)(this->object, count, mt);
-    }
-  }
-
-  /**
-   * @brief Executes the SignalConnector.
-   * @param value0 First Value
-   * @param value1 Second Value
-   * @param value2 Third Value
-   * @param value3 Fourth Value
-   */
-  void SignalConnector::operator()(const MultiType& value0, const MultiType& value1, const MultiType& value2, const MultiType& value3) const
-  {
-    if (exec != NULL && object != NULL)
-    {
-      static int count = 4;
-      MultiType mt[] = { value0, value1, value2, value3 };
-      (*this->exec)(this->object, count, mt);
-    }
-  }
-
-  /**
-   * @brief Executes the SignalConnector.
-   * @param value0 First Value
-   * @param value1 Second Value
-   * @param value2 Third Value
-   * @param value3 Fourth Value
-   * @param value3 Fifth Value
-   */
-  void SignalConnector::operator()(const MultiType& value0, const MultiType& value1, const MultiType& value2, const MultiType& value3, const MultiType& value4) const
-  {
-    if (exec != NULL && object != NULL)
-    {
-      static int count = 5;
-      MultiType mt[] = { value0, value1, value2, value3, value4 };
-      (*this->exec)(this->object, count, mt);
-    }
-  }
-}
Index: trunk/src/lib/gui/gl/signal_connector.h
===================================================================
--- trunk/src/lib/gui/gl/signal_connector.h	(revision 9391)
+++ 	(revision )
@@ -1,186 +1,0 @@
-/*!
- * @file signal_connector.h
- * @brief Definition of a SignalConnector class
-*/
-
-#ifndef _SIGNAL_CONNECTOR_H
-#define _SIGNAL_CONNECTOR_H
-
-#include "executor/executor.h"
-
-namespace OrxGui
-{
-
-  //////////////// TO BE IGNORED BY YOU /////
-#define DeclareSignalBegin(SignalName) \
-  public: \
-   void signal_ ## connect ## SignalName(const SignalConnector& connector) { \
-     SignalName ## connected.push_back(connector); \
-}\
-   Signal& getSignalVector_##SignalName () { return this->SignalName ## connected; }; \
-  private:
-
-#define DeclareSignalEnd(SignalName) \
-  Signal SignalName ## connected
-  /////////////////////////////////////////////
-
-
-  /**
-   * @brief declares a new Signal.
-   * @param SignalName the Name of the Signal.
-   */
-#define DeclareSignal0(SignalName) \
-  DeclareSignalBegin(SignalName) \
-   void  SignalName () { \
-     for (unsigned int i = 0; i < SignalName ## connected .size(); i++) \
-       SignalName ## connected[i] (); \
-   }\
-     DeclareSignalEnd(SignalName)
-
-
-  /**
-   * @brief declares a new Signal.
-   * @param SignalName the Name of the Signal.
-   * @param param0 the first Parameter the Function takes
-   */
-#define DeclareSignal1(SignalName, param0) \
-  DeclareSignalBegin(SignalName) \
-   void  SignalName (param0 val0) { \
-     for (unsigned int i = 0; i < SignalName ## connected .size(); i++) \
-       SignalName ## connected[i] (val0); \
-    }\
-    DeclareSignalEnd(SignalName)
-
-  /**
-   * @brief declares a new Signal.
-   * @param SignalName the Name of the Signal.
-   * @param param0 the first Parameter the Function takes
-   * @param param1 the second Parameter the Function takes
-   */
-#define DeclareSignal2(SignalName, param0, param1) \
-  DeclareSignalBegin(SignalName) \
-   void  SignalName (param0 val0, param1 val1) { \
-     for (unsigned int i = 0; i < SignalName ## connected .size(); i++) \
-       SignalName ## connected[i] (val0, val1); \
-}\
-    DeclareSignalEnd(SignalName)
-
-
-
-  /**
-   * @brief declares a new Signal.
-   * @param SignalName the Name of the Signal.
-   * @param param0 the first Parameter the Function takes
-   * @param param1 the second Parameter the Function takes
-   * @param param2 the third Parameter the Function takes
-   */
-#define DeclareSignal3(SignalName, param0, param1, param2) \
-  DeclareSignalBegin(SignalName) \
-   void  SignalName (param0 val0, param1 val1, param2 val2) { \
-     for (unsigned int i = 0; i < SignalName ## connected .size(); i++) \
-       SignalName ## connected[i] (val0, val1, val2); \
-}\
-    DeclareSignalEnd(SignalName)
-
-  /**
-   * @brief declares a new Signal.
-   * @param SignalName the Name of the Signal.
-   * @param param0 the first Parameter the Function takes
-   * @param param1 the second Parameter the Function takes
-   * @param param2 the third Parameter the Function takes
-   * @param param3 the fourth Parameter the Function takes
-   */
-#define DeclareSignal4(SignalName, param0, param1, param2, param3) \
-  DeclareSignalBegin(SignalName) \
-   void  SignalName (param0 val0, param1 val1, param2 val2, param3 val3) { \
-     for (unsigned int i = 0; i < SignalName ## connected .size(); i++) \
-       SignalName ## connected[i] (val0, val1, val2, val3); \
-}\
-    DeclareSignalEnd(SignalName)
-
-
-  /**
-   * @brief declares a new Signal.
-   * @param SignalName the Name of the Signal.
-   * @param param0 the first Parameter the Function takes
-   * @param param1 the second Parameter the Function takes
-   * @param param2 the third Parameter the Function takes
-   * @param param4 the fifth Parameter the Function takes
-   */
-#define DeclareSignal5(SignalName, param0, param1, param2, param3, param4) \
-  DeclareSignalBegin(SignalName) \
-   void  SignalName (param0 val0, param1 val1, param2 val2, param3 val3, param4 val4) { \
-     for (unsigned int i = 0; i < SignalName ## connected .size(); i++) \
-       SignalName ## connected[i] (val0, val1, val2, val3, val4); \
-}\
-    DeclareSignalEnd(SignalName)
-
-
-  /**
-   * @brief selects a Signal.
-   * @param SignalName the Signal to be retrieved.
-   */
-#define SIGNAL(Object, SignalName) \
-    Object->getSignalVector_##SignalName()
-
-  /**
-   * @brief defines a Slot, the sink of a Signal.
-   * @param Class the Class the Slot belongs to.
-   * @param function the Function to Connect to.
-   */
-#define SLOT(Class, function) \
-    createExecutor<Class>(&Class::function)
-
-  /**
-   * @brief emits function
-   */
-#define emit(function) function
-
-  //! A class for Conncting Signals to Objects, inside of the Graphical user interface.
-  /**
-   * The SignalConnector binds an Object to a Functional (Executor)
-   * The Usage is quite easy in the Widget for this:
-   *
-   * int the header (Class Definition) you can add a definition of a Signal with:
-   * @verbatim DeclareSignal3(my_signal, int, int, float)
-   * and a Signal with the the Parameters int,int and float will be created.
-   *
-   * now you can use the connect function of GLWidget to connect this Signal to a Slot.
-   * @see GLGuiWidget::connect
-   */
-  class SignalConnector
-  {
-  public:
-    SignalConnector();
-    SignalConnector(BaseObject* object, const Executor* exec);
-    SignalConnector(const SignalConnector& signalConnector);
-    ~SignalConnector();
-
-    SignalConnector& operator=(const SignalConnector& signalConnector);
-    bool operator==(const SignalConnector& signalConnector) const;
-
-    void operator()() const;
-    void operator()(const MultiType& value0) const;
-    void operator()(const MultiType& value0, const MultiType& value1) const;
-    void operator()(const MultiType& value0, const MultiType& value1, const MultiType& value2) const;
-    void operator()(const MultiType& value0, const MultiType& value1, const MultiType& value2, const MultiType& value3) const;
-    void operator()(const MultiType& value0, const MultiType& value1, const MultiType& value2, const MultiType& value3, const MultiType& value4) const;
-
-    /** checks wether the SignalConnector is valid @return true on valid. */
-    bool isValid() const { return (this->object && this->exec); };
-    /** @brief checks if the SignalConnector is clean, invalid @returns true if invalid */
-    bool isClean() const { return (this->object == NULL || this->exec == NULL); }
-
-
-  private:
-    BaseObject*          object;         //!< The object to call.
-    const Executor*      exec;           //!< The Executor, that will be called, on object.
-  };
-
-  //! TypeDefinition for SignalLists
-  typedef std::vector<SignalConnector> Signal;
-  //! TypeDefinition for a Slot.
-  typedef Executor*                    Slot;
-
-}
-#endif /* _SIGNAL_CONNECTOR_H */
Index: trunk/src/lib/gui/gui_saveable.cc
===================================================================
--- trunk/src/lib/gui/gui_saveable.cc	(revision 9391)
+++ trunk/src/lib/gui/gui_saveable.cc	(revision 9406)
@@ -60,12 +60,12 @@
   void Saveable::load()
   {
-    this->value() = Preferences::getInstance()->getMultiType(this->group->getName(), this->getName(), this->_defaultValue);
-    PRINTF(4)("Loaded to '%s' of group '%s' value '%s'\n", this->getName(), this->group->getName(), this->value().getCString());
+    this->value() = Preferences::getInstance()->getMultiType(this->group->getCName(), this->getCName(), this->_defaultValue);
+    PRINTF(4)("Loaded to '%s' of group '%s' value '%s'\n", this->getCName(), this->group->getCName(), this->value().getCString());
   }
 
   void Saveable::save()
   {
-    Preferences::getInstance()->setMultiType(this->group->getName(), this->getName(), this->value() );
-    PRINTF(4)("Saved to '%s' of group '%s' value '%s'\n", this->getName(), this->group->getName(), this->value().getCString());
+    Preferences::getInstance()->setMultiType(this->group->getCName(), this->getCName(), this->value() );
+    PRINTF(4)("Saved to '%s' of group '%s' value '%s'\n", this->getCName(), this->group->getCName(), this->value().getCString());
   }
 
Index: trunk/src/lib/gui/qt/gui_video.cc
===================================================================
--- trunk/src/lib/gui/qt/gui_video.cc	(revision 9391)
+++ trunk/src/lib/gui/qt/gui_video.cc	(revision 9406)
@@ -50,11 +50,15 @@
       layout->addWidget(fullscreen, 0, 0);
 
+      QtGuiCheckBox* dedicated = new QtGuiCheckBox(CONFIG_NAME_NO_RENDER, this, false);
+      //fullscreen->setName();
+      layout->addWidget(dedicated, 1, 0);
+
       QtGuiCheckBox* wireframe = new QtGuiCheckBox(CONFIG_NAME_WIREFRAME, this, false);
-      layout->addWidget(wireframe, 1, 0);
+      layout->addWidget(wireframe, 2, 0);
 
       {
         QComboBox* resolution = new QtGuiComboBox(CONFIG_NAME_RESOLUTION, this, "640x480");
         resolution->setEditable(true);
-        layout->addWidget(resolution, 2, 0);
+        layout->addWidget(resolution, 3, 0);
         std::vector<QString> resolutions;
         this->getResolutions(resolutions);
Index: trunk/src/lib/lang/base_object.cc
===================================================================
--- trunk/src/lib/lang/base_object.cc	(revision 9391)
+++ trunk/src/lib/lang/base_object.cc	(revision 9406)
@@ -21,9 +21,4 @@
 #include "util/loading/load_param.h"
 #include "class_list.h"
-
-#include "synchronizeable.h"
-
-using namespace std;
-
 
 /**
@@ -50,5 +45,4 @@
   ClassList::removeFromClassList(this);
 
-  //  delete []this->className;
   if (this->xmlElem != NULL)
     delete this->xmlElem;
@@ -61,10 +55,12 @@
 void BaseObject::loadParams(const TiXmlElement* root)
 {
-  // all loadParams should sometime arrive here.
+  // all loadParams should arrive here, and be tested for (root != NULL)
   assert (root != NULL);
 
+  // copy the xml-element for to know how it was loaded.
   if (this->xmlElem != NULL)
     delete this->xmlElem;
   this->xmlElem = root->Clone();
+
   // name setup
   LoadParam(root, "name", this, BaseObject, setName)
@@ -92,4 +88,5 @@
 /**
  * @brief set the name of the Object
+ * @param objectName The new name of the Object.
  */
 void BaseObject::setName (const std::string& objectName)
@@ -164,16 +161,7 @@
  * @returns true on match, false otherwise.
  */
-bool BaseObject::operator==(const std::string& objectName)
+bool BaseObject::operator==(const std::string& objectName) const
 {
   return (this->objectName == objectName);
 }
 
-
-/**
- * @brief displays everything this class is
- * @TODO REIMPLEMENT WITH SENSE.
- */
-void BaseObject::whatIs() const
-{
-
-}
Index: trunk/src/lib/lang/base_object.h
===================================================================
--- trunk/src/lib/lang/base_object.h	(revision 9391)
+++ trunk/src/lib/lang/base_object.h	(revision 9406)
@@ -1,14 +1,20 @@
 /*!
  * @file base_object.h
-  *  Definition of the base object class.
-
-    This is a global handler for all classes.
-*/
+ * @brief Definition of the BaseObject class.
+ *
+ * This is a global handler for all classes Object and Class names
+ *
+ * BaseObject is the class, that handles object registration and
+ * is the only write-access member of ClassList, where the Objects
+ * References are stored.
+ */
 
 
-#ifndef _BASE_OBJECT_H
-#define _BASE_OBJECT_H
+#ifndef __BASE_OBJECT_H_
+#define __BASE_OBJECT_H_
 
 #include "class_id.h"
+#include "sigslot/slot.h"
+
 #include <string>
 
@@ -18,5 +24,5 @@
 
 //! A class all other classes are derived from
-class BaseObject
+class BaseObject : public sigslot::has_slots<>
 {
 
@@ -29,10 +35,14 @@
   void setName (const std::string& newName);
   /** returns the Name of this Object */
-  inline const char* getName ()const { return this->objectName.c_str(); };
+  inline const std::string& getName() const { return this->objectName; };
+  /** returns the Name of this Object as a C-compliant string (const char*) */
+  inline const char* getCName() const { return this->objectName.c_str(); };
   /** @returns the XML-Element with whicht this Object was loaded */
   inline TiXmlNode* getXmlElem() const { return this->xmlElem; };
 
   /** @returns the className of the corresponding Object */
-  inline const char* getClassName() const { return this->className.c_str(); };
+  inline const std::string& getClassName() const { return this->className; }
+  /** @returns the className of the corresponding Object as a C-compliant string (const char*) */
+  inline const char* getClassCName() const { return this->className.c_str(); };
   /** @returns the classID of the corresponding Object */
   inline int getClassID() const { return this->classID; };
@@ -41,9 +51,8 @@
   bool isA (ClassID classID) const;
   bool isA (const std::string& className) const;
-  void whatIs() const;
 
-  bool operator==(const std::string& objectName);
   /** @param classID comparer for a ClassID @returns true on match, false otherwise */
-  bool operator==(ClassID classID) { return this->isA(classID); };
+  bool operator==(ClassID classID) const  { return this->isA(classID); };
+  bool operator==(const std::string& objectName) const;
 
 protected:
@@ -54,5 +63,4 @@
 
 private:
-
   std::string        className;        //!< the name of the class
   long               classID;          //!< this is the id from the class_id.h enumeration
@@ -64,3 +72,3 @@
 };
 
-#endif /* _BASE_OBJECT_H */
+#endif /* __BASE_OBJECT_H_ */
Index: trunk/src/lib/lang/class_list.cc
===================================================================
--- trunk/src/lib/lang/class_list.cc	(revision 9391)
+++ trunk/src/lib/lang/class_list.cc	(revision 9406)
@@ -23,5 +23,5 @@
 #include <cmath>
 
-using namespace std;
+
 
 /**
@@ -61,5 +61,5 @@
 {
   if (unlikely(classList == NULL))
-    ClassList::classList = new list<ClassList>();
+    ClassList::classList = new std::list<ClassList>();
 
   PRINTF(5)("subscribe a '%s'\n", className.c_str() );
@@ -85,5 +85,5 @@
 void ClassList::removeFromClassList(BaseObject* objectPointer)
 {
-  list<ClassList>::iterator cl;
+  std::list<ClassList>::iterator cl;
   for(cl = ClassList::classList->begin(); cl != ClassList::classList->end(); cl++)
   {
@@ -110,5 +110,5 @@
       ClassList::classNames.clear();
 
-      list<ClassList>::const_iterator cl;
+      std::list<ClassList>::const_iterator cl;
       for (cl = ClassList::classList->begin(); cl != ClassList::classList->end(); cl++)
         ClassList::classNames.push_back((*cl).className);
@@ -207,5 +207,5 @@
       std::list<BaseObject*>::iterator bo;
       for (bo = cl->objectList.begin(); bo != cl->objectList.end(); bo++)
-        if ((*bo)->getName() != NULL && objectName == (*bo)->getName())
+        if (objectName == (*bo)->getName())
           return (*bo);
     }
@@ -213,10 +213,10 @@
   else
   {
-    list<ClassList>::iterator cl;
+    std::list<ClassList>::iterator cl;
     for (cl = ClassList::classList->begin(); cl != ClassList::classList->end(); cl++)
     {
       std::list<BaseObject*>::iterator bo;
       for (bo = (*cl).objectList.begin(); bo != (*cl).objectList.end(); bo++)
-        if ((*bo)->getName() != NULL && objectName == (*bo)->getName())
+        if (objectName == (*bo)->getName())
           return (*bo);
     }
@@ -241,5 +241,5 @@
     std::list<BaseObject*>::iterator bo;
     for (bo = cl->objectList.begin(); bo != cl->objectList.end(); bo++)
-      if ((*bo)->getName() != NULL && objectName == (*bo)->getName())
+      if (objectName == (*bo)->getName())
         return (*bo);
   }
@@ -268,5 +268,5 @@
   else
   {
-    list<ClassList>::iterator cl;
+    std::list<ClassList>::iterator cl;
     for (cl = ClassList::classList->begin(); cl != ClassList::classList->end(); cl++)
     {
@@ -286,5 +286,5 @@
     std::list<BaseObject*>::iterator bo;
     for (bo = cl->objectList.begin(); bo != cl->objectList.end(); bo++)
-      if ((*bo)->getName() != NULL && objectName == (*bo)->getName())
+      if (objectName == (*bo)->getName())
         return true;
   }
@@ -299,5 +299,5 @@
 void ClassList::whatIs(const BaseObject* object)
 {
-  list<ClassList>::iterator cl;
+  std::list<ClassList>::iterator cl;
   for (cl = ClassList::classList->begin(); cl != ClassList::classList->end(); cl++)
     if (object->isA((*cl).classID))
@@ -359,5 +359,5 @@
   int lenCount = 0;
 
-  list<ClassList>::iterator cl;
+  std::list<ClassList>::iterator cl;
   for (cl = ClassList::classList->begin(); cl != ClassList::classList->end(); cl++)
   {
@@ -377,8 +377,8 @@
       {
         PRINT(0)("|  Listing Instances:\n");
-        list<BaseObject*>::const_iterator bo;
+        std::list<BaseObject*>::const_iterator bo;
         for (bo = (*cl).objectList.begin(); bo != (*cl).objectList.end(); bo++)
         {
-          PRINT(0)("|   %s::%s::(0x%.8X->%p ", (*bo)->getClassName(), (*bo)->getName(), (*bo)->getClassID(), (*bo));
+          PRINT(0)("|   %s::%s::(0x%.8X->%p ", (*bo)->getClassCName(), (*bo)->getCName(), (*bo)->getClassID(), (*bo));
           if (debugLevel == 3)
             ClassList::whatIs(*bo);
Index: trunk/src/lib/math/line.cc
===================================================================
--- trunk/src/lib/math/line.cc	(revision 9391)
+++ trunk/src/lib/math/line.cc	(revision 9406)
@@ -26,5 +26,5 @@
 #endif
 
-using namespace std;
+
 
 /**
Index: trunk/src/lib/math/plane.cc
===================================================================
--- trunk/src/lib/math/plane.cc	(revision 9391)
+++ trunk/src/lib/math/plane.cc	(revision 9406)
@@ -24,5 +24,5 @@
 #endif
 
-using namespace std;
+
 
 /**
Index: trunk/src/lib/math/rotation_OBSOLETE.cc
===================================================================
--- trunk/src/lib/math/rotation_OBSOLETE.cc	(revision 9391)
+++ trunk/src/lib/math/rotation_OBSOLETE.cc	(revision 9406)
@@ -24,5 +24,5 @@
 #endif
 
-using namespace std;
+
 
 /**
Index: trunk/src/lib/math/vector2D.cc
===================================================================
--- trunk/src/lib/math/vector2D.cc	(revision 9391)
+++ trunk/src/lib/math/vector2D.cc	(revision 9406)
@@ -27,5 +27,5 @@
 #endif
 
-using namespace std;
+
 
 /////////////
Index: trunk/src/lib/network/Makefile.am
===================================================================
--- trunk/src/lib/network/Makefile.am	(revision 9391)
+++ trunk/src/lib/network/Makefile.am	(revision 9406)
@@ -8,5 +8,4 @@
 		      shared_network_data.cc \
 		      network_socket.cc \
-		      connection_monitor.cc \
 		      network_stream.cc \
                       data_stream.cc \
@@ -20,4 +19,5 @@
 		      network_game_manager.cc \
 		      converter.cc \
+		      peer_info.cc \
 		      message_manager.cc \
 		      network_log.cc \
@@ -25,4 +25,10 @@
 		      player_stats.cc \
 		      udp_broadcast.cc \
+		      \
+		      proxy/network_settings.cc \
+		      \
+				  monitor/connection_monitor.cc \
+		      monitor/network_monitor.cc \
+		      monitor/network_node.cc \
 		      \
 		      synchronizeable_var/synchronizeable_var.cc \
@@ -33,40 +39,55 @@
 		      synchronizeable_var/synchronizeable_float.cc \
 		      synchronizeable_var/synchronizeable_bool.cc \
-		      synchronizeable_var/synchronizeable_uint.cc 
+		      synchronizeable_var/synchronizeable_uint.cc \
+		      synchronizeable_var/synchronizeable_ip.cc \
+		      \
+		      ip.cc
 
 
 
 
-noinst_HEADERS = synchronizeable.h \
-                 network_manager.h \
-                 shared_network_data.h \
-                 network_socket.h \
-                 connection_monitor.h \
-		 network_stream.h \
-                 data_stream.h \
-                 network_protocol.h \
-		 server_socket.h \
-		 tcp_server_socket.h \
-		 tcp_socket.h \
-		 udp_server_socket.h \
-		 udp_socket.h \
-		 handshake.h \
-		 network_game_manager.h \
-		 converter.h \
-		 netdefs.h \
-		 message_manager.h \
-		 network_log.h \
-		 zip.h \
-		 player_stats.h \
-		 udp_broadcast.h \
-		 \
-		 synchronizeable_var/synchronizeable_var.h \
-		 synchronizeable_var/synchronizeable_vector.h \
-		 synchronizeable_var/synchronizeable_int.h \
-		 synchronizeable_var/synchronizeable_quaternion.h \
-		 synchronizeable_var/synchronizeable_string.h \
-		 synchronizeable_var/synchronizeable_float.h \
-		 synchronizeable_var/synchronizeable_bool.h \
-		 synchronizeable_var/synchronizeable_uint.h
-
-
+noinst_HEADERS = \
+		netdefs.h \
+		nettypes.h \
+		netincl.h \
+		\
+		synchronizeable.h \
+                network_manager.h \
+                shared_network_data.h \
+                network_socket.h \
+		network_stream.h \
+                data_stream.h \
+                network_protocol.h \
+		server_socket.h \
+		tcp_server_socket.h \
+		tcp_socket.h \
+		udp_server_socket.h \
+		udp_socket.h \
+		handshake.h \
+		network_game_manager.h \
+		converter.h \
+		peer_info.h \
+		netdefs.h \
+		message_manager.h \
+		network_log.h \
+		zip.h \
+		player_stats.h \
+		udp_broadcast.h \
+		\
+		proxy/network_settings.cc \
+		\
+                monitor/connection_monitor.h \
+                monitor/network_monitor.h \
+                monitor/network_node.h \
+		\
+		synchronizeable_var/synchronizeable_var.h \
+		synchronizeable_var/synchronizeable_vector.h \
+		synchronizeable_var/synchronizeable_int.h \
+		synchronizeable_var/synchronizeable_quaternion.h \
+		synchronizeable_var/synchronizeable_string.h \
+		synchronizeable_var/synchronizeable_float.h \
+		synchronizeable_var/synchronizeable_bool.h \
+		synchronizeable_var/synchronizeable_uint.h \
+		synchronizeable_var/synchronizeable_ip.h \
+		\
+		ip.h
Index: trunk/src/lib/network/README
===================================================================
--- trunk/src/lib/network/README	(revision 9391)
+++ 	(revision )
@@ -1,16 +1,0 @@
-
-
-Hi people
-
-Before starting your implementation, please have a look at the 
-./network_monitor.cc
-./network_monitor.h
-files. They are well commented and include everything you will have 
-to use.
-
-For network module information, check out:
-https://www.orxonox.net/cgi-bin/trac.cgi/wiki/NetworkManager
-
-
-
-
Index: trunk/src/lib/network/README.NETWORK
===================================================================
--- trunk/src/lib/network/README.NETWORK	(revision 9406)
+++ trunk/src/lib/network/README.NETWORK	(revision 9406)
@@ -0,0 +1,20 @@
+
+
+This readme just gives some hints for the general network programming:
+
+ARCHITECTURE:
+The NetworkStream is in the center of this structure.
+
+
+UserId:
+containing the id of a user (==client). This id must be unique within a orxonox network its used especialy in the NetworkStream for node identification and also in the Synchronizeable base class for permissions checking (PERMISSION_OWNER)
+WARNING:
+There is some correlation between userids and the maxplayer, do not touch this.
+
+
+uniqueId:
+uniqueId is an id (unique :D) for each synchronizeable to be identified in a network. the number space for uniqueIds goes from 0 to maxplayers - 1
+
+
+NetworkStream PeerInfo list: (peers)
+The network node with the offset 0 is always the server to which the client must connect to (in case there are connections to other hosts at the same time).
Index: trunk/src/lib/network/connection_monitor.cc
===================================================================
--- trunk/src/lib/network/connection_monitor.cc	(revision 9391)
+++ 	(revision )
@@ -1,257 +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: Christoph Renner
-   co-programmer: ...
-*/
-
-#include "connection_monitor.h"
-#include "network_log.h"
-
-#include <debug.h>
-#include <SDL/SDL.h>
-#include <string.h>
-
-/* using namespace std is default, this needs to be here */
-using namespace std;
-
-/**
- * constructor
- * @param userId user's id
- */
-ConnectionMonitor::ConnectionMonitor( int userId )
-{
-  /* set the class id for the base object and add ist to class list*/
-  this->setClassID(CL_CONNECTION_MONITOR, "ConnectionMonitor");
-  
-  this->userId = userId;
-  this->ping = 0;
-  this->incomingUnzippedBandWidth = 0;
-  this->outgoingUnzippedBandWidth = 0;
-  this->incomingZippedBandWidth = 0;
-  this->outgoingZippedBandWidth = 0;
-  this->nIncomingPackets = 0;
-  this->nOutgoingPackets = 0;
-  this->nZIncomingPackets = 0;
-  this->nZOutgoingPackets = 0;
-  
-  this->lastPacketTick = 0;
-  this->lastPrintTick = 0;
-}
-
-/**
- * deconstructor
- */
-ConnectionMonitor::~ConnectionMonitor( )
-{
-}
-
-/**
- * process unzipped outgoing packet
- * @param data pointer to packet data
- * @param length length of packet
- * @param stateId packet's state id
- */
-void ConnectionMonitor::processUnzippedOutgoingPacket( int tick, byte * data, int length, int stateId )
-{
-  nOutgoingPackets++;
-  
-  // for ping calculation
-  sentStateTicks[stateId] = tick;
-  
-  // calculate bandwidth
-  outgoingUnzippedPacketHistory[tick] = length;
-  outgoingUnzippedBandWidth = calculateBandWidth( outgoingUnzippedPacketHistory, tick );
-  
-  //NETPRINTF(n)("UNZIPPED UPSTREAM: user: %d bandwidth %f\n", userId, outgoingUnzippedBandWidth );
-  
-  // count zero bytes
-  //int nZeroBytes = 0;
-  
-  //for ( int i = 0; i < length; i++ )
-  //  if ( data[i] == '\0' )
-  //    nZeroBytes++;
-  
-  //NETPRINTF(n)( "ZEROBYTES: %d (%f%%)\n", nZeroBytes, ((float)100)*nZeroBytes/length );
-}
-
-/**
- * process unzipped incoming packet
- * @param data pointer to packet data
- * @param length length of packet
- * @param stateId packet's state id
- * @param ackedState state which was acked by this packet
- */
-void ConnectionMonitor::processUnzippedIncomingPacket( int tick, byte * data, int length, int stateId, int ackedState )
-{
-  nIncomingPackets++;
-  
-  lastPacketTick = tick;
-  
-  // calculate ping
-  if ( sentStateTicks.find( ackedState ) != sentStateTicks.end() )
-  {
-    ackDelay.push_back( tick - sentStateTicks[ackedState] );
-  }
-  
-  while ( sentStateTicks.begin() != sentStateTicks.end() && sentStateTicks.begin()->first <= ackedState )
-    sentStateTicks.erase( sentStateTicks.begin() );
-      
-  while ( ackDelay.size() > N_PACKETS_FOR_PING )
-    ackDelay.erase( ackDelay.begin() );
-      
-  ping = 0;
-      
-  for ( std::list<int>::iterator it = ackDelay.begin(); it != ackDelay.end(); it++ )
-    ping += *it;
-      
-  if ( ackDelay.size() == 0 )
-    ping = -1;
-  else
-    ping /= ackDelay.size();
-      
-  //NETPRINTF(n)("PING: user: %d ping: %d\n", userId, ping );
-  
-  // calculate bandwidth
-  incomingUnzippedPacketHistory[tick] = length;
-  incomingUnzippedBandWidth = calculateBandWidth( incomingUnzippedPacketHistory, tick );
-  
-  //NETPRINTF(n)("UNZIPPED DOWNSTREAM: user: %d bandwidth %f\n", userId, incomingUnzippedBandWidth );
-  
-}
-
-/**
- * remove old packets
- * @param packetHistory 
- * @param tick 
- */
-void ConnectionMonitor::removeOldPackets( std::map< int, int > & packetHistory, int tick )
-{
-  while ( packetHistory.begin()->first < tick - MSECS_TO_CALC_BWIDTH )
-    packetHistory.erase( packetHistory.begin() );
-}
-
-/**
- * calculate bandwidth out of packethistory
- * @param packetHistory packet history
- * @param tick current tick from SDL_GetTicks
- * @return bandwidth in bytes/sec
- */
-float ConnectionMonitor::calculateBandWidth( std::map< int, int > & packetHistory, int tick )
-{
-  removeOldPackets( packetHistory, tick );
-  
-  float res = 0.0f;
-#if 0
-  for ( std::map<int,int>::iterator it = packetHistory.begin(); it != packetHistory.end(); it++ )
-  {
-    if ( it != packetHistory.begin() )
-      res += it->second;
-  }
-  
-  if ( packetHistory.size() <= 1 || tick - packetHistory.begin()->first == 0 )
-    res = 0.0f;
-  else
-    res /= (float)(tick - packetHistory.begin()->first);
-  
-  res *= 1000.0f;
-#endif
-
-  for ( std::map<int,int>::iterator it = packetHistory.begin(); it != packetHistory.end(); it++ )
-  {
-    res += it->second;
-  }
-  
-  if ( packetHistory.size() <= 1 )
-    res = 0.0f;
-  else
-    res /= (float)(tick - packetHistory.begin()->first);
-  
-  res *= 1000.0f;
-
-  return res;
-}
-
-
-/**
- * process zipped outgoing packet
- * @param data pointer to packet data
- * @param length length of packet
- * @param stateId packet's state id
- */
-void ConnectionMonitor::processZippedOutgoingPacket( int tick, byte * data, int length, int stateId )
-{
-  nZOutgoingPackets++;
-  
-  // calculate bandwidth
-  outgoingZippedPacketHistory[tick] = length;
-  outgoingZippedBandWidth = calculateBandWidth( outgoingZippedPacketHistory, tick );
-  
-  //NETPRINTF(n)("UPSTREAM: user: %d bandwidth %f nOutgoingPackets %d\n", userId, outgoingZippedBandWidth, nOutgoingPackets );
-
-  if ( lastPrintTick < tick-1000 )
-  {
-    printStatis();
-    lastPrintTick = tick;
-  }
-}
-
-
-/**
- * process zipped incoming packet
- * @param data pointer to packet data
- * @param length length of packet
- * @param stateId packet's state id
- * @param ackedState state which was acked by this packet
- */
-void ConnectionMonitor::processZippedIncomingPacket( int tick, byte * data, int length )
-{
-  nZIncomingPackets++;
-  
-  // calculate bandwidth
-  incomingZippedPacketHistory[tick] = length;
-  incomingZippedBandWidth = calculateBandWidth( incomingZippedPacketHistory, tick );
-  
-  //NETPRINTF(n)("DOWNSTREAM: user: %d bandwidth %f nIncomingPackets %d\n", userId, incomingZippedBandWidth, nIncomingPackets );
-  
-}
-
-
-/**
- * check if client sent no packets for SECS_TO_TIMEOUT
- * @return true if last packet recieved \< NOW() - SECS_TO_TIMEOUT
- */
-bool ConnectionMonitor::hasTimedOut( )
-{
-  if ( lastPacketTick + SECS_TO_TIMEOUT*1000 < SDL_GetTicks() && nIncomingPackets > 0 )
-    return true;
-  
-  if ( nIncomingPackets == 0 && nOutgoingPackets >= NETWORK_FREQUENCY*SECS_TO_TIMEOUT )
-    return true;
-  
-  return false;
-}
-
-
-
-/**
- * prints bandwith usage, ping and other important things to telnet-console
- */
-void ConnectionMonitor::printStatis( )
-{
-  NETPRINT(n)("============NETWORKSTATS FOR USER %d============\n", userId);
-  NETPRINT(n)("PING = %d\n", ping );
-  NETPRINT(n)("BANDWIDTH: UP: %f (%f) DOWN %f (%f)\n", outgoingZippedBandWidth, outgoingUnzippedBandWidth, incomingZippedBandWidth, incomingUnzippedBandWidth);
-  NETPRINT(n)("PACKETS: RECIEVED %d; SENT %d\n", nIncomingPackets, nOutgoingPackets );
-  NETPRINT(n)("================================================\n");
-}
-
-
Index: trunk/src/lib/network/connection_monitor.h
===================================================================
--- trunk/src/lib/network/connection_monitor.h	(revision 9391)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*!
- * @file connection_monitor.h
-    \brief provides information about the quality of a connection.
- */
-
-#ifndef _CONNECTION_MONITOR_H
-#define _CONNECTION_MONITOR_H
-
-#include "base_object.h"
-#include "netdefs.h"
-
-#include <map>
-#include <list>
-
-#define N_PACKETS_FOR_PING 20
-#define MSECS_TO_CALC_BWIDTH 1000
-#define SECS_TO_TIMEOUT 30
-
-class ConnectionMonitor : virtual public BaseObject
-{
-  public:
-    ConnectionMonitor( int userId );
-    virtual ~ConnectionMonitor();
-
-    void processUnzippedOutgoingPacket( int tick, byte * data, int length, int stateId );
-    void processUnzippedIncomingPacket( int tick, byte * data, int length, int stateId, int ackedState );
-
-    void processZippedOutgoingPacket( int tick, byte * data, int length, int stateId );
-    void processZippedIncomingPacket( int tick, byte * data, int length );
-
-    void calculatePing();
-
-    bool hasTimedOut();
-
-    void printStatis();
-
-  private:
-    float calculateBandWidth( std::map<int,int> & packetHistory, int tick );
-    void removeOldPackets( std::map<int,int> & packetHistory, int tick );
-
-    int userId;       //!< user's id
-
-    std::map<int,int>   sentStateTicks;
-
-    std::map<int,int>   incomingUnzippedPacketHistory;
-    std::map<int,int>   outgoingUnzippedPacketHistory;
-
-    std::map<int,int>   incomingZippedPacketHistory;
-    std::map<int,int>   outgoingZippedPacketHistory;
-
-    std::list<int>      ackDelay;
-    int                 ping;
-
-    float               incomingUnzippedBandWidth;
-    float               outgoingUnzippedBandWidth;
-
-    float               incomingZippedBandWidth;
-    float               outgoingZippedBandWidth;
-
-    int                 nIncomingPackets;
-    int                 nOutgoingPackets;
-
-    int                 nZIncomingPackets;
-    int                 nZOutgoingPackets;
-
-    int                 lastPacketTick;
-
-    int                 lastPrintTick;
-  };
-
-#endif
Index: trunk/src/lib/network/converter.cc
===================================================================
--- trunk/src/lib/network/converter.cc	(revision 9391)
+++ trunk/src/lib/network/converter.cc	(revision 9406)
@@ -10,6 +10,6 @@
 
 ### File Specific:
-   main-programmer: Benjamin Wuest
-   co-programmer: ...
+   main-programmer: Benjamin Wuest (bwuest@ee.ethz.ch)
+   co-programmer: Christoph Renner (rennerc@ee.ethz.ch)
 */
 
@@ -30,5 +30,5 @@
 
 /* using namespace std is default, this needs to be here */
-using namespace std;
+
 
 /*!
@@ -38,5 +38,4 @@
 {
   /* set the class id for the base object */
-  //this->setClassID(CL_ENTITY_MANAGER, "EntityManager");
 }
 
Index: trunk/src/lib/network/data_stream.cc
===================================================================
--- trunk/src/lib/network/data_stream.cc	(revision 9391)
+++ trunk/src/lib/network/data_stream.cc	(revision 9406)
@@ -19,5 +19,5 @@
 
 /* using namespace std is default, this needs to be here */
-using namespace std;
+
 
 
Index: trunk/src/lib/network/handshake.cc
===================================================================
--- trunk/src/lib/network/handshake.cc	(revision 9391)
+++ trunk/src/lib/network/handshake.cc	(revision 9406)
@@ -10,12 +10,9 @@
 
 ### File Specific:
-   main-programmer: christoph
-   co-programmer:
+   main-programmer: Christoph Renner (rennerc@ee.ethz.ch)
+   co-programmer: Patirck Boenzli (boenzlip@orxonox.ethz.ch)
 */
 
 
-/* this is for debug output. It just says, that all calls to PRINT() belong to the DEBUG_MODULE_NETWORK module
-   For more information refere to https://www.orxonox.net/cgi-bin/trac.cgi/wiki/DebugOutput
-*/
 #define DEBUG_MODULE_NETWORK
 
@@ -25,5 +22,9 @@
 #include "debug.h"
 
-Handshake::Handshake( bool server, int clientId, int networkGameManagerId, int messageManagerId )
+
+
+
+
+ Handshake::Handshake( int nodeType, int clientId, int networkGameManagerId, int messageManagerId )
   : Synchronizeable()
 {
@@ -31,6 +32,6 @@
   this->setClassID(CL_HANDSHAKE, "Handshake");
 
-  this->setIsServer(server);
 
+  // register all variable handlers
   orxId_handler = registerVarId( new SynchronizeableInt( &localState.orxId, &remoteState.orxId, "orxonoxId", PERMISSION_ALL ) );
   version_handler = registerVarId( new SynchronizeableInt( &localState.version, &remoteState.version, "version", PERMISSION_ALL ) );
@@ -42,8 +43,16 @@
   errorString_handler = registerVarId( new SynchronizeableString( &localState.errorString, &remoteState.errorString, "errorString", PERMISSION_ALL ) );
 
+  this->nodeTypeHandler = registerVarId( new SynchronizeableInt( &localState.nodeType, &remoteState.nodeType, "nodeType", PERMISSION_ALL ) );
+
   candel_id = registerVarId( new SynchronizeableInt( &localState.canDel, &remoteState.canDel, "canDel", PERMISSION_ALL ) );
-  
+
   registerVar( new SynchronizeableString( &localState.preferedNickName, &remoteState.preferedNickName, "preferedNickName", PERMISSION_ALL ) );
+  // now synchronize only two of the available proxy server addresses
+  registerVar( new SynchronizeableIP( &this->proxy1, &this->proxy1, "proxy server 1", PERMISSION_MASTER_SERVER ) );
+  registerVar( new SynchronizeableIP( &this->proxy2, &this->proxy2, "proxy server 2", PERMISSION_MASTER_SERVER ) );
+  registerVar( new SynchronizeableInt( &this->redirectProxy, &this->redirectProxy, "proxy server redirection flag", PERMISSION_MASTER_SERVER ) );
 
+
+  // init the local state
   localState.completed = 0;
   localState.error = 0;
@@ -54,6 +63,9 @@
   localState.orxId = _ORXONOX_ID;
   localState.version = _ORXONOX_VERSION;
+  localState.nodeType = nodeType;
   localState.canDel = 0;
 
+
+  // init the remote state
   remoteState.completed = 0;
   remoteState.error = 0;
@@ -64,9 +76,18 @@
   remoteState.orxId = 0;
   remoteState.version = 0;
+  remoteState.nodeType = NET_CLIENT;
   remoteState.canDel = 0;
 
+
+  this->proxy1 = IP(0, 0);
+  this->proxy2 = IP(0, 0);
+  this->redirectProxy = 0;
+
+
+  // activate the synchronization process
   this->setSynchronized(true);
   PRINTF(0)("Handshake created clientId = %d\n", clientId);
 }
+
 
 /**
@@ -78,5 +99,6 @@
   for ( std::list<int>::iterator it = id.begin(); it != id.end(); it++ )
   {
-    if ( *it == orxId_handler )
+    // orxonox id handler
+    if ( *it == this->orxId_handler )
     {
       if ( remoteState.orxId != _ORXONOX_ID )
@@ -87,8 +109,8 @@
         continue;
       }
-
     }
 
-    if ( *it == version_handler )
+    // orxonox version handler
+    if ( *it == this->version_handler )
     {
       if ( remoteState.version != _ORXONOX_VERSION )
@@ -99,19 +121,36 @@
         continue;
       }
-
     }
 
+    // node type handler: for each node type there is a specific action to be taken
+    if ( *it == this->nodeTypeHandler)
+    {
+      if ( remoteState.nodeType == NET_MASTER_SERVER )
+      {
+        continue;
+      }
+      else if( remoteState.nodeType == NET_PROXY_SERVER_ACTIVE)
+      {
+        continue;
+      }
+      else if( remoteState.nodeType == NET_CLIENT)
+      {
+        continue;
+      }
+    }
+
+    // cancel
     if ( *it == candel_id )
     {
       PRINTF(0)("handshake finished candel changed\n");
     }
-
   }
 
-  if (
-      remoteState.orxId == _ORXONOX_ID &&
-      remoteState.version == _ORXONOX_VERSION
-     )
+  // handshake completed
+  if ( remoteState.orxId == _ORXONOX_ID &&
+       remoteState.version == _ORXONOX_VERSION )
+  {
     localState.completed = 1;
+  }
 }
 
Index: trunk/src/lib/network/handshake.h
===================================================================
--- trunk/src/lib/network/handshake.h	(revision 9391)
+++ trunk/src/lib/network/handshake.h	(revision 9406)
@@ -1,5 +1,9 @@
 /*!
  * @file network_stream.h
- *  implementation of a network pipe
+ *  implementation of a network pipe. This node handles the handshake of two network nodes and exchanges informationas
+ * vial to the connection setup.
+ *
+ * the local node only writes in the localState variable. the remoteState variable will be written from the remote network node
+ * so don't write into it!
  */
 
@@ -8,62 +12,110 @@
 
 #include "base_object.h"
+#include "ip.h"
 #include "synchronizeable.h"
+#include "shared_network_data.h"
 
-#define _ORXONOX_ID 0xF91337A0
+//!< a struct to save the handshakes to
+struct HandshakeState
+{
+  int           orxId;                         //!< orxonox id
+  int           version;                       //!< network protocol version
 
-#define _ORXONOX_VERSION 1
+  int           networkManagerId;              //!< unique id of the network manager
+  int           messageManagerId;              //!< unique id of the message manager
+  int           hostId;                        //!< host id
+  int           nodeType;                      //!< type of the network node
 
-struct HandshakeState {
-  int orxId;
-  int version;
-  
-  int networkManagerId;
-  int messageManagerId;
-  int hostId;
-  
-  int completed;
-  int canDel;
-  
-  int error;
-  
-  std::string errorString;
-  
+  int           completed;                     //!< true if completed
+  int           canDel;                        //!< true if marked for deletion
+
+  int           error;                         //!< error number
+
+  std::string   errorString;                   //!< error string
+
   //additional data
-  std::string preferedNickName;
+  std::string   preferedNickName;              //!< prefered nick name
 };
 
+
+//!< the handshake itself with some interface functions
 class Handshake : public Synchronizeable
 {
+
   public:
-    Handshake( bool server, int clientId = 0, int networkGameManagerId = 0, int messageManagerId = 0 );
-    inline bool       completed(){ return localState.completed != 0 && remoteState.completed != 0; }
-    inline bool       ok(){ return localState.error == 0 && remoteState.error == 0; }
-    inline int        getHostId(){ return remoteState.hostId; }
-    inline int        getNetworkGameManagerId(){ return remoteState.networkManagerId; }
-    inline int        getMessageManagerId(){ return remoteState.messageManagerId; }
-    inline void       doReject( std::string reason ){ localState.error = 1; localState.errorString = "the server rejected your connection ["+ reason +"]"; }
-    inline bool       canDel(){ return localState.canDel == 1 && remoteState.canDel == 1; }
-    inline bool       allowDel(){ return localState.canDel == 1; }
-    inline void       del(){ localState.canDel = 1; }
-    
-    inline void       setPreferedNickName( const std::string & nick ){ localState.preferedNickName = nick; }
+    Handshake( int nodeType, int clientId = 0, int networkGameManagerId = 0, int messageManagerId = 0 );
+
+
+    /* functions indicating states of the handshake */
+    /** @returns true if the handshake is completed */
+    inline bool completed(){ return localState.completed != 0 && remoteState.completed != 0; }
+    /** @returns true if no error has occured until now */
+    inline bool ok(){ return localState.error == 0 && remoteState.error == 0; }
+    /** stops the handshake and reject the other side with @param reason: string describing the reason */
+    inline void doReject( std::string reason ){ localState.error = 1; localState.errorString = "the server rejected your connection ["+ reason +"]"; }
+    /** @returns true if the handshake is finished and the instances can be deleted */
+    inline bool canDel(){ return localState.canDel == 1 && remoteState.canDel == 1; }
+    /** @returns true if the local state can be removed*/
+    inline bool allowDel(){ return localState.canDel == 1; }
+    /** marks the handshake to be deleted */
+    inline void del(){ localState.canDel = 1; }
+
+
+    /* the actual informations exchanged in the handshake */
+    /** @returns the host id of the remote host */
+    inline int  getHostId(){ return remoteState.hostId; }
+    /** @returns the unique id of the network game manager*/
+    inline int  getNetworkGameManagerId(){ return remoteState.networkManagerId; }
+    /** @returns the unique id of the message manager */
+    inline int  getMessageManagerId(){ return remoteState.messageManagerId; }
+    /** @returns the node type of the remote host */
+    inline int getRemoteNodeType() { return this->remoteState.nodeType; }
+
+    /** sets @param nick the prefereded nick name */
+    inline void setPreferedNickName( const std::string & nick ){ localState.preferedNickName = nick; }
+    /** @returns the prefered nick name */
     inline std::string getPreferedNickName(){ return remoteState.preferedNickName; }
-    
+
+    /** @returns if true the local client should reconnect to a proxy server from the proxy server list */
+    inline bool redirect() { return this->redirectProxy;}
+    /** @param flag: indicating if the client should be redirected */
+    inline void setRedirect(bool flag) { if( SharedNetworkData::getInstance()->isClient()) return; this->redirectProxy = (int)flag; }
+
+    /** @param address: the address of the proxy server 1 if any */
+    inline void setProxy1Address(IP address) { if( SharedNetworkData::getInstance()->isClient()) return; this->proxy1 = address; }
+    /** @returns the address of the proxy server 1 if any */
+    inline IP getProxy1Address() { return this->proxy1; }
+    /** @param address: the address of the proxy server 2 if any */
+    inline void setProxy2Address(IP address) { if( SharedNetworkData::getInstance()->isClient()) return; this->proxy2 = address; }
+    /** @returns the address of the proxy server 2 if any */
+    inline IP getProxy2Address() { return this->proxy2; }
+
+
+    /* variable handler function */
     virtual void varChangeHandler( std::list<int> & id );
 
+
   private:
-    HandshakeState localState;
-    HandshakeState remoteState;
-    
-    int netManId_handler;
-    int msgManId_handler;
-    int hostId_handler;
-    int completed_handler;
-    int error_handler;
-    int errorString_handler;
-    int orxId_handler;
-    int version_handler;
-    int candel_id;
+    HandshakeState     localState;                            //!< the local handshake state
+    HandshakeState     remoteState;                           //!< the remote handshake state
 
+    int                orxId_handler;                         //!< orxonox id handler
+    int                version_handler;                       //!< orxonox version id handler
+    int                netManId_handler;                      //!< network manager handler
+    int                msgManId_handler;                      //!< message manager handler
+    int                hostId_handler;                        //!< host id handler
+    int                nodeTypeHandler;                       //!< node type handler
+    int                proxy1Handler;                         //!< handler for the proxy
+    int                proxy2Handler;                         //!< handler for the proxy
+
+    int                completed_handler;                     //!< handshake completion handler
+    int                error_handler;                         //!< handshake error handler
+    int                errorString_handler;                   //!< handshake error string handler
+    int                candel_id;                             //!< handshake deletion handler
+    int                nodeType;                              //!, the type of the network node
+
+    int                redirectProxy;                         //!< true if the client should reconnect to a proxy server
+    IP                 proxy1;                               //!< ip address of the first proxy (0.0.0.0 of not available)
+    IP                 proxy2;                               //!< ip address of the second proxy (0.0.0.0 of not available)
 };
 
Index: trunk/src/lib/network/ip.cc
===================================================================
--- trunk/src/lib/network/ip.cc	(revision 9406)
+++ trunk/src/lib/network/ip.cc	(revision 9406)
@@ -0,0 +1,296 @@
+/**
+ * @file ip.cc
+ * @brief A IP class, that handles IP names and resolution.
+ *
+ * code taken from audiere.
+ *
+ *
+   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: Benjamin Grauer
+ * co-programmer: Patrick Boenzli
+ */
+
+#include "ip.h"
+
+#include <iostream>
+
+#include "multi_type.h"
+#include "substring.h"
+
+/**
+ * @brief default constructor
+ */
+IP::IP()
+{
+  this->_host = 0;
+  this->_port = IP::_defaultPort;
+}
+
+
+/**
+ * @brief constructor from ip and port
+ * @param ip the IP
+ * @param port the Port
+ * @return self
+ */
+IP::IP(int ip, int port)
+{
+  this->_host = ip;
+  if (port != -1)
+    this->_port = port;
+  else
+    this->_port = IP::_defaultPort;
+}
+
+
+/**
+ * @brief constructor from a String
+ * @param ip the IP as a String.
+ * @param resolve if true, the IP is resolved via DNS,
+ * @return self
+ */
+IP::IP(const std::string& ip, bool resolve)
+{
+  *this = IP::stringToIP(ip, IP::_defaultPort, resolve);
+}
+
+/**
+ * @brief constructor from a String
+ * @param ip the IP as a String.
+ * @param port The port to be resolved.
+ * @param resolve if true, the IP is resolved via DNS,
+ * @return self
+ */
+IP::IP(const std::string& ip, int port, bool resolve)
+{
+  *this = IP::stringToIP(ip, port, resolve);
+}
+
+
+/**
+ * @brief constructor from an SDL net structure IPaddress
+ * @param ip the ip.
+ * @return self
+ */
+IP::IP(const IPaddress& ip)
+{
+  this->_host = ip.host;
+  this->_port = ip.port;
+}
+
+
+/**
+ * @brief copy constructor.
+ * @param ip the IP to copy.
+ * @return self
+ */
+IP::IP(const IP& ip)
+{
+  *this = ip;
+}
+
+
+/**
+ * @brief constructs an IP out of the four pairs and a Port.
+ * @param first The first octal.
+ * @param second The second octal.
+ * @param third The third octal.
+ * @param fourth The fourth octal.
+ * @param port The Port.
+ * @return self.
+ */
+IP::IP(unsigned int first, unsigned int second, unsigned int third, unsigned int fourth, int port)
+{
+  this->_host = (first << 24) +
+                (second << 16) +
+                (third <<  8) +
+                fourth;
+  this->_port = port;
+}
+
+
+/**
+ * @brief copy operator
+ * @param ip the IP to copy.
+ * @return self.
+ */
+const IP& IP::operator=(const IP& ip)
+{
+  this->_host = ip.host();
+  this->_port = ip.port();
+  return *this;
+}
+
+
+/**
+ * @brief copy operator
+ * @param ip the IP to copy.
+ * @return self.
+ */
+const IP& IP::operator=(const IPaddress& ip)
+{
+  this->_host = ip.host;
+  this->_port = ip.port;
+  return *this;
+}
+
+
+/**
+ * @brief comparison operator
+ * @param ip the IP to compare
+ * @return true if ip _and_ port match.
+ */
+bool IP::operator==(const IP& ip) const
+{
+  return (this->_host == ip.host() &&
+          this->_port == ip.port());
+}
+
+
+/**
+ * @brief comparison operator
+ * @param ip the IP to compare
+ * @return true if ip _or_ port do not match.
+ */
+bool IP::operator!=(const IP& ip) const
+{
+  return (this->_host != ip.host() ||
+          this->_port != ip.port());
+}
+
+
+/**
+ * @brief converts a String into an IP Object.
+ * @param ip The string holding an IP.
+ * @param port The port to be resolved.
+ * @param resolve if true, the IP is resolved via DNS,
+ * otherwise (resolve == false) the IP is being transformed
+ * from a String (xxx.xxx.xxx.xxx) to an integer.
+ *
+ * @return A newly constructed IP.
+ */
+IP IP::stringToIP(const std::string& ip, int port, bool resolve)
+{
+  if (resolve)
+  {
+    IPaddress ipaddr;
+
+    SDLNet_ResolveHost(&ipaddr, NULL, 2000);
+
+    return IP(ipaddr.host, port);
+  }
+  else
+  {
+    SubString ipaddr(ip, '.');
+    if(ip.size() != 4 )
+      return IP();
+
+    MultiType part0(ipaddr[0]);
+    MultiType part1(ipaddr[1]);
+    MultiType part2(ipaddr[2]);
+    MultiType part3(ipaddr[3]);
+
+    int addr = (part0.getInt() << 24) +
+               (part1.getInt() << 16) +
+               (part2.getInt() <<  8) +
+               part3.getInt();
+    return IP(addr, port);
+  }
+}
+
+
+/**
+ * @brief if you want to have a specific part of an IP
+ * @param part the n'th part of the IP addr (splitted by '.').
+ * @return the amount held in the designated part.
+ */
+int IP::ipPart(unsigned int part) const
+{
+  switch (part)
+  {
+    case 0:
+      return  (_host & 0xFF000000) >> 24;
+    case 1:
+      return  (_host & 0x00FF0000) >> 16;
+    case 2:
+      return  (_host & 0x0000FF00) >> 8;
+    case 3:
+      return  (_host & 0x000000FF);
+    default:
+      return -1;
+  }
+}
+
+
+/**
+ * @return the Ip as a string.
+ */
+std::string IP::ipString() const
+{
+  return IP::ipToString(this->_host, this->_port);
+}
+
+
+/**
+ * @brief converts an IPaddress struct into a String.
+ * @param ipaddr the IP address as a SDL_net struct.
+ * @return the string retrieved from the IP.
+ */
+std::string IP::ipToString(const IPaddress& ipaddr)
+{
+  int ip = SDLNet_Read32 (ipaddr.host);
+  return IP::ipToString(ip, ipaddr.port);
+}
+
+
+/**
+ * @brief converts a IP into a String (without port).
+ * @param ip the IP to put into the string.
+ * @param port -1 if not wanted
+ * @return the string of the ip.
+ */
+std::string IP::ipToString(int ip, int port)
+{
+  MultiType part0((int) (ip & 0xFF000000) >> 24);
+  MultiType part1((int) (ip & 0x00FF0000) >> 16);
+  MultiType part2((int) (ip & 0x0000FF00) >>  8);
+  MultiType part3((int) (ip & 0x000000FF) );
+
+  std::string addr = part3.getString() + "." + part2.getString() + "." +
+                     part1.getString() + "." + part0.getString();
+
+  if (port != -1)
+    addr += ":" + MultiType(port).getString();
+  return addr;
+}
+
+
+/// default port definition.
+int IP::_defaultPort = 9999;
+
+/**
+ * @brief if no IP is supplied this port is used, so that IP can be resolved usefully.
+ * @param defaultPort The default port.
+ */
+void IP::setDefaultPort(int defaultPort)
+{
+  IP::_defaultPort = defaultPort;
+}
+
+
+/**
+ * @brief print out the IP in a nice fashion
+ */
+void IP::debug() const
+{
+  std::cout << "IP is " << this->ipString() << std::endl;
+}
Index: trunk/src/lib/network/ip.h
===================================================================
--- trunk/src/lib/network/ip.h	(revision 9406)
+++ trunk/src/lib/network/ip.h	(revision 9406)
@@ -0,0 +1,68 @@
+
+/*!
+ * @file ip.h
+ *
+ * @brief the ip class is used to transform strings to ip's and backwards
+ * it can also be used to
+ */
+
+#ifndef __IP_H__
+#define __IP_H__
+
+#include "netincl.h"
+#include <string>
+
+
+
+//! A class to handle time itself
+class IP
+{
+  public:
+    /// CONSTRUCTORS
+    IP();
+    IP(int ip, int port);
+    IP(const std::string& ip, bool resolve = true);
+    IP(const std::string& ip, int port = -1, bool resolve = true);
+    IP(const IPaddress& ip);
+    IP(const IP& ip);
+    IP(unsigned int first, unsigned int second, unsigned int third, unsigned int fourth, int port = IP::_defaultPort);
+
+    /// OPERATORS
+    const IP& operator=(const IP& ip);
+    const IP& operator=(const IPaddress& ip);
+    bool operator==(const IP& ip) const;
+    bool operator!=(const IP& up) const;
+
+    /// RETRIVEAL
+    /** @returns the IP */
+    int host() const { return this->_host; };
+    int* hostRef()  { return &this->_host; }
+    /** @returns the Port */
+    int port() const { return this->_port; };
+    int* portRef() { return &this->_port; };
+
+    inline IPaddress getSDLNotation() { IPaddress sdlIP; sdlIP.host = this->_host; sdlIP.port = this->_port; return sdlIP; }
+
+    int ipPart(unsigned int part) const;
+    std::string ipString() const;
+
+    void debug() const;
+
+  public:
+    /// SETUP
+    static IP stringToIP(const std::string& ip, int port = -1, bool resolve = true);
+
+    static std::string ipToString(const IPaddress& ipaddr);
+    static std::string ipToString(int ip, int port = -1);
+
+    static void setDefaultPort(int defaultPort);
+    static int defaultPort(int defaultPort) { return IP::_defaultPort; };
+
+  private:
+    int           _host;           //!< The IP in int form.
+    int           _port;         //!< The Port number of the IP
+
+    static int    _defaultPort;  //!< Default Port
+};
+
+#endif /* __IP_H__ */
Index: trunk/src/lib/network/message_manager.cc
===================================================================
--- trunk/src/lib/network/message_manager.cc	(revision 9391)
+++ trunk/src/lib/network/message_manager.cc	(revision 9406)
@@ -20,6 +20,8 @@
 #include "network_stream.h"
 #include "shared_network_data.h"
-
-using namespace std;
+#include "converter.h"
+#include <cassert>
+
+
 
 MessageManager* MessageManager::singletonRef = NULL;
@@ -52,13 +54,13 @@
       }
     }
-    
+
     it->second.messages.clear();
     it->second.toAck.clear();
   }
-  
+
   messageQueue.clear();
-  
+
   this->messageHandlerMap.clear();
-  
+
   MessageManager::singletonRef = NULL;
 }
@@ -82,9 +84,9 @@
   int i = 0;
   int n;
-  
+
   n = Converter::intToByteArray( messageQueue[userId].toAck.size(), data + i, maxLength );
   i += n;
   assert( n == INTSIZE );
-  
+
   for ( std::list<int>::iterator it = messageQueue[userId].toAck.begin(); it != messageQueue[userId].toAck.end(); it++)
   {
@@ -93,11 +95,11 @@
     assert( n == INTSIZE );
   }
-  
+
   messageQueue[userId].toAck.clear();
-  
+
   n = Converter::intToByteArray( messageQueue[userId].messages.size(), data + i, maxLength );
   i += n;
   assert( n == INTSIZE );
-  
+
   for ( std::list<NetworkMessage>::iterator it = messageQueue[userId].messages.begin(); it != messageQueue[userId].messages.end(); it++ )
   {
@@ -105,18 +107,18 @@
     i += n;
     assert( n == INTSIZE );
-    
+
     n = Converter::intToByteArray( it->number, data + i, maxLength );
     i += n;
     assert( n == INTSIZE );
-    
+
     n = Converter::intToByteArray( it->messageId, data + i, maxLength );
     i += n;
     assert( n == INTSIZE );
-    
+
     assert( i + it->length <= maxLength );
     memcpy( data + i, it->data, it->length );
     i += it->length;
   }
-  
+
   return i;
 }
@@ -136,16 +138,16 @@
   int i = 0;
   int n;
-  
+
   int nAcks;
-  
+
   assert( i + INTSIZE <= length );
   n = Converter::byteArrayToInt( data + i, &nAcks );
   assert( n == INTSIZE );
   i += n;
-  
+
   std::list<int> acks;
-  
+
   int number;
-  
+
   for ( int j = 0; j < nAcks; j++ )
   {
@@ -154,10 +156,10 @@
     assert( n == INTSIZE );
     i += n;
-    
+
     acks.push_back( number );
   }
-  
+
   int nMessages;
-  
+
   assert( i + INTSIZE <= length );
   n = Converter::byteArrayToInt( data + i, &nMessages );
@@ -166,5 +168,5 @@
 
   int messageLength, messageId;
-  
+
   for ( int j = 0; j < nMessages; j++ )
   {
@@ -173,18 +175,18 @@
     assert( n == INTSIZE );
     i += n;
-    
+
     assert( i + INTSIZE <= length );
     n = Converter::byteArrayToInt( data + i, &number );
     assert( n == INTSIZE );
     i += n;
-  
+
     assert( i + INTSIZE <= length );
     n = Converter::byteArrayToInt( data + i, &messageId );
     assert( n == INTSIZE );
     i += n;
-    
+
     if ( number > 0 )
       messageQueue[userId].toAck.push_back( number );
-    
+
     assert( i + messageLength <= length );
     assert( messageHandlerMap.find( (MessageId)messageId ) != messageHandlerMap.end() );
@@ -194,5 +196,5 @@
       {
         NetworkMessage msg;
-        
+
         msg.data = new byte[messageLength];
         memcpy( msg.data, data + i, messageLength );
@@ -200,5 +202,5 @@
         msg.messageId = (MessageId)messageId;
         msg.number = userId;
-        
+
         incomingMessageBuffer.push_back( msg );
       }
@@ -207,6 +209,6 @@
     i += messageLength;
   }
-  
-  
+
+
   //TODO maybe handle incomingMessage in tick function. else local messages will not be handled if no clients are connected
   for ( std::list<NetworkMessage>::iterator it = incomingMessageBuffer.begin(); it != incomingMessageBuffer.end();  )
@@ -223,5 +225,5 @@
     it++;
   }
-  
+
   //walk throu message queue and remove acked messages
   for ( std::list<NetworkMessage>::iterator it = messageQueue[userId].messages.begin(); it != messageQueue[userId].messages.end();  )
@@ -236,5 +238,5 @@
     it++;
   }
-  
+
   //TODO find bether way. maybe with timestamp
   if ( messageQueue[userId].recievedMessages.size() > 1000 )
@@ -255,5 +257,5 @@
   if ( messageQueue.find( userId ) == messageQueue.end() )
     return;
-    
+
   for ( std::list<NetworkMessage>::iterator it = messageQueue[userId].messages.begin(); it != messageQueue[userId].messages.end(); it++ )
   {
@@ -262,7 +264,7 @@
     it->data = NULL;
   }
-  
+
   messageQueue[userId].toAck.clear();
-  
+
   messageQueue.erase( userId );
 }
@@ -270,5 +272,5 @@
 /**
  * registers function to handle messages with id messageId. someData is passed to callbackfuntion
- * @param messageId message id to handle 
+ * @param messageId message id to handle
  * @param cb function pointer to callback function
  * @param someData this pointer is passed to callback function without modification
@@ -278,11 +280,11 @@
 {
   MessageHandler messageHandler;
-  
+
   messageHandler.cb = cb;
   messageHandler.messageId = messageId;
   messageHandler.someData = someData;
-  
+
   messageHandlerMap[messageId] = messageHandler;
-  
+
   return true;
 }
@@ -309,6 +311,6 @@
  * @param data pointer to data
  * @param dataLength length of data
- * @param recieverType 
- * @param reciever 
+ * @param recieverType
+ * @param reciever
  */
 void MessageManager::sendMessage( MessageId messageId, byte * data, int dataLength, RecieverType recieverType, int reciever, MessagePriority messagePriority )
@@ -316,10 +318,10 @@
   for ( MessageQueue::iterator it = messageQueue.begin(); it != messageQueue.end(); it++ )
   {
-    if ( 
+    if (
          recieverType == RT_ALL_ME ||
          recieverType == RT_ALL_NOT_ME ||
          recieverType == RT_USER && it->first == reciever ||
          recieverType == RT_NOT_USER && it->first != reciever ||
-         recieverType == RT_SERVER && getNetworkStream()->isUserServer( it->first )
+         recieverType == RT_SERVER && getNetworkStream()->isUserMasterServer( it->first )
        )
     {
@@ -336,5 +338,5 @@
     }
   }
-  
+
   if ( recieverType == RT_ALL_ME )
   {
Index: trunk/src/lib/network/monitor/connection_monitor.cc
===================================================================
--- trunk/src/lib/network/monitor/connection_monitor.cc	(revision 9406)
+++ trunk/src/lib/network/monitor/connection_monitor.cc	(revision 9406)
@@ -0,0 +1,257 @@
+/*
+   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: Christoph Renner
+   co-programmer: ...
+*/
+
+#include "connection_monitor.h"
+#include "network_log.h"
+
+#include <debug.h>
+#include <SDL/SDL.h>
+#include <string.h>
+
+/* using namespace std is default, this needs to be here */
+
+
+/**
+ * constructor
+ * @param userId user's id
+ */
+ConnectionMonitor::ConnectionMonitor( int userId )
+{
+  /* set the class id for the base object and add ist to class list*/
+  this->setClassID(CL_CONNECTION_MONITOR, "ConnectionMonitor");
+  
+  this->userId = userId;
+  this->ping = 0;
+  this->incomingUnzippedBandWidth = 0;
+  this->outgoingUnzippedBandWidth = 0;
+  this->incomingZippedBandWidth = 0;
+  this->outgoingZippedBandWidth = 0;
+  this->nIncomingPackets = 0;
+  this->nOutgoingPackets = 0;
+  this->nZIncomingPackets = 0;
+  this->nZOutgoingPackets = 0;
+  
+  this->lastPacketTick = 0;
+  this->lastPrintTick = 0;
+}
+
+/**
+ * deconstructor
+ */
+ConnectionMonitor::~ConnectionMonitor( )
+{
+}
+
+/**
+ * process unzipped outgoing packet
+ * @param data pointer to packet data
+ * @param length length of packet
+ * @param stateId packet's state id
+ */
+void ConnectionMonitor::processUnzippedOutgoingPacket( int tick, byte * data, int length, int stateId )
+{
+  nOutgoingPackets++;
+  
+  // for ping calculation
+  sentStateTicks[stateId] = tick;
+  
+  // calculate bandwidth
+  outgoingUnzippedPacketHistory[tick] = length;
+  outgoingUnzippedBandWidth = calculateBandWidth( outgoingUnzippedPacketHistory, tick );
+  
+  //NETPRINTF(n)("UNZIPPED UPSTREAM: user: %d bandwidth %f\n", userId, outgoingUnzippedBandWidth );
+  
+  // count zero bytes
+  //int nZeroBytes = 0;
+  
+  //for ( int i = 0; i < length; i++ )
+  //  if ( data[i] == '\0' )
+  //    nZeroBytes++;
+  
+  //NETPRINTF(n)( "ZEROBYTES: %d (%f%%)\n", nZeroBytes, ((float)100)*nZeroBytes/length );
+}
+
+/**
+ * process unzipped incoming packet
+ * @param data pointer to packet data
+ * @param length length of packet
+ * @param stateId packet's state id
+ * @param ackedState state which was acked by this packet
+ */
+void ConnectionMonitor::processUnzippedIncomingPacket( int tick, byte * data, int length, int stateId, int ackedState )
+{
+  nIncomingPackets++;
+  
+  lastPacketTick = tick;
+  
+  // calculate ping
+  if ( sentStateTicks.find( ackedState ) != sentStateTicks.end() )
+  {
+    ackDelay.push_back( tick - sentStateTicks[ackedState] );
+  }
+  
+  while ( sentStateTicks.begin() != sentStateTicks.end() && sentStateTicks.begin()->first <= ackedState )
+    sentStateTicks.erase( sentStateTicks.begin() );
+      
+  while ( ackDelay.size() > N_PACKETS_FOR_PING )
+    ackDelay.erase( ackDelay.begin() );
+      
+  ping = 0;
+      
+  for ( std::list<int>::iterator it = ackDelay.begin(); it != ackDelay.end(); it++ )
+    ping += *it;
+      
+  if ( ackDelay.size() == 0 )
+    ping = -1;
+  else
+    ping /= ackDelay.size();
+      
+  //NETPRINTF(n)("PING: user: %d ping: %d\n", userId, ping );
+  
+  // calculate bandwidth
+  incomingUnzippedPacketHistory[tick] = length;
+  incomingUnzippedBandWidth = calculateBandWidth( incomingUnzippedPacketHistory, tick );
+  
+  //NETPRINTF(n)("UNZIPPED DOWNSTREAM: user: %d bandwidth %f\n", userId, incomingUnzippedBandWidth );
+  
+}
+
+/**
+ * remove old packets
+ * @param packetHistory 
+ * @param tick 
+ */
+void ConnectionMonitor::removeOldPackets( std::map< int, int > & packetHistory, int tick )
+{
+  while ( packetHistory.begin()->first < tick - MSECS_TO_CALC_BWIDTH )
+    packetHistory.erase( packetHistory.begin() );
+}
+
+/**
+ * calculate bandwidth out of packethistory
+ * @param packetHistory packet history
+ * @param tick current tick from SDL_GetTicks
+ * @return bandwidth in bytes/sec
+ */
+float ConnectionMonitor::calculateBandWidth( std::map< int, int > & packetHistory, int tick )
+{
+  removeOldPackets( packetHistory, tick );
+  
+  float res = 0.0f;
+#if 0
+  for ( std::map<int,int>::iterator it = packetHistory.begin(); it != packetHistory.end(); it++ )
+  {
+    if ( it != packetHistory.begin() )
+      res += it->second;
+  }
+  
+  if ( packetHistory.size() <= 1 || tick - packetHistory.begin()->first == 0 )
+    res = 0.0f;
+  else
+    res /= (float)(tick - packetHistory.begin()->first);
+  
+  res *= 1000.0f;
+#endif
+
+  for ( std::map<int,int>::iterator it = packetHistory.begin(); it != packetHistory.end(); it++ )
+  {
+    res += it->second;
+  }
+  
+  if ( packetHistory.size() <= 1 )
+    res = 0.0f;
+  else
+    res /= (float)(tick - packetHistory.begin()->first);
+  
+  res *= 1000.0f;
+
+  return res;
+}
+
+
+/**
+ * process zipped outgoing packet
+ * @param data pointer to packet data
+ * @param length length of packet
+ * @param stateId packet's state id
+ */
+void ConnectionMonitor::processZippedOutgoingPacket( int tick, byte * data, int length, int stateId )
+{
+  nZOutgoingPackets++;
+  
+  // calculate bandwidth
+  outgoingZippedPacketHistory[tick] = length;
+  outgoingZippedBandWidth = calculateBandWidth( outgoingZippedPacketHistory, tick );
+  
+  //NETPRINTF(n)("UPSTREAM: user: %d bandwidth %f nOutgoingPackets %d\n", userId, outgoingZippedBandWidth, nOutgoingPackets );
+
+  if ( lastPrintTick < tick-1000 )
+  {
+    printStatis();
+    lastPrintTick = tick;
+  }
+}
+
+
+/**
+ * process zipped incoming packet
+ * @param data pointer to packet data
+ * @param length length of packet
+ * @param stateId packet's state id
+ * @param ackedState state which was acked by this packet
+ */
+void ConnectionMonitor::processZippedIncomingPacket( int tick, byte * data, int length )
+{
+  nZIncomingPackets++;
+  
+  // calculate bandwidth
+  incomingZippedPacketHistory[tick] = length;
+  incomingZippedBandWidth = calculateBandWidth( incomingZippedPacketHistory, tick );
+  
+  //NETPRINTF(n)("DOWNSTREAM: user: %d bandwidth %f nIncomingPackets %d\n", userId, incomingZippedBandWidth, nIncomingPackets );
+  
+}
+
+
+/**
+ * check if client sent no packets for SECS_TO_TIMEOUT
+ * @return true if last packet recieved \< NOW() - SECS_TO_TIMEOUT
+ */
+bool ConnectionMonitor::hasTimedOut( )
+{
+  if ( lastPacketTick + SECS_TO_TIMEOUT*1000 < SDL_GetTicks() && nIncomingPackets > 0 )
+    return true;
+  
+  if ( nIncomingPackets == 0 && nOutgoingPackets >= NETWORK_FREQUENCY*SECS_TO_TIMEOUT )
+    return true;
+  
+  return false;
+}
+
+
+
+/**
+ * prints bandwith usage, ping and other important things to telnet-console
+ */
+void ConnectionMonitor::printStatis( )
+{
+  NETPRINT(n)("============NETWORKSTATS FOR USER %d============\n", userId);
+  NETPRINT(n)("PING = %d\n", ping );
+  NETPRINT(n)("BANDWIDTH: UP: %f (%f) DOWN %f (%f)\n", outgoingZippedBandWidth, outgoingUnzippedBandWidth, incomingZippedBandWidth, incomingUnzippedBandWidth);
+  NETPRINT(n)("PACKETS: RECIEVED %d; SENT %d\n", nIncomingPackets, nOutgoingPackets );
+  NETPRINT(n)("================================================\n");
+}
+
+
Index: trunk/src/lib/network/monitor/connection_monitor.h
===================================================================
--- trunk/src/lib/network/monitor/connection_monitor.h	(revision 9406)
+++ trunk/src/lib/network/monitor/connection_monitor.h	(revision 9406)
@@ -0,0 +1,71 @@
+/*!
+ * @file connection_monitor.h
+    \brief provides information about the quality of a connection.
+ */
+
+#ifndef _CONNECTION_MONITOR_H
+#define _CONNECTION_MONITOR_H
+
+#include "base_object.h"
+#include "netdefs.h"
+
+#include <map>
+#include <list>
+
+#define N_PACKETS_FOR_PING 20
+#define MSECS_TO_CALC_BWIDTH 1000
+#define SECS_TO_TIMEOUT 30
+
+class ConnectionMonitor : virtual public BaseObject
+{
+  public:
+    ConnectionMonitor( int userId );
+    virtual ~ConnectionMonitor();
+
+    void processUnzippedOutgoingPacket( int tick, byte * data, int length, int stateId );
+    void processUnzippedIncomingPacket( int tick, byte * data, int length, int stateId, int ackedState );
+
+    void processZippedOutgoingPacket( int tick, byte * data, int length, int stateId );
+    void processZippedIncomingPacket( int tick, byte * data, int length );
+
+    void calculatePing();
+
+    bool hasTimedOut();
+
+    void printStatis();
+
+  private:
+    float calculateBandWidth( std::map<int,int> & packetHistory, int tick );
+    void removeOldPackets( std::map<int,int> & packetHistory, int tick );
+
+    int userId;       //!< user's id
+
+    std::map<int,int>   sentStateTicks;
+
+    std::map<int,int>   incomingUnzippedPacketHistory;
+    std::map<int,int>   outgoingUnzippedPacketHistory;
+
+    std::map<int,int>   incomingZippedPacketHistory;
+    std::map<int,int>   outgoingZippedPacketHistory;
+
+    std::list<int>      ackDelay;
+    int                 ping;
+
+    float               incomingUnzippedBandWidth;
+    float               outgoingUnzippedBandWidth;
+
+    float               incomingZippedBandWidth;
+    float               outgoingZippedBandWidth;
+
+    int                 nIncomingPackets;
+    int                 nOutgoingPackets;
+
+    int                 nZIncomingPackets;
+    int                 nZOutgoingPackets;
+
+    int                 lastPacketTick;
+
+    int                 lastPrintTick;
+  };
+
+#endif
Index: trunk/src/lib/network/monitor/network_monitor.cc
===================================================================
--- trunk/src/lib/network/monitor/network_monitor.cc	(revision 9406)
+++ trunk/src/lib/network/monitor/network_monitor.cc	(revision 9406)
@@ -0,0 +1,272 @@
+/*
+   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: Patrick Boenzli
+*/
+
+#include "glgui.h"
+#include "shell_command.h"
+
+#include "network_stream.h"
+#include "debug.h"
+
+#include "proxy/network_settings.h"
+#include "shared_network_data.h"
+
+#include "network_monitor.h"
+#include "network_node.h"
+#include "peer_info.h"
+#include "network_stream.h"
+#include "netdefs.h"
+
+#include <vector>
+
+
+SHELL_COMMAND(showGUI, NetworkMonitor, showGUI);
+SHELL_COMMAND(hideGUI, NetworkMonitor, hideGUI);
+SHELL_COMMAND(debug, NetworkMonitor, debug);
+
+
+
+/**
+ * starts a network monitor
+ */
+NetworkMonitor::NetworkMonitor(NetworkStream* networkStream)
+  : Synchronizeable()
+{
+  this->setClassID(CL_NETWORK_MONITOR, "NetworkMonitor");
+
+  this->networkStream = networkStream;
+  this->playerNumber = 0;
+  // create the localnode, init it and add it to the nodes list
+  this->localNode = new NetworkNode( this->networkStream->getPeerInfo());
+  this->addNode(this->localNode);
+
+  this->setSynchronized(false);
+
+  // read in the proxy server list, this is only the case for the master server
+  if( SharedNetworkData::getInstance()->isMasterServer())
+  {
+    // assuming that the config files are already read we get the proxy servers
+    std::vector<IPaddress*>* proxyList = NetworkSettings::getInstance()->getProxyList();
+    std::vector<IPaddress*>::iterator it = proxyList->begin();
+    // create a peer info class and a network node class for each new proxy and add them to the passive list
+    for(; it < proxyList->end(); it++)
+    {
+      PeerInfo* peer = new PeerInfo();
+      peer->ip = *(*it);
+      peer->nodeType = NET_PROXY_SERVER_ACTIVE;
+      peer->userId = -1;
+
+      NetworkNode* node = new NetworkNode(peer);
+      this->addNode( node);
+      this->addActiveProxyServer( this->localNode, peer);
+    }
+  }
+}
+
+
+/**
+ * deconstructor
+ */
+NetworkMonitor::~NetworkMonitor()
+{
+  if( this->localNode)
+    delete this->localNode;
+}
+
+
+/**
+ * add the network node
+ * @param node to add
+ */
+void NetworkMonitor::addNetworkNode(NetworkNode* node)
+{
+  this->nodeList.push_back(node);
+}
+
+
+/**
+ * add the network node
+ * @param node to add
+ */
+void NetworkMonitor::removeNetworkNode(NetworkNode* node)
+{
+  std::list<NetworkNode*>::iterator it = this->nodeList.begin();
+  for(; it != this->nodeList.end(); it++)
+  {
+    if( *it == node)
+    {
+      if( node->getNodeType() == NET_CLIENT)
+        this->playerNumber--;
+
+      this->nodeList.erase(it);
+      return;
+    }
+  }
+}
+
+/**
+ * tihs adds the new network node
+ * @param ip ip of the new node
+ */
+void NetworkMonitor::addNode(IP ip, int nodeType)
+{
+  PeerInfo* pInfo = new PeerInfo();
+  pInfo->nodeType = nodeType;
+  pInfo->ip = ip;
+
+  this->addNode( pInfo);
+}
+
+
+/**
+ * adds a network node to the local node
+ *  @param pInfo node information
+ */
+void NetworkMonitor::addNode(PeerInfo* pInfo)
+{
+  if( this->localNode == NULL)
+    return;
+
+  if( pInfo->isClient())
+    this->localNode->addClient(pInfo);
+  else if( pInfo->isProxyServer())
+  {
+    this->localNode->addActiveProxyServer(pInfo);
+    // create a new node, since a proxy can connect clients again
+    NetworkNode* node = new NetworkNode(pInfo);
+    this->nodeList.push_back(node);
+  }
+  else if( pInfo->isMasterServer())
+  {
+    this->localNode->addMasterServer(pInfo);
+  }
+}
+
+
+/**
+ * adds a network node to the local node
+ *  @param node node to add to
+ *  @param pInfo node information
+ */
+void NetworkMonitor::addNode(NetworkNode* node, PeerInfo* pInfo)
+{
+  if( node == NULL)
+    return;
+
+  if( pInfo->isClient())
+    node->addClient(pInfo);
+  else if( pInfo->isProxyServer())
+    node->addActiveProxyServer(pInfo);
+  else if( pInfo->isMasterServer())
+    node->addMasterServer(pInfo);
+}
+
+
+/**
+ * @returns the proxy server of the first choice
+ */
+PeerInfo* NetworkMonitor::getFirstChoiceProxy()
+{
+  // return the fist proxy in the list
+  return this->localNode->getActiveProxyServer(0);
+}
+
+
+/**
+ * @returns the proxy server of second choice
+ */
+PeerInfo* NetworkMonitor::getSecondChoiceProxy()
+{
+  // return the second server in the list
+  return this->localNode->getActiveProxyServer(1);
+}
+
+
+/**
+ * this displays the network monitor gui
+ */
+void NetworkMonitor::showGUI()
+{
+  if (this->box == NULL)
+  {
+    this->box = new OrxGui::GLGuiBox(OrxGui::Vertical);
+    {
+      OrxGui::GLGuiBox* waterColorBox = new OrxGui::GLGuiBox(OrxGui::Horizontal);
+      {
+        OrxGui::GLGuiText* waterColorText = new OrxGui::GLGuiText();
+        waterColorText->setText("NetworkMonitor");
+        waterColorBox->pack(waterColorText);
+      }
+      this->box->pack(waterColorBox);
+    }
+
+    this->box->showAll();
+    this->box->setAbsCoor2D(300, 40);
+    OrxGui::GLGuiHandler::getInstance()->activate();
+//     OrxGui::GLGuiHandler::getInstance()->activateCursor();
+  }
+}
+
+
+/**
+ * hides the network monitor gui again
+ */
+void NetworkMonitor::hideGUI()
+{
+  if( this->box == NULL)
+    return;
+
+  OrxGui::GLGuiHandler::getInstance()->deactivate();
+//   OrxGui::GLGuiHandler::getInstance()->deactivateCursor();
+
+  delete this->box;
+  this->box = NULL;
+}
+
+
+/**
+ * processes the network monitor data
+ */
+void NetworkMonitor::process()
+{
+  this->playerNumber = 0;
+  std::list<NetworkNode*>::iterator it = this->nodeList.begin();
+  for(; it != this->nodeList.end(); it++)
+  {
+    this->playerNumber += (*it)->getPlayerNumber();
+  }
+
+  // check if a proxy server has to activated
+
+//   this->debug();
+}
+
+/**
+ * prints out the debug informations
+ */
+void NetworkMonitor::debug()
+{
+  PRINT(0)("================================= Network Monitor::debug() =====\n");
+  PRINT(0)(" I am: %s\n", this->localNode->getPeerInfo()->getNodeTypeString().c_str());
+  PRINT(0)(" Total count of network connections: %i\n", this->playerNumber);
+  PRINT(0)(" Max players on this server: %i\n", SharedNetworkData::getInstance()->getMaxPlayer());
+
+  std::list<NetworkNode*>::iterator it = this->nodeList.begin();
+  for(; it != this->nodeList.end(); it++)
+  {
+    (*it)->debug(0);
+  }
+
+  PRINT(0)("================================================================\n");
+}
+
Index: trunk/src/lib/network/monitor/network_monitor.h
===================================================================
--- trunk/src/lib/network/monitor/network_monitor.h	(revision 9406)
+++ trunk/src/lib/network/monitor/network_monitor.h	(revision 9406)
@@ -0,0 +1,95 @@
+/*!
+ * @file network_monitor.h
+ *  a class to monitor the network: throughput, network nodes
+ */
+
+#ifndef _NETWORK_MONITOR_H
+#define _NETWORK_MONITOR_H
+
+#include "base_object.h"
+#include "synchronizeable.h"
+#include "shared_network_data.h"
+#include "ip.h"
+
+#include "network_node.h"
+
+#include <list>
+
+class NetworkStream;
+class PeerInfo;
+
+
+namespace OrxGui { class GLGuiBox; };
+
+
+
+//!< a class that monitors the whole network. it tries to gather all informations its able to from the network
+class NetworkMonitor : public Synchronizeable
+{
+
+  public:
+    NetworkMonitor(NetworkStream* networkStream);
+    virtual ~NetworkMonitor();
+
+    /* client/masterserver/proxyserver addition/removal interface */
+    void addNetworkNode(NetworkNode* node);
+    void removeNetworkNode(NetworkNode* node);
+
+    void addNode(PeerInfo* pInfo);
+    void addNode(IP ip, int nodeType);
+    void addNode(NetworkNode* node) { this->nodeList.push_back(node); }
+    void addNode(NetworkNode* node, PeerInfo* pInfo);
+
+    /** adds to @param node a network node @param pInfo a new client */
+    inline void addClient(NetworkNode* node, PeerInfo* pInfo) { node->addClient(pInfo); }
+    /** adds to @param node a network node @param pInfo a new proxy server */
+    inline void addActiveProxyServer(NetworkNode* node, PeerInfo* pInfo) { node->addActiveProxyServer(pInfo); }
+    /** adds to @param node a network node @param pInfo a new proxy server */
+    inline void addPassiveProxyServer(NetworkNode* node, PeerInfo* pInfo) { node->addPassiveProxyServer(pInfo); }
+    /** adds to @param node a network node @param pInfo a new master server*/
+    inline void addMasterServer(NetworkNode* node, PeerInfo* pInfo) { node->addMasterServer(pInfo); }
+
+    inline void removeClient(NetworkNode* node, PeerInfo* pInfo) { node->removeClient(pInfo); }
+    inline void removeActiveProxyServer(NetworkNode* node, PeerInfo* pInfo) { node->removeActiveProxyServer(pInfo); }
+    inline void removePassiveProxyServer(NetworkNode* node, PeerInfo* pInfo) { node->removePassiveProxyServer(pInfo); }
+    inline void removeMasterServer(NetworkNode* node, PeerInfo* pInfo) { node->removeMasterServer(pInfo); }
+
+    PeerInfo* getFirstChoiceProxy();
+    PeerInfo* getSecondChoiceProxy();
+
+    /** @returns the active proxy server list of the localnode */
+    inline std::list<PeerInfo*> getActiveProxyServer() { return this->localNode->getActiveProxyServer(); }
+
+    /* slots admin and info interface */
+    /** @returns the total number of players in this game (including all proxy servers etc)*/
+    inline int getPlayerNumber() { return this->playerNumber; }
+
+    /** @returns true if there are still free network slots available at the local node*/
+    inline bool gotFreeSlots() { return (this->localNode->getPlayerNumber() < SharedNetworkData::getInstance()->getMaxPlayer())?true:false; }
+    /** @param node node to be checked for slots @returns true if there are still free network slots available at this node */
+    inline bool gotFreeSlots(NetworkNode* node) { return (node->getPlayerNumber() < SharedNetworkData::getInstance()->getMaxPlayer())?true:false; }
+
+    /** @returns true if the next client should be reconnected to some other proxy server with more connections */
+    inline bool isReconnectNextClient() { return (this->localNode->getPlayerNumber() >= SharedNetworkData::getInstance()->getMaxPlayer())?true:false; }
+
+
+    void showGUI();
+    void hideGUI();
+
+    void process();
+    void debug();
+
+
+  private:
+    NetworkStream*               networkStream;              //!< reference to the one networkstream of the network
+    NetworkNode*                 localNode;                  //!< reference to the local node
+    std::list<NetworkNode*>      nodeList;                   //!< list of all network nodes
+
+    OrxGui::GLGuiBox*            box;
+
+    int                          playerNumber;                 //!< total number of players in the game
+    int                          connectionNumber;             //!< total number of connections at this localhost
+};
+
+
+#endif
Index: trunk/src/lib/network/monitor/network_node.cc
===================================================================
--- trunk/src/lib/network/monitor/network_node.cc	(revision 9406)
+++ trunk/src/lib/network/monitor/network_node.cc	(revision 9406)
@@ -0,0 +1,270 @@
+/*
+   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: Patrick Boenzli
+*/
+
+
+#include "network_node.h"
+
+#include "debug.h"
+
+
+/**
+ * constructor
+ */
+NetworkNode::NetworkNode(PeerInfo* pInfo)
+{
+  this->playerNumber = 0;
+  this->peerInfo = pInfo;
+}
+
+
+/**
+ * deconstructor
+ */
+NetworkNode::~NetworkNode()
+{}
+
+
+/**
+ * adds a client
+ */
+void NetworkNode::addClient(PeerInfo* node)
+{
+  this->clientList.push_back(node);
+  this->playerNumber++;
+  this->connectionNumber++;
+}
+
+/**
+ * adds a proxy server
+ */
+void NetworkNode::addActiveProxyServer(PeerInfo* node)
+{
+  this->activeProxyServerList.push_back(node);
+  this->connectionNumber++;
+}
+
+/**
+ * adds a proxy server
+ */
+void NetworkNode::addPassiveProxyServer(PeerInfo* node)
+{
+  this->passiveProxyServerList.push_back(node);
+}
+
+/**
+ * adds a master server
+ */
+void NetworkNode::addMasterServer(PeerInfo* node)
+{
+  this->masterServerList.push_back(node);
+  this->playerNumber++;
+}
+
+/**
+ * removes a client
+ */
+void NetworkNode::removeClient(PeerInfo* node)
+{
+  std::list<PeerInfo*>::iterator it = this->clientList.begin();
+  for(; it != this->clientList.end(); it++)
+  {
+    if( *it == node)
+    {
+      this->clientList.erase(it);
+      this->playerNumber--;
+      return;
+    }
+  }
+
+  PRINTF(2)("Could not remove client from the list, very strange...");
+}
+
+/**
+ * removes a proxy server
+ */
+void NetworkNode::removeActiveProxyServer(PeerInfo* node)
+{
+  std::list<PeerInfo*>::iterator it = this->activeProxyServerList.begin();
+  for(; it != this->activeProxyServerList.end(); it++)
+  {
+    if( *it == node)
+    {
+      this->activeProxyServerList.erase(it);
+      this->playerNumber--;
+      return;
+    }
+  }
+
+  PRINTF(2)("Could not remove proxy server from the list, very strange...");
+}
+
+/**
+ * removes a proxy server
+ */
+void NetworkNode::removePassiveProxyServer(PeerInfo* node)
+{
+  std::list<PeerInfo*>::iterator it = this->passiveProxyServerList.begin();
+  for(; it != this->passiveProxyServerList.end(); it++)
+  {
+    if( *it == node)
+    {
+      this->passiveProxyServerList.erase(it);
+      return;
+    }
+  }
+
+  PRINTF(2)("Could not remove proxy server from the list, very strange...");
+}
+
+/**
+ * removes a master server
+ */
+void NetworkNode::removeMasterServer(PeerInfo* node)
+{
+  std::list<PeerInfo*>::iterator it = this->masterServerList.begin();
+  for(; it != this->masterServerList.end(); it++)
+  {
+    if( *it == node)
+    {
+      this->masterServerList.erase(it);
+      this->playerNumber--;
+      return;
+    }
+  }
+
+  PRINTF(2)("Could not remove client from the list, very strange...");
+}
+
+
+/**
+ * @param index index to the client
+ * @return the client in the list or NULL if none
+ */
+PeerInfo* NetworkNode::getClient(int index)
+{
+  if( this->clientList.size() < index)
+    return NULL;
+
+  std::list<PeerInfo*>::iterator it = this->clientList.begin();
+  for(int i = 0; it != this->clientList.end(); it++, i++)
+  {
+  if( i == index)
+    return (*it);
+  }
+
+  return NULL;
+}
+
+
+/**
+ * @param index index to the client
+ * @return the active proxy server in the list or NULL if none
+ */
+PeerInfo* NetworkNode::getActiveProxyServer(int index)
+{
+  if( this->activeProxyServerList.size() < index)
+    return NULL;
+
+  std::list<PeerInfo*>::iterator it = this->activeProxyServerList.begin();
+  for(int i = 0; it != this->activeProxyServerList.end(); it++, i++)
+  {
+    if( i == index)
+      return (*it);
+  }
+
+  return NULL;
+}
+
+
+/**
+ * @param index index to the client
+ * @return the passive proxy server in the list or NULL if none
+ */
+PeerInfo* NetworkNode::getPassiveProxyServer(int index)
+{
+  if( this->passiveProxyServerList.size() < index)
+    return NULL;
+
+  std::list<PeerInfo*>::iterator it = this->passiveProxyServerList.begin();
+  for(int i = 0; it != this->passiveProxyServerList.end(); it++, i++)
+  {
+    if( i == index)
+      return (*it);
+  }
+
+  return NULL;
+}
+
+
+/**
+ * @param index index to the client
+ * @return the master server in the list or NULL if none
+ */
+PeerInfo* NetworkNode::getMasterServer(int index)
+{
+  if( this->masterServerList.size() < index)
+    return NULL;
+
+  std::list<PeerInfo*>::iterator it = this->masterServerList.begin();
+  for(int i = 0; it != this->masterServerList.end(); it++, i++)
+  {
+    if( i == index)
+      return (*it);
+  }
+
+  return NULL;
+}
+
+
+/**
+ * debug function
+ * @param depth: depth in the tree
+ */
+void NetworkNode::debug(int depth)
+{
+  PRINT(0)(" = %s\n", this->peerInfo->getNodeTypeString().c_str());
+
+  PRINT(0)("    master servers: %i\n", this->masterServerList.size());
+  std::list<PeerInfo*>::iterator it = this->masterServerList.begin();
+  for(; it != this->masterServerList.end(); it++)
+  {
+    IP* ip = &(*it)->ip;
+    PRINT(0)("     - ms, id: %i (%s)\n", (*it)->userId, ip->ipString().c_str());
+  }
+
+  PRINT(0)("    proxy servers active: %i\n", this->activeProxyServerList.size());
+  it = this->activeProxyServerList.begin();
+  for(; it != this->activeProxyServerList.end(); it++)
+  {
+    IP* ip = &(*it)->ip;
+    PRINT(0)("     - ps-a, id: %i (%s)\n", (*it)->userId, ip->ipString().c_str());
+  }
+
+  PRINT(0)("    proxy servers passive: %i\n", this->passiveProxyServerList.size());
+  it = this->passiveProxyServerList.begin();
+  for(; it != this->passiveProxyServerList.end(); it++)
+  {
+    IP* ip = &(*it)->ip;
+    PRINT(0)("     - ps-p, id: %i (%s)\n", (*it)->userId, ip->ipString().c_str());
+  }
+
+  PRINT(0)("    clients: %i\n", this->clientList.size());
+  it = this->clientList.begin();
+  for(; it != this->clientList.end(); it++)
+  {
+    IP* ip = &(*it)->ip;
+    PRINT(0)("     - client, id: %i (%s)\n", (*it)->userId, ip->ipString().c_str());
+  }
+}
+
Index: trunk/src/lib/network/monitor/network_node.h
===================================================================
--- trunk/src/lib/network/monitor/network_node.h	(revision 9406)
+++ trunk/src/lib/network/monitor/network_node.h	(revision 9406)
@@ -0,0 +1,72 @@
+/*!
+ * @file network_node.h
+ *  a class representing a node in the network (this can be a MASTER_SERVER, PROXY_SERVER or a CLIENT
+ */
+
+#ifndef _NETWORK_NODE_H
+#define _NETWORK_NODE_H
+
+#include "base_object.h"
+#include "synchronizeable.h"
+#include "peer_info.h"
+
+#include <list>
+
+
+//!< a class representing a node in the network (this can be a MASTER_SERVER, PROXY_SERVER or a CLIENT
+class NetworkNode
+{
+  public:
+    NetworkNode(PeerInfo* pInfo);
+    ~NetworkNode();
+
+
+    void addClient(PeerInfo* node);
+    void addActiveProxyServer(PeerInfo* node);
+    void addPassiveProxyServer(PeerInfo* node);
+    void addMasterServer(PeerInfo* node);
+
+    void removeClient(PeerInfo* node);
+    void removeActiveProxyServer(PeerInfo* node);
+    void removePassiveProxyServer(PeerInfo* node);
+    void removeMasterServer(PeerInfo* node);
+
+    PeerInfo* getClient(int index);
+    PeerInfo* getActiveProxyServer(int index);
+    PeerInfo* getPassiveProxyServer(int index);
+    PeerInfo* getMasterServer(int index);
+
+    /** @returns the master server list */
+    inline std::list<PeerInfo*> getMasterServer() { return this->masterServerList; }
+    /** @returns the active proxy server list */
+    inline std::list<PeerInfo*> getActiveProxyServer() { return this->activeProxyServerList; }
+    /** @returns the passive proxy server list */
+    inline std::list<PeerInfo*> getPassiveProxyServer() { return this->passiveProxyServerList; }
+    /** @returns the client list */
+    inline std::list<PeerInfo*> getClient() { return this->clientList; }
+
+
+    /** @returns the number of players */
+    inline int getPlayerNumber() { return this->playerNumber; }
+    /** @returns the node type of this node */
+    inline int getNodeType() { return this->peerInfo->nodeType; }
+    /** @returns the peer info of this node */
+    inline PeerInfo* getPeerInfo() { return this->peerInfo; }
+
+    void debug(int depth);
+
+
+  private:
+    int                          playerNumber;                 //!< localy direct connected player number
+    int                          connectionNumber;             //!< number of connections ( can but musn't be equal players)
+    PeerInfo*                    peerInfo;                     //!< the peer informationa about this node
+
+    /* network nodes directly connected to this node */
+    std::list<PeerInfo*>         clientList;                   //!< list of all clients in the network
+    std::list<PeerInfo*>         activeProxyServerList;        //!< list of all proxy servers in the network
+    std::list<PeerInfo*>         passiveProxyServerList;       //!< list of all proxy servers in the network
+    std::list<PeerInfo*>         masterServerList;             //!< list of all master servers in the network (should be 1!! :D)
+
+};
+
+#endif /* _NETWORK_NODE_H */
Index: trunk/src/lib/network/netdefs.h
===================================================================
--- trunk/src/lib/network/netdefs.h	(revision 9391)
+++ trunk/src/lib/network/netdefs.h	(revision 9406)
@@ -1,32 +1,55 @@
+/*
+   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: Christoph Renner rennerc@ee.ethz.ch
+   co-programmer:   Patrick Boenzli  boenzlip@orxonox.ethz.ch
+
+     June 2006: finishing work on the network stream for pps presentation (rennerc@ee.ethz.ch)
+     July 2006: some code rearangement and integration of the proxy server mechanism (boenzlip@ee.ethz.ch)
+*/
 
 /*!
  * @file network_manager.h
  *  Main interface for the network module. Manages all the modules
-
  */
 
-#ifndef _NETDEFS
-#define _NETDEFS
+#ifndef _NETDEFS_H
+#define _NETDEFS_H
 
-#ifdef HAVE_SDL_NET_H
-  #include <SDL_net.h>
-#else
-  #include <SDL/SDL_net.h>
-#endif
+#include "nettypes.h"
+#include "netincl.h"
 
 
-#define MAX_CONNECTIONS 1000
 
+//!< the amount of slots used before a proxy server is activated
+#define NET_CONNECTION_SATURATION 0.75
+
+//!< network polling frequency
 #define NETWORK_FREQUENCY 66
 
 
-typedef unsigned char byte;
+//!< orxonox protocol id
+#define _ORXONOX_ID        0xF91337A0
+//!< orxonox network version identifier
+#define _ORXONOX_VERSION   1
 
 
 //!< enum indicating the type of the node
 typedef enum {
-  NET_SERVER,
-  NET_CLIENT
+  NET_MASTER_SERVER,
+  NET_PROXY_SERVER_ACTIVE,
+  NET_PROXY_SERVER_PASSIVE,
+  NET_CLIENT,
+
+  NET_NR_TYPES
+
 } NodeType;
 
@@ -44,3 +67,3 @@
 } UidType;
 
-#endif /* _NETWORK_MANAGER */
+#endif /* _NETDEFS_H */
Index: trunk/src/lib/network/netincl.h
===================================================================
--- trunk/src/lib/network/netincl.h	(revision 9406)
+++ trunk/src/lib/network/netincl.h	(revision 9406)
@@ -0,0 +1,12 @@
+
+#ifndef _NETINCL_H
+#define _NETINCL_H
+
+#ifdef HAVE_SDL_NET_H
+#include <SDL_net.h>
+#else
+#include <SDL/SDL_net.h>
+#endif
+
+
+#endif /* _NETINCL_H */
Index: trunk/src/lib/network/nettypes.h
===================================================================
--- trunk/src/lib/network/nettypes.h	(revision 9406)
+++ trunk/src/lib/network/nettypes.h	(revision 9406)
@@ -0,0 +1,7 @@
+
+#ifndef __NET_TYPES_H_
+#define __NET_TYPES_H_
+
+typedef unsigned char byte;
+
+#endif /* __NET_TYPES_H */
Index: trunk/src/lib/network/network_game_manager.cc
===================================================================
--- trunk/src/lib/network/network_game_manager.cc	(revision 9391)
+++ trunk/src/lib/network/network_game_manager.cc	(revision 9406)
@@ -10,12 +10,13 @@
 
 ### File Specific:
-   main-programmer: Benjamin Wuest
-   co-programmer: ...
+   main-programmer: Christoph Renner rennerc@ee.ethz.ch
+   co-programmer:   Patrick Boenzli  boenzlip@orxonox.ethz.ch
+
+     June 2006: finishing work on the network stream for pps presentation (rennerc@ee.ethz.ch)
+     July 2006: some code rearangement and integration of the proxy server mechanism (boenzlip@ee.ethz.ch)
 */
 
 
-/* this is for debug output. It just says, that all calls to PRINT() belong to the DEBUG_MODULE_NETWORK module
-   For more information refere to https://www.orxonox.net/cgi-bin/trac.cgi/wiki/DebugOutput
-*/
+
 #define DEBUG_MODULE_NETWORK
 
@@ -45,6 +46,5 @@
 
 
-/* using namespace std is default, this needs to be here */
-using namespace std;
+
 
 NetworkGameManager* NetworkGameManager::singletonRef = NULL;
@@ -62,9 +62,9 @@
 
   this->setSynchronized(true);
-  
+
   MessageManager::getInstance()->registerMessageHandler( MSGID_DELETESYNCHRONIZEABLE, delSynchronizeableHandler, NULL );
   MessageManager::getInstance()->registerMessageHandler( MSGID_PREFEREDTEAM, preferedTeamHandler, NULL );
   MessageManager::getInstance()->registerMessageHandler( MSGID_CHATMESSAGE, chatMessageHandler, NULL );
-  
+
   this->gameState = 0;
   registerVar( new SynchronizeableInt( &gameState, &gameState, "gameState" ) );
@@ -77,7 +77,7 @@
 {
   delete MessageManager::getInstance();
-  
+
   PlayerStats::deleteAllPlayerStats();
-  
+
   NetworkGameManager::singletonRef = NULL;
 }
@@ -86,15 +86,15 @@
 /**
  * insert new player into game
- * @param userId 
- * @return 
+ * @param userId
+ * @return
  */
 bool NetworkGameManager::signalNewPlayer( int userId )
 {
-  assert( SharedNetworkData::getInstance()->isGameServer() );
+  assert( SharedNetworkData::getInstance()->isMasterServer() ||  SharedNetworkData::getInstance()->isProxyServer());
   assert( State::getGameRules() );
   assert( State::getGameRules()->isA( CL_NETWORK_GAME_RULES ) );
-  
+
   NetworkGameRules & rules = *(dynamic_cast<NetworkGameRules*>(State::getGameRules()));
-  
+
   int team = rules.getTeamForNewUser();
   ClassID playableClassId = rules.getPlayableClassId( userId, team );
@@ -102,36 +102,36 @@
   std::string playableTexture = rules.getPlayableModelFileName( userId, team, playableClassId );
   float       playableScale = rules.getPlayableScale( userId, team, playableClassId );
-  
+
   BaseObject * bo = Factory::fabricate( playableClassId );
-  
+
   assert( bo != NULL );
   assert( bo->isA( CL_PLAYABLE ) );
-  
+
   Playable & playable = *(dynamic_cast<Playable*>(bo));
-  
+
   playable.loadMD2Texture( playableTexture );
-  
+
   playable.loadModel( playableModel, 100.0f );
   playable.setOwner( userId );
   playable.setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() );
   playable.setSynchronized( true );
-  
+
   PlayerStats * stats = rules.getNewPlayerStats( userId );
-  
+
   stats->setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() );
   stats->setSynchronized( true );
   stats->setOwner( SharedNetworkData::getInstance()->getHostID() );
-  
+
   stats->setTeamId( team );
   stats->setPlayableClassId( playableClassId );
   stats->setPlayableUniqueId( playable.getUniqueID() );
   stats->setModelFileName( playableModel );
-  
+
   if ( userId == 0 )
     stats->setNickName( Preferences::getInstance()->getString( "multiplayer", "nickname", "Server" ) );
-  
+
   if ( rules.isA( CL_MULTIPLAYER_TEAM_DEATHMATCH ) )
     dynamic_cast<MultiplayerTeamDeathmatch*>(&rules)->respawnPlayable( &playable, team, 0.0f );
-  
+
   return true;
 }
@@ -140,6 +140,6 @@
 /**
  * remove player from game
- * @param userID 
- * @return 
+ * @param userID
+ * @return
  */
 bool NetworkGameManager::signalLeftPlayer(int userID)
@@ -151,5 +151,5 @@
     delete PlayerStats::getStats( userID );
   }
-  
+
   return true;
 }
@@ -159,22 +159,22 @@
 /**
  * handler for remove synchronizeable messages
- * @param messageId 
- * @param data 
- * @param dataLength 
- * @param someData 
- * @param userId 
+ * @param messageId
+ * @param data
+ * @param dataLength
+ * @param someData
+ * @param userId
  * @return true on successfull handling else handler will be called again
  */
 bool NetworkGameManager::delSynchronizeableHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId )
 {
-  if ( getInstance()->isServer() )
+  if ( SharedNetworkData::getInstance()->isMasterServer() ||  SharedNetworkData::getInstance()->isProxyServer())
   {
     PRINTF(2)("Recieved DeleteSynchronizeable message from client %d!\n", userId);
     return true;
   }
-  
+
   int uniqueId = 0;
   int len = Converter::byteArrayToInt( data, &uniqueId );
-  
+
   if ( len != dataLength )
   {
@@ -182,7 +182,7 @@
     return true;
   }
-  
+
   const std::list<BaseObject*> * list = ClassList::getList( CL_SYNCHRONIZEABLE );
-  
+
   for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
   {
@@ -194,10 +194,10 @@
         return true;
       }
-      
+
       delete dynamic_cast<Synchronizeable*>(*it);
       return true;
     }
   }
-  
+
   return true;
 }
@@ -210,5 +210,5 @@
 {
   byte buf[INTSIZE];
-  
+
   assert( Converter::intToByteArray( uniqueId, buf, INTSIZE ) == INTSIZE );
 
@@ -220,18 +220,18 @@
 /**
  * handler for MSGID_PREFEREDTEAM message
- * @param messageId 
- * @param data 
- * @param dataLength 
- * @param someData 
- * @param userId 
- * @return 
+ * @param messageId
+ * @param data
+ * @param dataLength
+ * @param someData
+ * @param userId
+ * @return
  */
 bool NetworkGameManager::preferedTeamHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId )
 {
-  assert( NetworkGameManager::getInstance()->isServer() );
-  
+  assert( SharedNetworkData::getInstance()->isMasterServer() ||  SharedNetworkData::getInstance()->isProxyServer());
+
   int teamId = 0;
   int len = Converter::byteArrayToInt( data, &teamId );
-  
+
   if ( len != dataLength )
   {
@@ -239,7 +239,7 @@
     return true;
   }
-  
+
   NetworkGameManager::getInstance()->setPreferedTeam( userId, teamId );
-  
+
   return true;
 }
@@ -249,7 +249,7 @@
   if ( !PlayerStats::getStats( userId ) )
     return;
-  
+
   PlayerStats & stats = *(PlayerStats::getStats( userId ));
-  
+
   stats.setPreferedTeamId( teamId );
 }
@@ -257,16 +257,16 @@
 /**
  * set prefered team for this host
- * @param teamId 
+ * @param teamId
  */
 void NetworkGameManager::prefereTeam( int teamId )
 {
-  if ( isServer() )
+  if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
     setPreferedTeam( SharedNetworkData::getInstance()->getHostID(), teamId );
   else
   {
     byte buf[INTSIZE];
-    
+
     assert( Converter::intToByteArray( teamId, buf, INTSIZE) == INTSIZE );
-    
+
     MessageManager::getInstance()->sendMessage( MSGID_PREFEREDTEAM, buf, INTSIZE, RT_USER, 0, MP_HIGHBANDWIDTH );
   }
@@ -285,8 +285,8 @@
     {
       const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
-       
+
       if ( list && std::find( list->begin(), list->end(), *it ) != list->end() )
-      {      
-        PRINTF(0)("Delete unused playable: %s owner: %d\n", (*it)->getClassName(), (*it)->getOwner() );
+      {
+        PRINTF(0)("Delete unused playable: %s owner: %d\n", (*it)->getClassCName(), (*it)->getOwner() );
         std::list<Playable*>::iterator delit = it;
         it++;
@@ -305,21 +305,21 @@
 {
   PRINTF(0)("NetworkGameManager::chatMessageHandler %d %d\n", userId, SharedNetworkData::getInstance()->getHostID() );
-  if ( NetworkGameManager::getInstance()->isServer() && userId !=  SharedNetworkData::getInstance()->getHostID() )
+  if ( (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer()) && userId !=  SharedNetworkData::getInstance()->getHostID() )
   {
     MessageManager::getInstance()->sendMessage( messageId, data, dataLength, RT_ALL_NOT_ME, 0, MP_HIGHBANDWIDTH );
   }
-  
+
   assert( State::getGameRules() );
   assert( State::getGameRules()->isA( CL_NETWORK_GAME_RULES ) );
-  
+
   NetworkGameRules & rules = *(dynamic_cast<NetworkGameRules*>(State::getGameRules()));
-  
+
   if ( dataLength < 3*INTSIZE )
   {
     PRINTF(2)("got too small chatmessage from client %d\n", userId);
-    
+
     return true;
   }
-  
+
   int messageType = 0;
   Converter::byteArrayToInt( data, &messageType );
@@ -328,5 +328,5 @@
   std::string message;
   Converter::byteArrayToString( data+2*INTSIZE, message, dataLength-2*INTSIZE );
-  
+
   rules.handleChatMessage( senderUserId, message, messageType );
 
@@ -346,11 +346,11 @@
   assert( Converter::intToByteArray( SharedNetworkData::getInstance()->getHostID(), buf+INTSIZE, INTSIZE ) == INTSIZE );
   assert( Converter::stringToByteArray(message, buf+2*INTSIZE, message.length()+INTSIZE) == message.length()+INTSIZE );
-  
-  if ( this->isServer() )
+
+  if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
     MessageManager::getInstance()->sendMessage( MSGID_CHATMESSAGE, buf, message.length()+3*INTSIZE, RT_ALL_ME, 0, MP_HIGHBANDWIDTH );
   else
     MessageManager::getInstance()->sendMessage( MSGID_CHATMESSAGE, buf, message.length()+3*INTSIZE, RT_ALL_NOT_ME, 0, MP_HIGHBANDWIDTH );
 
-  
+
   delete [] buf;
 }
Index: trunk/src/lib/network/network_game_manager.h
===================================================================
--- trunk/src/lib/network/network_game_manager.h	(revision 9391)
+++ trunk/src/lib/network/network_game_manager.h	(revision 9406)
@@ -28,6 +28,4 @@
   NET_YOU_ARE_ENTITY,
   NET_REQUEST_ENTITY_LIST,
-  NET_REQUEST_PNODE_PATH,
-  NET_SEND_PNODE_PATH,
 
   NET_NUMBER
@@ -42,11 +40,12 @@
 
 /*!
- * a class that can create and remove entities
+ * a class that can create and remove entities over the network
  */
 class NetworkGameManager: public Synchronizeable
 {
+
   public:
     virtual ~NetworkGameManager();
-    
+
     static NetworkGameManager* NetworkGameManager::getInstance()
     { if (!NetworkGameManager::singletonRef) NetworkGameManager::singletonRef = new NetworkGameManager(); return NetworkGameManager::singletonRef; }
@@ -55,29 +54,32 @@
     bool signalNewPlayer( int userId );
     bool signalLeftPlayer( int userID );
-    
-    void removeSynchronizeable( int uniqueId );
-    
+
     void prefereTeam( int teamId );
+
 
     inline void setGameState( int gameState ){ this->gameState = gameState; }
     inline int getGameState(){ return this->gameState; }
-    
+
     void tick( float ds );
-    
+
+    void removeSynchronizeable( int uniqueId );
     void sendChatMessage( const std::string & message, int messageType );
+
 
   private:
     NetworkGameManager();
-    
+
     static bool delSynchronizeableHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId );
     static bool preferedTeamHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId );
     static bool chatMessageHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId );
-    
+
     void setPreferedTeam( int userId, int teamId );
 
+
+  private:
     static NetworkGameManager*    singletonRef;
-    
+
     int                           gameState;
-    
+
     std::list<Playable*>          playablesToDelete;
 };
Index: trunk/src/lib/network/network_manager.cc
===================================================================
--- trunk/src/lib/network/network_manager.cc	(revision 9391)
+++ trunk/src/lib/network/network_manager.cc	(revision 9406)
@@ -10,6 +10,6 @@
 
    ### File Specific:
-   main-programmer: Patrick Boenzli
-   co-programmer: ...
+   main-programmer: Patrick Boenzli (patrick@orxonox.ethz.ch)
+   co-programmer: Christoph Renner (rennerc@ee.ethz.ch)
 */
 
@@ -34,5 +34,5 @@
 
 /* using namespace std is default, this needs to be here */
-using namespace std;
+
 
 SHELL_COMMAND(debug, NetworkManager, debug);
@@ -53,8 +53,8 @@
   this->networkStream = NULL;
   this->elapsedTime = 0.0f;
-  
-    
+
+
   int port = Preferences::getInstance()->getInt( "network", "telnetport", 0 );
-  
+
   if ( port > 0 )
     NetworkLog::getInstance()->listen( port );
@@ -75,5 +75,5 @@
     this->networkStream = NULL;
   }
-  
+
   NetworkManager::singletonRef = NULL;
 }
@@ -95,4 +95,54 @@
 {
 
+}
+
+
+
+/**
+ *  creates a new NetworkStream of server type
+ * @param port: number of the TCP port
+ */
+int NetworkManager::createMasterServer(unsigned int port)
+{
+  // load the network settings
+  NetworkSettings::getInstance()->loadData();
+
+  // create the network stream
+  this->networkStream = new NetworkStream(NET_MASTER_SERVER);
+  this->networkStream->createServer( port);
+
+  // start the network game manager
+  this->networkStream->createNetworkGameManager();
+
+  PRINTF(0)("Created Network Master Server\n");
+  SDL_Delay(20);
+  return 1;
+}
+
+/**
+ *  creates a new network stream of proxy server type
+ * @param port: number of the TCP port
+ */
+int NetworkManager::createProxyServer(unsigned int port)
+{
+  // load the network settings
+  NetworkSettings::getInstance()->loadData();
+
+  // create the network stream
+  this->networkStream = new NetworkStream(NET_PROXY_SERVER_ACTIVE);
+  this->networkStream->createServer( port);
+  // and connect to the master server for synchronization
+//   this->networkStream->connectToMasterServer(NetworkSettings::getInstance()->getMasterAddr());
+  // and to the other proxy servers
+
+
+
+  // start the network game manager
+  this->networkStream->createNetworkGameManager();
+
+
+  PRINTF(0)("Created Network Proxy Server\n");
+  SDL_Delay(20);
+  return 1;
 }
 
@@ -102,9 +152,18 @@
  * @param hostName: the name of the destination host
  */
-int NetworkManager::establishConnection(const std::string & name, unsigned int port)
-{
-  this->networkStream = new NetworkStream( name, port );
-  SharedNetworkData::getInstance()->setDefaultSyncStream(this->networkStream);
+int NetworkManager::createClient(const std::string & name, unsigned int port)
+{
+  // load the network settings
+  NetworkSettings::getInstance()->loadData();
+
+  // create the network stream
+  this->networkStream = new NetworkStream(NET_CLIENT);
+  // connect to the master server, if a redirection should occure, this is handled in the NetworkStream itself
+  this->networkStream->connectToMasterServer( name, port);
+
+  // and start the handshake
   this->networkStream->startHandshake();
+
+  PRINTF(0)("Created Network Client");
   return 1;
 }
@@ -112,20 +171,7 @@
 
 /**
- *  creates a new NetworkStream of server type
- * @param port: number of the TCP port
- */
-int NetworkManager::createServer(unsigned int port)
-{
-  SharedNetworkData::getInstance()->setHostID(0);
-  SharedNetworkData::getInstance()->setGameServer(true);
-  this->networkStream = new NetworkStream(port);
-  SharedNetworkData::getInstance()->setDefaultSyncStream(this->networkStream);
-  this->networkStream->createNetworkGameManager();
-  PRINTF(0)("CREATE SERVER\n");
-  SDL_Delay(20);
-  return 1;
-}
-
-
+ * connects a synchronizeable to the network stream
+ * @param sync: synchronizeable to connect
+ */
 void NetworkManager::connectSynchronizeable(Synchronizeable& sync)
 {
@@ -144,9 +190,10 @@
   if( likely(this->elapsedTime < 1.0f / NETWORK_FREQUENCY))
     return;
+
   this->elapsedTime = 0.0f;
 
-  if ( networkStream )
+  if ( this->networkStream )
     networkStream->processData();
-  
+
   NetworkGameManager::getInstance()->tick( this->elapsedTime );
 }
Index: trunk/src/lib/network/network_manager.h
===================================================================
--- trunk/src/lib/network/network_manager.h	(revision 9391)
+++ trunk/src/lib/network/network_manager.h	(revision 9406)
@@ -36,11 +36,7 @@
     void shutdown();
 
-    int establishConnection( const std::string & name, unsigned int port);
-    int createServer(unsigned int port);
-
-    /** Returns the hostID @return The hostID of the object */
-    inline int getHostID() { return SharedNetworkData::getInstance()->getHostID(); }
-    inline bool isGameServer() { return SharedNetworkData::getInstance()->isGameServer(); }
-
+    int createClient( const std::string & name, unsigned int port);
+    int createMasterServer( unsigned int port);
+    int createProxyServer( unsigned int port);
 
     void connectSynchronizeable(Synchronizeable& sync);
@@ -56,5 +52,5 @@
   private:
     static NetworkManager*           singletonRef;            //!< Pointer to the only instance of this Class
-    NetworkStream*                   networkStream;       //!< pointer to network stream
+    NetworkStream*                   networkStream;           //!< pointer to network stream
 
     float                            elapsedTime;             //!< elapsed time since the last network update
Index: trunk/src/lib/network/network_protocol.cc
===================================================================
--- trunk/src/lib/network/network_protocol.cc	(revision 9391)
+++ trunk/src/lib/network/network_protocol.cc	(revision 9406)
@@ -33,5 +33,5 @@
 
 /* using namespace std is default, this needs to be here */
-using namespace std;
+
 
 
Index: trunk/src/lib/network/network_socket.cc
===================================================================
--- trunk/src/lib/network/network_socket.cc	(revision 9391)
+++ trunk/src/lib/network/network_socket.cc	(revision 9406)
@@ -33,4 +33,6 @@
 {
   bOk = true;
+  this->ip.host = 0;
+  this->ip.port = 0;
 }
 
Index: trunk/src/lib/network/network_socket.h
===================================================================
--- trunk/src/lib/network/network_socket.h	(revision 9391)
+++ trunk/src/lib/network/network_socket.h	(revision 9406)
@@ -27,9 +27,19 @@
      */
     virtual void connectToServer( std::string host, int port ) = 0;
-    
+
     /**
      * disconnect from server
      */
     virtual void disconnectServer() = 0;
+
+    /**
+     * reconnecting to another server by terminating old connection and init a new connection
+     */
+    virtual void reconnectToServer( std::string host, int port) = 0;
+
+    /**
+     * reconnecting to anoter server softly
+     */
+    virtual void reconnectToServerSoft( std::string host, int port) = 0;
 
     /**
@@ -40,5 +50,5 @@
      */
     virtual bool writePacket(byte * data, int length) = 0;
-    
+
     /**
      * read a packet sent by another NetworkSocket
@@ -54,8 +64,13 @@
      */
     inline bool isOk() { return this->bOk; }
-  
+
+    /** @returns the ip adderess of the destination socket */
+    IPaddress getRemoteAddress() { return ip; }
+
+
   protected:
-    bool bOk;            //!< check for socket status
+    bool              bOk;            //!< check for socket status
 
+    IPaddress         ip;             //!< host,port
 };
 
Index: trunk/src/lib/network/network_stream.cc
===================================================================
--- trunk/src/lib/network/network_stream.cc	(revision 9391)
+++ trunk/src/lib/network/network_stream.cc	(revision 9406)
@@ -12,4 +12,7 @@
    main-programmer: Christoph Renner rennerc@ee.ethz.ch
    co-programmer:   Patrick Boenzli  boenzlip@orxonox.ethz.ch
+
+     June 2006: finishing work on the network stream for pps presentation (rennerc@ee.ethz.ch)
+     July 2006: some code rearangement and integration of the proxy server mechanism (boenzlip@ee.ethz.ch)
 */
 
@@ -22,6 +25,8 @@
 #include "udp_socket.h"
 #include "udp_server_socket.h"
-#include "connection_monitor.h"
+#include "monitor/connection_monitor.h"
+#include "monitor/network_monitor.h"
 #include "synchronizeable.h"
+#include "ip.h"
 #include "network_game_manager.h"
 #include "shared_network_data.h"
@@ -42,9 +47,9 @@
 #include <algorithm>
 
-/* include your own header */
+
 #include "network_stream.h"
 
-/* probably unnecessary */
-using namespace std;
+
+#include "converter.h"
 
 
@@ -52,4 +57,7 @@
 
 
+/**
+ * empty constructor
+ */
 NetworkStream::NetworkStream()
     : DataStream()
@@ -57,35 +65,45 @@
   this->init();
   /* initialize the references */
-  this->type = NET_CLIENT;
-}
-
-
-/**
- * connect to a server as a client
- *  @param host: host name (address)
- *  @param port: port number
- */
-NetworkStream::NetworkStream( std::string host, int port )
-{
-  this->type = NET_CLIENT;
+  this->pInfo->nodeType = NET_CLIENT;
+}
+
+
+NetworkStream::NetworkStream( int nodeType)
+{
   this->init();
-  this->peers[0].socket = new UdpSocket( host, port );
-  this->peers[0].userId = 0;
-  this->peers[0].isServer = true;
-  this->peers[0].connectionMonitor = new ConnectionMonitor( 0 );
-}
-
-
-/**
- * start as a server
- *  @param port: at this port
- */
-NetworkStream::NetworkStream( int port )
-{
-  this->type = NET_SERVER;
-  this->init();
-  this->serverSocket = new UdpServerSocket(port);
-  this->bActive = true;
-}
+
+  this->pInfo->nodeType = nodeType;
+
+  switch( nodeType)
+  {
+    case NET_MASTER_SERVER:
+      // init the shared network data
+      SharedNetworkData::getInstance()->setHostID(0);
+//       SharedNetworkData::getInstance()->setNodeType(NET_MASTER_SERVER);
+      break;
+
+    case NET_PROXY_SERVER_ACTIVE:
+      // init the shared network data
+      SharedNetworkData::getInstance()->setHostID(0);
+//       SharedNetworkData::getInstance()->setNodeType(NET_PROXY_SERVER_ACTIVE);
+      break;
+    case NET_PROXY_SERVER_PASSIVE:
+            // init the shared network data
+      SharedNetworkData::getInstance()->setHostID(0);
+//       SharedNetworkData::getInstance()->setNodeType(NET_PROXY_SERVER_PASSIVE);
+      break;
+    case NET_CLIENT:
+//       SharedNetworkData::getInstance()->setNodeType(NET_CLIENT);
+      break;
+  }
+
+  SharedNetworkData::getInstance()->setDefaultSyncStream(this);
+
+  // get the local ip address
+  IPaddress ip;
+  SDLNet_ResolveHost( &ip, NULL, 0);
+  this->pInfo->ip = ip;
+}
+
 
 
@@ -97,9 +115,15 @@
   /* set the class id for the base object */
   this->setClassID(CL_NETWORK_STREAM, "NetworkStream");
-  this->bActive = false;
   this->serverSocket = NULL;
   this->networkGameManager = NULL;
-  myHostId = 0;
-  currentState = 0;
+  this->networkMonitor = NULL;
+
+  this->pInfo = new PeerInfo();
+  this->pInfo->userId = 0;
+  this->pInfo->lastAckedState = 0;
+  this->pInfo->lastRecvedState = 0;
+
+
+  this->currentState = 0;
 
   remainingBytesToWriteToDict = Preferences::getInstance()->getInt( "compression", "writedict", 0 );
@@ -147,4 +171,54 @@
   for ( SynchronizeableList::const_iterator it = getSyncBegin(); it != getSyncEnd(); it ++ )
     (*it)->setNetworkStream( NULL );
+
+  if( this->pInfo)
+    delete this->pInfo;
+
+  if( this->networkMonitor)
+    delete this->networkMonitor;
+}
+
+
+/**
+ * establish a connection to a remote master server
+ * @param host: host name
+ * @param port: the port number
+ */
+void NetworkStream::connectToMasterServer(std::string host, int port)
+{
+  int node = this->peers.size();
+  this->peers[node].socket = new UdpSocket( host, port );
+  this->peers[node].userId = 0;
+
+  this->peers[node].nodeType = NET_MASTER_SERVER;
+  this->peers[node].connectionMonitor = new ConnectionMonitor( 0 );
+  this->peers[node].ip = this->peers[node].socket->getRemoteAddress();
+}
+
+
+/**
+ * establish a connection to a remote proxy server
+ * @param host: host name
+ * @param port: the port number
+ */
+void NetworkStream::connectToProxyServer(std::string host, int port)
+{
+  int node = this->peers.size();
+  this->peers[node].socket = new UdpSocket( host, port );
+  this->peers[node].userId = 0;
+
+  this->peers[node].nodeType = NET_PROXY_SERVER_ACTIVE;
+  this->peers[node].connectionMonitor = new ConnectionMonitor( 0 );
+  this->peers[node].ip = this->peers[node].socket->getRemoteAddress();
+}
+
+
+/**
+ * create a server
+ * @param port: interface port for all clients
+ */
+void NetworkStream::createServer(int port)
+{
+  this->serverSocket = new UdpServerSocket(port);
 }
 
@@ -156,6 +230,5 @@
 {
   this->networkGameManager = NetworkGameManager::getInstance();
-  // setUniqueID( maxCon+2 ) because we need one id for every handshake
-  // and one for handshake to reject client maxCon+1
+
   this->networkGameManager->setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() );
   MessageManager::getInstance()->setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() );
@@ -165,18 +238,18 @@
 /**
  * starts the network handshake
+ * handsakes are always initialized from the client side first. this starts the handshake and therefore is only
+ * executed as client
  */
 void NetworkStream::startHandshake()
 {
-  Handshake* hs = new Handshake(false);
+  Handshake* hs = new Handshake(this->pInfo->nodeType);
   hs->setUniqueID( 0 );
   assert( peers[0].handshake == NULL );
   peers[0].handshake = hs;
 
+  // set the preferred nick name
   hs->setPreferedNickName( Preferences::getInstance()->getString( "multiplayer", "nickname", "Player" ) );
 
-//   peers[0].handshake->setSynchronized( true );
-  //this->connectSynchronizeable(*hs);
-  //this->connectSynchronizeable(*hs);
-  PRINTF(0)("NetworkStream: Handshake created: %s\n", hs->getName());
+  PRINTF(0)("NetworkStream: Handshake created: %s\n", hs->getCName());
 }
 
@@ -192,5 +265,5 @@
   sync.setNetworkStream( this );
 
-  this->bActive = true;
+//   this->bActive = true;
 }
 
@@ -215,10 +288,29 @@
 void NetworkStream::processData()
 {
+  // create the network monitor after all the init work and before there is any connection handlings
+  if( this->networkMonitor == NULL)
+    this->networkMonitor = new NetworkMonitor(this);
+
+
   int tick = SDL_GetTicks();
 
-  currentState++;
-
-  if ( this->type == NET_SERVER )
-  {
+  this->currentState++;
+  // there was a wrap around
+  if( this->currentState < 0)
+  {
+    PRINTF(1)("A wrap around in the state variable as occured. The server was running so long? Pls restart server or write a mail to the supporters!\n");
+  }
+
+  if ( this->pInfo->isMasterServer())
+  {
+    // execute everytthing the master server shoudl do
+    if ( serverSocket )
+      serverSocket->update();
+
+    this->updateConnectionList();
+  }
+  else if( this->pInfo->isProxyServer())
+  {
+    // execute everything the proxy server should do
     if ( serverSocket )
       serverSocket->update();
@@ -249,4 +341,7 @@
   cleanUpOldSyncList();
   handleHandshakes();
+
+  // update the network monitor
+  this->networkMonitor->process();
 
   // order of up/downstream is important!!!!
@@ -258,6 +353,6 @@
 
 /**
- * if we are a server update the connection list to accept new connections (clients)
- * also start the handsake for the new clients
+ * if we are a NET_MASTER_SERVER or NET_PROXY_SERVER_ACTIVE update the connection list to accept new
+ * connections (clients) also start the handsake for the new clients
  */
 void NetworkStream::updateConnectionList( )
@@ -276,10 +371,4 @@
       clientId = freeSocketSlots.back();
       freeSocketSlots.pop_back();
-      peers[clientId].socket = tempNetworkSocket;
-      peers[clientId].handshake = new Handshake(true, clientId, this->networkGameManager->getUniqueID(), MessageManager::getInstance()->getUniqueID() );
-      peers[clientId].connectionMonitor = new ConnectionMonitor( clientId );
-      peers[clientId].handshake->setUniqueID(clientId);
-      peers[clientId].userId = clientId;
-      peers[clientId].isServer = false;
     }
     else
@@ -290,27 +379,51 @@
         if ( it->first >= clientId )
           clientId = it->first + 1;
-
-      peers[clientId].socket = tempNetworkSocket;
-      peers[clientId].handshake = new Handshake(true, clientId, this->networkGameManager->getUniqueID(), MessageManager::getInstance()->getUniqueID());
-      peers[clientId].handshake->setUniqueID(clientId);
-      peers[clientId].connectionMonitor = new ConnectionMonitor( clientId );
-      peers[clientId].userId = clientId;
-      peers[clientId].isServer = false;
-
-      PRINTF(0)("num sync: %d\n", synchronizeables.size());
-    }
-
-    // check if there are too many clients connected
-    if ( clientId > MAX_CONNECTIONS )
-    {
-      peers[clientId].handshake->doReject( "too many connections" );
-      PRINTF(0)("Will reject client %d because there are to many connections!\n", clientId);
-    }
-    else
-    {
-      PRINTF(0)("New Client: %d\n", clientId);
-    }
-
-    //this->connectSynchronizeable(*handshakes[clientId]);
+    }
+    peers[clientId].socket = tempNetworkSocket;
+
+
+    // create new handshake and init its variables
+    peers[clientId].handshake = new Handshake(this->pInfo->nodeType, clientId, this->networkGameManager->getUniqueID(), MessageManager::getInstance()->getUniqueID());
+    peers[clientId].handshake->setUniqueID(clientId);
+
+    peers[clientId].connectionMonitor = new ConnectionMonitor( clientId );
+    peers[clientId].userId = clientId;
+
+    PRINTF(0)("num sync: %d\n", synchronizeables.size());
+
+    // get the proxy server informations and write them to the handshake, if any (proxy)
+    assert( this->networkMonitor != NULL);
+    PeerInfo* pi = this->networkMonitor->getFirstChoiceProxy();
+    if( pi != NULL)
+    {
+      peers[clientId].handshake->setProxy1Address( pi->ip);
+    }
+    pi = this->networkMonitor->getSecondChoiceProxy();
+    if( pi != NULL)
+      peers[clientId].handshake->setProxy2Address( pi->ip);
+
+    // check if the connecting client should reconnect to a proxy server
+    peers[clientId].handshake->setRedirect(/*this->networkMonitor->isReconnectNextClient()*/false);
+
+    // the connecting node of course is a client
+    peers[clientId].nodeType = NET_CLIENT;
+    peers[clientId].ip = peers[clientId].socket->getRemoteAddress();
+
+
+    // check if there are too many clients connected (DEPRECATED: new: the masterserver sends a list of proxy servers)
+//     if ( clientId > SharedNetworkData::getInstance()->getMaxPlayer() )
+//     {
+// //       peers[clientId].handshake->setRedirect(true);
+// //
+// //       peers[clientId].handshake->doReject( "too many connections" );
+//       PRINTF(0)("Will reject client %d because there are to many connections!\n", clientId);
+//     }
+//     else
+//     {
+//       PRINTF(0)("New Client: %d\n", clientId);
+//     }
+    PRINTF(0)("New Client: %d\n", clientId);
+
+
   }
 
@@ -339,12 +452,15 @@
       it->second.socket = NULL;
 
+      // remove the old connectin monitor
       if ( it->second.connectionMonitor )
         delete it->second.connectionMonitor;
       it->second.connectionMonitor = NULL;
 
+      // remove the handshake
       if ( it->second.handshake )
         delete it->second.handshake;
       it->second.handshake = NULL;
 
+      // and cleanup the user infos
       for ( SynchronizeableList::iterator it2 = synchronizeables.begin(); it2 != synchronizeables.end(); it2++ )
       {
@@ -373,8 +489,13 @@
 void NetworkStream::debug()
 {
-  if( this->isServer())
-    PRINT(0)(" Host ist Server with ID: %i\n", this->myHostId);
-  else
-    PRINT(0)(" Host ist Client with ID: %i\n", this->myHostId);
+  if( SharedNetworkData::getInstance()->isMasterServer()) {
+    PRINT(0)(" Host ist Master Server with ID: %i\n", this->pInfo->userId);
+  }
+  else if( SharedNetworkData::getInstance()->isProxyServer()) {
+    PRINT(0)(" Host ist Proxy Server with ID: %i\n", this->pInfo->userId);
+  }
+  else {
+    PRINT(0)(" Host ist Client with ID: %i\n", this->pInfo->userId);
+  }
 
   PRINT(0)(" Got %i connected Synchronizeables, showing active Syncs:\n", this->synchronizeables.size());
@@ -382,8 +503,8 @@
   {
     if( (*it)->beSynchronized() == true)
-      PRINT(0)("  Synchronizeable of class: %s::%s, with unique ID: %i, Synchronize: %i\n", (*it)->getClassName(), (*it)->getName(),
+      PRINT(0)("  Synchronizeable of class: %s::%s, with unique ID: %i, Synchronize: %i\n", (*it)->getClassCName(), (*it)->getCName(),
                (*it)->getUniqueID(), (*it)->beSynchronized());
   }
-  PRINT(0)(" Maximal Connections: %i\n", MAX_CONNECTIONS );
+  PRINT(0)(" Maximal Connections: %i\n", SharedNetworkData::getInstance()->getMaxPlayer() );
 
 }
@@ -414,17 +535,36 @@
     if ( it->second.handshake )
     {
+      // handshake finished
       if ( it->second.handshake->completed() )
       {
+        //handshake is correct
         if ( it->second.handshake->ok() )
         {
+          // the server gave it free for deletion
           if ( !it->second.handshake->allowDel() )
           {
-            if ( type != NET_SERVER )
+
+            if ( this->pInfo->isClient() )
             {
               SharedNetworkData::getInstance()->setHostID( it->second.handshake->getHostId() );
-              myHostId = SharedNetworkData::getInstance()->getHostID();
-
+              this->pInfo->userId = SharedNetworkData::getInstance()->getHostID();
+
+              it->second.nodeType = it->second.handshake->getRemoteNodeType();
+              it->second.ip = it->second.socket->getRemoteAddress();
+              // add the new server to the nodes list (it can be a NET_MASTER_SERVER or NET_PROXY_SERVER)
+              this->networkMonitor->addNode(&it->second);
+              // get proxy 1 address and add it
+              this->networkMonitor->addNode(it->second.handshake->getProxy1Address(), NET_PROXY_SERVER_ACTIVE);
+              // get proxy 2 address and add it
+              this->networkMonitor->addNode(it->second.handshake->getProxy2Address(), NET_PROXY_SERVER_ACTIVE);
+
+              // now check if the server accepted the connection
+              if( it->second.handshake->redirect())
+                this->handleReconnect( it->second.userId);
+
+              // create the new network game manager and init it
               this->networkGameManager = NetworkGameManager::getInstance();
               this->networkGameManager->setUniqueID( it->second.handshake->getNetworkGameManagerId() );
+              // init the new message manager
               MessageManager::getInstance()->setUniqueID( it->second.handshake->getMessageManagerId() );
             }
@@ -432,14 +572,34 @@
 
             PRINT(0)("handshake finished id=%d\n", it->second.handshake->getNetworkGameManagerId());
-
             it->second.handshake->del();
           }
           else
           {
+            // handshake finished registring new player
             if ( it->second.handshake->canDel() )
             {
-              if ( type == NET_SERVER )
+
+              if ( this->pInfo->isMasterServer() )
               {
-                handleNewClient( it->second.userId );
+                it->second.nodeType = it->second.handshake->getRemoteNodeType();
+                it->second.ip = it->second.socket->getRemoteAddress();
+
+                this->networkMonitor->addNode(&it->second);
+
+                this->handleNewClient( it->second.userId );
+
+                if ( PlayerStats::getStats( it->second.userId ) && it->second.handshake->getPreferedNickName() != "" )
+                {
+                  PlayerStats::getStats( it->second.userId )->setNickName( it->second.handshake->getPreferedNickName() );
+                }
+              }
+              else if ( this->pInfo->isProxyServer() )
+              {
+                it->second.nodeType = it->second.handshake->getRemoteNodeType();
+                it->second.ip = it->second.socket->getRemoteAddress();
+
+                this->networkMonitor->addNode(&it->second);
+
+                this->handleNewClient( it->second.userId );
 
                 if ( PlayerStats::getStats( it->second.userId ) && it->second.handshake->getPreferedNickName() != "" )
@@ -468,4 +628,35 @@
 
 /**
+ * this functions handles a reconnect event received from the a NET_MASTER_SERVER or NET_PROXY_SERVER
+ */
+void NetworkStream::handleReconnect(int userId)
+{
+  PRINTF(0)("===============================================\n");
+  PRINTF(0)("Client is redirected to the other proxy servers\n");
+  PRINTF(0)("===============================================\n");
+
+  return;
+
+  PeerInfo* pInfo = &this->peers[userId];
+
+  // reject the server
+  pInfo->handshake->doReject( "redirected to different server");
+
+  // flush the old synchronization states, since the numbering could be completely different
+  pInfo->lastAckedState = 0;
+  pInfo->lastRecvedState = 0;
+  // not sure if this works as expected
+  if( pInfo->handshake)
+    delete pInfo->handshake;
+
+  // disconnect from the current server and reconnect to proxy server
+  pInfo->socket->reconnectToServer( pInfo->handshake->getProxy1Address().ipString(), pInfo->handshake->getProxy1Address().port());
+
+  // and restart the handshake
+  this->startHandshake();
+}
+
+
+/**
  * handle upstream network traffic
  */
@@ -501,6 +692,8 @@
     for ( SynchronizeableList::iterator it = synchronizeables.begin(); it != synchronizeables.end(); it++ )
     {
+
       int oldOffset = offset;
       Synchronizeable & sync = **it;
+
 
       // do not include synchronizeables with uninit id and syncs that don't want to be synchronized
@@ -512,6 +705,6 @@
         continue;
 
-      // if we are a server and this is not our handshake
-      if ( isServer() && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId )
+      // if we are a server (both master and proxy servers) and this is not our handshake
+      if ( ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer() ) && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId )
         continue;
 
@@ -521,16 +714,21 @@
         continue;
 
+
+      assert( sync.getLeafClassID() != 0);
+
       assert( offset + INTSIZE <= UDP_PACKET_SIZE );
 
       // server fakes uniqueid == 0 for handshake
-      if ( this->isServer() && sync.getUniqueID() < MAX_CONNECTIONS - 1 )
+      if ( ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer() ) &&
+             sync.getUniqueID() <= SharedNetworkData::getInstance()->getMaxPlayer() + 1) // plus one to handle one client more than the max to redirect it
         n = Converter::intToByteArray( 0, buf + offset, UDP_PACKET_SIZE - offset );
       else
         n = Converter::intToByteArray( sync.getUniqueID(), buf + offset, UDP_PACKET_SIZE - offset );
 
+
       assert( n == INTSIZE );
       offset += n;
 
-      // make space for size
+      // make space for packet size
       offset += INTSIZE;
 
@@ -573,5 +771,5 @@
     // now compress the data with the zip library
     int compLength = 0;
-    if ( this->isServer() )
+    if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
       compLength = Zip::getInstance()->zip( buf, offset, compBuf, UDP_PACKET_SIZE, dictServer );
     else
@@ -637,12 +835,10 @@
       assert( Converter::byteArrayToInt( buf + 2*INTSIZE, &fromState ) == INTSIZE );
       assert( Converter::byteArrayToInt( buf + 3*INTSIZE, &ackedState ) == INTSIZE );
-      //NETPRINTF(n)("ackedstate: %d\n", ackedState);
       offset = 4*INTSIZE;
 
       peer->second.connectionMonitor->processUnzippedIncomingPacket( tick, buf, packetLength, state, ackedState );
 
-      //NETPRINTF(n)("got packet: %d, %d\n", length, packetLength);
-
-    //if this is an old state drop it
+
+      //if this is an old state drop it
       if ( state <= peer->second.lastRecvedState )
         continue;
@@ -655,5 +851,5 @@
       }
 
-      while ( offset + 2*INTSIZE < length )
+      while ( offset + 2 * INTSIZE < length )
       {
         assert( offset > 0 );
@@ -669,7 +865,8 @@
         Synchronizeable * sync = NULL;
 
+        // look for the synchronizeable in question
         for ( SynchronizeableList::iterator it = synchronizeables.begin(); it != synchronizeables.end(); it++ )
         {
-        //                                        client thinks his handshake has id 0!!!!!
+          // client thinks his handshake has id 0!!!!!
           if ( (*it)->getUniqueID() == uniqueId || ( uniqueId == 0 && (*it)->getUniqueID() == peer->second.userId ) )
           {
@@ -679,7 +876,10 @@
         }
 
+        // this synchronizeable does not yet exist! create it
         if ( sync == NULL )
         {
           PRINTF(0)("could not find sync with id %d. try to create it\n", uniqueId);
+
+          // if it is an old synchronizeable already removed, ignore it
           if ( oldSynchronizeables.find( uniqueId ) != oldSynchronizeables.end() )
           {
@@ -688,5 +888,6 @@
           }
 
-          if ( !peers[peer->second.userId].isServer )
+          // if the node we got this unknown sync from is a client we ignore it (since it has no rights to create a new sync)
+          if ( peers[peer->second.userId].isClient() )
           {
             offset += syncDataLength;
@@ -705,4 +906,5 @@
           assert( leafClassId != 0 );
 
+
           BaseObject * b = NULL;
           /* These are some small exeptions in creation: Not all objects can/should be created via Factory */
@@ -710,5 +912,5 @@
           if( leafClassId == CL_NULL_PARENT || leafClassId == CL_SYNCHRONIZEABLE || leafClassId == CL_NETWORK_GAME_MANAGER )
           {
-            PRINTF(1)("Can not create Class with ID %x!\n", (int)leafClassId);
+            PRINTF(1)("Don't create Object with ID %x, ignored!\n", (int)leafClassId);
             offset += syncDataLength;
             continue;
@@ -730,5 +932,5 @@
             sync->setSynchronized(true);
 
-            PRINTF(0)("Fabricated %s with id %d\n", sync->getClassName(), sync->getUniqueID());
+            PRINTF(0)("Fabricated %s with id %d\n", sync->getClassCName(), sync->getUniqueID());
           }
           else
@@ -744,5 +946,4 @@
         int n = sync->setStateDiff( peer->second.userId, buf+offset, syncDataLength, state, fromState );
         offset += n;
-        //NETPRINTF(0)("SSSSSEEEEETTTTT: %s %d\n",sync->getClassName(), n);
 
       }
@@ -779,12 +980,13 @@
 /**
  * is executed when a handshake has finished
- * @todo create playable for new user
  */
 void NetworkStream::handleNewClient( int userId )
 {
+  // init and assign the message manager
   MessageManager::getInstance()->initUser( userId );
-
+  // do all game relevant stuff here
   networkGameManager->signalNewPlayer( userId );
 }
+
 
 /**
Index: trunk/src/lib/network/network_stream.h
===================================================================
--- trunk/src/lib/network/network_stream.h	(revision 9391)
+++ trunk/src/lib/network/network_stream.h	(revision 9406)
@@ -14,6 +14,9 @@
 #include "server_socket.h"
 #include "handshake.h"
-#include "connection_monitor.h"
+#include "monitor/connection_monitor.h"
 #include "udp_server_socket.h"
+#include "peer_info.h"
+
+#include "shared_network_data.h"
 
 class Synchronizeable;
@@ -21,22 +24,6 @@
 class ServerSocket;
 class NetworkGameManager;
+class NetworkMonitor;
 
-//!< this structure contains informations about the network node
-class PeerInfo
-{
-  public:
-    PeerInfo() { clear(); }
-    void clear() { userId = 0; isServer = false; socket = NULL; handshake = NULL; lastAckedState = 0; lastRecvedState = 0; connectionMonitor = NULL; }
-
-
-  public:
-    int                 userId;
-    bool                isServer;
-    NetworkSocket *     socket;
-    Handshake *         handshake;
-    ConnectionMonitor * connectionMonitor;
-    int                 lastAckedState;
-    int                 lastRecvedState;
-};
 
 typedef std::list<Synchronizeable*>  SynchronizeableList;
@@ -49,42 +36,56 @@
   public:
     NetworkStream();
-    NetworkStream( std::string host, int port);
-    NetworkStream( int port );
+    NetworkStream(int nodeType);
+    virtual ~NetworkStream();
 
-    virtual ~NetworkStream();
     void init();
+
+    void connectToMasterServer(std::string host, int port);
+    void connectToProxyServer(std::string host, int port);
+    void createServer(int port);
 
     void createNetworkGameManager();
     void startHandshake();
 
+    /* synchronizeable interface */
     void connectSynchronizeable(Synchronizeable& sync);
     void disconnectSynchronizeable(Synchronizeable& sync);
 
-    inline bool isServer() const { return (this->type == NET_SERVER)? true:false; }
-    inline bool isActive() const { return this->bActive; }
+    inline int getMaxConnections(){ return SharedNetworkData::getInstance()->getMaxPlayer(); }
 
-    inline int getMaxConnections(){ return MAX_CONNECTIONS; }
+    /* functions for the peerInfo information retreival */
+    inline bool isUserIdActive( int userID ) { return (peers.find(userID) != peers.end()); }
+    inline bool isUserMasterServer( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isMasterServer(); }
+    inline bool isUserProxyServer( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isProxyServer(); }
+    inline bool isUserClient( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isClient(); }
 
+    /* peering interface */
+    inline PeerInfo & getPeerInfo( int userId ) { return peers[userId]; }
+    inline PeerInfo* getPeerInfo() { return this->pInfo; }
+    inline PeerList getPeerInfoList() { return this->peers; }
+
+    /* data processing*/
     virtual void processData();
+
+    /* debugging */
+    void debug();
+
+
+  private:
 
     inline SynchronizeableList::const_iterator getSyncBegin(){ return synchronizeables.begin(); }
     inline SynchronizeableList::const_iterator getSyncEnd(){ return synchronizeables.end(); }
+    void cleanUpOldSyncList();
     int getSyncCount();
 
-    inline bool isUserIdActive( int userID ) { return (peers.find(userID) != peers.end()); }
-    inline bool isUserServer( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isServer; }
-
-    void debug();
-
-    inline PeerInfo & getPeerInfo( int userId ) { return peers[userId]; }
-
-
-  private:
     void updateConnectionList();
+    /* handle processes */
     void handleHandshakes();
     void handleUpstream( int tick );
     void handleDownstream(int tick );
+
+    /* handle events*/
     void handleNewClient( int userId );
-    void cleanUpOldSyncList();
+    void handleReconnect( int userId );
 
     void writeToNewDict( byte * data, int length, bool upstream );
@@ -92,26 +93,24 @@
 
   private:
-    SynchronizeableList        synchronizeables;
-    PeerList                   peers;
-    ServerSocket*              serverSocket;
-    int                        type;
-    bool                       bActive;
-    std::list<int>             freeSocketSlots;
+    PeerList                   peers;                       //!< list of the network node informations
 
-    int                        myHostId;
+    PeerInfo*                  pInfo;                       //!< the info about the local peer node (not in the PeerList)
 
+    std::list<int>             freeSocketSlots;             //!< list of free sockets (to ensure not to resycle sockets)
     int                        currentState;                //!< current state id
 
-    NetworkGameManager*        networkGameManager;
+    NetworkMonitor*            networkMonitor;              //!< the network monitor
+    NetworkGameManager*        networkGameManager;          //!< reference to the network game manager
+    ServerSocket*              serverSocket;                //!< the listening socket of the server
 
     std::map<int,int>          oldSynchronizeables;         //!< used to save recently deleted sync ids to not recreate them
+    SynchronizeableList        synchronizeables;            //!< list of the synchronizeables
 
     byte                       buf[UDP_PACKET_SIZE];        //!< used by handleUp/Downstream
     byte                       compBuf[UDP_PACKET_SIZE];    //!< used by handleUp/Downstream
-
     int                        remainingBytesToWriteToDict; //!< if > 0 NetworkStream will write packets to DATA/dicts/newdict
 
-    int dictServer;
-    int dictClient;
+    int                        dictServer;                  //!< the zip dict for the server
+    int                        dictClient;                  //!< the zip dict for the client
 };
 #endif /* _NETWORK_STREAM */
Index: trunk/src/lib/network/peer_info.cc
===================================================================
--- trunk/src/lib/network/peer_info.cc	(revision 9406)
+++ trunk/src/lib/network/peer_info.cc	(revision 9406)
@@ -0,0 +1,71 @@
+/*
+   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: Christoph Renner rennerc@ee.ethz.ch
+   co-programmer:   Patrick Boenzli  boenzlip@orxonox.ethz.ch
+
+     June 2006: finishing work on the network stream for pps presentation (rennerc@ee.ethz.ch)
+     July 2006: some code rearangement and integration of the proxy server mechanism (boenzlip@ee.ethz.ch)
+*/
+
+
+#define DEBUG_MODULE_NETWORK
+
+
+#include "peer_info.h"
+
+
+
+
+
+
+/**
+ * constructor
+ */
+PeerInfo::PeerInfo()
+{
+  this->clear();
+}
+
+
+/**
+ * clearint and initializing the peer info
+ */
+void PeerInfo::clear()
+{
+  this->userId = 0;
+  this->nodeType = NET_CLIENT;
+  this->socket = NULL;
+  this->handshake = NULL;
+  this->lastAckedState = 0;
+  this->lastRecvedState = 0;
+  this->connectionMonitor = NULL;
+
+  this->ip = IP(0,0);
+}
+
+
+std::string PeerInfo::getNodeTypeString()
+{
+  switch( this->nodeType)
+  {
+    case NET_CLIENT:
+      return std::string("client");
+    case NET_PROXY_SERVER_ACTIVE:
+      return std::string("proxy server active");
+    case NET_PROXY_SERVER_PASSIVE:
+      return std::string("proxy server passive");
+    case NET_MASTER_SERVER:
+      return std::string("master server");
+  }
+
+  return std::string("node is uninit");
+}
Index: trunk/src/lib/network/peer_info.h
===================================================================
--- trunk/src/lib/network/peer_info.h	(revision 9406)
+++ trunk/src/lib/network/peer_info.h	(revision 9406)
@@ -0,0 +1,47 @@
+/*!
+ * @file peer_info.h
+ *  implementation a peer info
+ */
+
+#ifndef _PEER_INFO_H
+#define _PEER_INFO_H
+
+#include "server_socket.h"
+#include "handshake.h"
+#include "monitor/connection_monitor.h"
+
+#include <string>
+
+//!< this structure contains informations about the network node
+class PeerInfo
+{
+  public:
+    PeerInfo();
+
+    void clear();
+
+
+    inline bool isMasterServer() { return this->nodeType == NET_MASTER_SERVER; }
+    inline bool isProxyServer() { return this->nodeType == NET_PROXY_SERVER_ACTIVE; }
+    inline bool isProxyServerPassive() { return this->nodeType == NET_PROXY_SERVER_PASSIVE; }
+    inline bool isClient() { return this->nodeType == NET_CLIENT; }
+
+    std::string getNodeTypeString();
+
+
+  public:
+    int                 userId;                  //!< id of this network node
+    int                 nodeType;                //!< type of this network node
+    IP                  ip;                      //!> the ip address of this network node
+
+    NetworkSocket *     socket;                  //!< socket connecting to this node
+    Handshake *         handshake;               //!< the handshake object, active on connection setup
+    ConnectionMonitor * connectionMonitor;       //!< ConnectionMonitor monitoring the current network traffic
+
+    int                 lastAckedState;          //!< last acked state synchronized state
+    int                 lastRecvedState;         //!< last received state
+};
+
+
+
+#endif /* _PEER_INFO_H */
Index: trunk/src/lib/network/player_stats.cc
===================================================================
--- trunk/src/lib/network/player_stats.cc	(revision 9391)
+++ trunk/src/lib/network/player_stats.cc	(revision 9406)
@@ -23,4 +23,6 @@
 #include "shared_network_data.h"
 
+#include "converter.h"
+
 #include "preferences.h"
 
@@ -38,5 +40,5 @@
 {
   init();
-  
+
   this->userId = userId;
 }
@@ -62,5 +64,5 @@
   this->nickName = "Player";
   this->oldNickName = "Player";
-  
+
   userId_handle = registerVarId( new SynchronizeableInt( &userId, &userId, "userId" ) );
   teamId_handle = registerVarId( new SynchronizeableInt( &teamId, &teamId, "teamId" ) );
@@ -71,7 +73,7 @@
   modelFileName_handle = registerVarId( new SynchronizeableString( &modelFileName, &modelFileName, "modelFileName" ) );
   nickName_handler = registerVarId( new SynchronizeableString( &nickName, &nickName, "nickName" ) );
-  
+
   MessageManager::getInstance()->registerMessageHandler( MSGID_CHANGENICKNAME, changeNickHandler, NULL );
-  
+
   PRINTF(0)("PlayerStats created\n");
 }
@@ -96,8 +98,8 @@
   {
     this->setPlayableUniqueId( this->playableUniqueId );
-    
+
     PRINTF(0)("uniqueID changed %d %d %d\n", userId, SharedNetworkData::getInstance()->getHostID(), getUniqueID());
   }
-  
+
   if ( std::find( id.begin(), id.end(), nickName_handler ) != id.end() )
   {
@@ -115,10 +117,10 @@
 {
   const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYER_STATS );
-  
+
   if ( !list )
   {
     return NULL;
   }
-  
+
   for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
   {
@@ -128,5 +130,5 @@
     }
   }
-  
+
   return NULL;
 }
@@ -138,5 +140,5 @@
 {
   const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
-  
+
   if ( !list )
   {
@@ -144,5 +146,5 @@
     return;
   }
-  
+
   this->playable = NULL;
   for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
@@ -156,10 +158,10 @@
     }
   }
-  
+
   if ( this->playable && userId == SharedNetworkData::getInstance()->getHostID() )
   {
     State::getPlayer()->setPlayable( this->playable );
   }
-  
+
   this->playableUniqueId = uniqueId;
 }
@@ -173,11 +175,11 @@
   if ( playable )
     return playable;
-  
+
   assert( playableUniqueId > 0 );
-  
+
   setPlayableUniqueId( playableUniqueId );
-  
+
   assert( playable );
-  
+
   return playable;
 }
@@ -189,5 +191,5 @@
 void PlayerStats::setNickName( std::string nick )
 {
-  if ( SharedNetworkData::getInstance()->isGameServer() )
+  if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer() )
   {
     this->nickName = nick;
@@ -199,7 +201,7 @@
   {
     byte * data = new byte[nick.length()+INTSIZE];
-    
+
     assert( Converter::stringToByteArray( nick, data, nick.length()+INTSIZE) == nick.length()+INTSIZE );
-    
+
     MessageManager::getInstance()->sendMessage( MSGID_CHANGENICKNAME, data, nick.length()+INTSIZE, RT_SERVER, 0, MP_HIGHBANDWIDTH );
     return;
@@ -211,5 +213,5 @@
   std::string newNick;
   int res = Converter::byteArrayToString( data, newNick, dataLength );
-  
+
   if ( res != dataLength )
   {
@@ -217,8 +219,8 @@
     newNick = "invalid";
   }
-  
+
   if ( PlayerStats::getStats( userId ) )
     PlayerStats::getStats( userId )->setNickName( newNick );
-  
+
   return true;
 }
@@ -228,5 +230,5 @@
   if ( getStats( SharedNetworkData::getInstance()->getHostID() ) )
     getStats( SharedNetworkData::getInstance()->getHostID() )->setNickName( newNick );
-    
+
   Preferences::getInstance()->setString( "multiplayer", "nickname", newNick );
 }
@@ -237,5 +239,5 @@
 {
   const std::list<BaseObject*> * list;
-  
+
   while ( (list  = ClassList::getList( CL_PLAYER_STATS )) != NULL && list->begin() != list->end() )
     delete *list->begin();
@@ -247,30 +249,30 @@
 {
   ScoreList result;
-  
+
   const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYER_STATS );
-  
+
   if ( !list )
   {
     return result;
   }
-  
+
   for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
   {
     PlayerStats & stats = *dynamic_cast<PlayerStats*>(*it);
-    
+
     TeamScoreList::iterator it = result[stats.getTeamId()].begin();
-    
+
     while (  it != result[stats.getTeamId()].end() && stats.score > it->score )
     {
       it++;
     }
-    
+
     PlayerScore score;
     score.name = stats.getNickName();
     score.score = stats.getScore();
-    
+
     result[stats.getTeamId()].insert(it, score);
   }
-  
+
   return result;
 }
Index: trunk/src/lib/network/proxy/network_settings.cc
===================================================================
--- trunk/src/lib/network/proxy/network_settings.cc	(revision 9406)
+++ trunk/src/lib/network/proxy/network_settings.cc	(revision 9406)
@@ -0,0 +1,154 @@
+/*
+   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: Patrick Boenzli
+*/
+
+
+#define DEBUG_MODULE_NETWORK
+
+#include "network_settings.h"
+
+#include "netdefs.h"
+#include "shared_network_data.h"
+
+#include "loading/resource_manager.h"
+#include "loading/load_param.h"
+
+#include "debug.h"
+
+
+
+NetworkSettings* NetworkSettings::singletonRef = NULL;
+
+/**
+ * Standard constructor
+ */
+NetworkSettings::NetworkSettings()
+{
+  /* set the class id for the base object */
+  this->setClassID(CL_NETWORK_SETTINGS, "NetworkSettings");
+
+  // suggest a good standard max players value
+  this->maxPlayer = 10;
+
+//   this->loadData();
+}
+
+
+/**
+ * Standard destructor
+ */
+NetworkSettings::~NetworkSettings()
+{
+  NetworkSettings::singletonRef = NULL;
+
+  // remove all unused proxy data again
+  for( int i = 0; i < this->proxies.size(); i++)
+  {
+    IPaddress* ip = this->proxies.back();
+    this->proxies.pop_back();
+    delete ip;
+  }
+}
+
+
+/**
+ *  this loads the proxy settings from a configuration file
+ */
+void NetworkSettings::loadData()
+{
+  std::string fileName = ResourceManager::getInstance()->getDataDir();
+  fileName += "configs/network_settings.conf";
+
+  TiXmlDocument doc(fileName);
+  if( !doc.LoadFile(fileName))
+  {
+    PRINTF(1)("Loading file %s failed for Network Settings.\n", fileName.c_str());
+    return;
+  }
+  const TiXmlElement* root = doc.RootElement();
+
+  if( strcmp( root->Value(), "NetworkSettings"))
+  {
+    // report an error
+    PRINTF(1)("Specified XML File is not an orxonox Network Settings file (NetworkSettings element missing)\n");
+    return;
+  }
+
+  this->loadNetworkSettings( root);
+
+  // set the new unique id offset
+  // setUniqueID( maxCon+2 ) because we need one id for every handshake
+  // and one for handshake to reject client maxCon+1
+  SharedNetworkData::getInstance()->setNewUniqueID( this->maxPlayer + 2);
+}
+
+
+
+/**
+ * load the proxy settings
+ * @param root: the root element of the xml elemnts
+ */
+void NetworkSettings::loadNetworkSettings(const TiXmlElement* root)
+{
+  LoadParam(root, "master-addr", this, NetworkSettings, setMasterAddr);
+
+  LoadParam(root, "max-player", this, NetworkSettings, setMaxPlayer);
+
+
+  LOAD_PARAM_START_CYCLE(root, element);
+  {
+    element->ToText();
+    LoadParam_CYCLE(element, "proxy-addr", this, NetworkSettings, setProxyAddr);
+  }
+  LOAD_PARAM_END_CYCLE(element);
+
+}
+
+
+/**
+ * sets the master server address
+ * @param masterAddr: the address of the master server
+ */
+void NetworkSettings::setMasterAddr(const std::string& masterAddr)
+{
+  IPaddress *ip = new IPaddress;
+
+  SDLNet_ResolveHost( ip, masterAddr.c_str(), 9999 );
+
+  this->masterServer = *ip;
+}
+
+
+/**
+ * sets the proxy address to
+ *  @param proxyAddr: the proxy address
+ */
+void NetworkSettings::setProxyAddr(const std::string& proxyAddr)
+{
+
+  if( !SharedNetworkData::getInstance()->isMasterServer())
+    return;
+
+  IPaddress *ip = new IPaddress;
+
+  SDLNet_ResolveHost( ip, proxyAddr.c_str(), 9999 );
+
+  this->proxies.push_back(ip);
+}
+
+
+
+
+
+
+
Index: trunk/src/lib/network/proxy/network_settings.h
===================================================================
--- trunk/src/lib/network/proxy/network_settings.h	(revision 9406)
+++ trunk/src/lib/network/proxy/network_settings.h	(revision 9406)
@@ -0,0 +1,64 @@
+/*!
+ * @file proxy_settings.h
+ *  some shared data from the proxy settings
+ */
+
+#ifndef _NETWORK_SETTINGS_H
+#define _NETWORK_SETTINGS_H
+
+#include "base_object.h"
+#include "netdefs.h"
+
+#include "debug.h"
+#include "ip.h"
+
+#include <vector>
+
+
+class NetworkStream;
+class Synchronizeable;
+class TiXmlElement;
+
+
+/* and here is the class itsself*/
+class NetworkSettings : public BaseObject
+{
+
+  public:
+    inline static NetworkSettings* getInstance() { if (!NetworkSettings::singletonRef) NetworkSettings::singletonRef = new NetworkSettings();
+      return NetworkSettings::singletonRef; }
+    virtual ~NetworkSettings();
+
+    void loadData();
+
+    void loadNetworkSettings(const TiXmlElement* root);
+
+    /** @param number: sets the max number of players */
+    inline void setMaxPlayer(int number) { this->maxPlayer = number; }
+    /** @returns teh max number of players */
+    int getMaxPlayer() { return this->maxPlayer; }
+
+    void setMasterAddr(const std::string& masterAddr);
+    /** @returns the address of the master server read from the network config file */
+    inline IP getMasterAddr() { return this->masterServer; }
+
+    void setProxyAddr(const std::string& proxyAddr);
+    /** @returns the list of proxy servers from the init file */
+    inline std::vector<IPaddress*>* getProxyList() { return &this->proxies; }
+
+
+  private:
+    NetworkSettings();
+
+
+  private:
+    static NetworkSettings*        singletonRef;            //!< Pointer to the only instance of this Class
+    int                          maxPlayer;               //!< maximal number of players
+    std::vector<IPaddress*>      proxies;                 //!< all registered proxies
+    IP                           masterServer;            //!< master server ip address
+
+};
+
+
+
+#endif /* _NETWORK_SETTINGS_H */
Index: trunk/src/lib/network/shared_network_data.cc
===================================================================
--- trunk/src/lib/network/shared_network_data.cc	(revision 9391)
+++ trunk/src/lib/network/shared_network_data.cc	(revision 9406)
@@ -18,7 +18,8 @@
 #include "shared_network_data.h"
 #include "netdefs.h"
+#include "state.h"
 
+#include "debug.h"
 
-using namespace std;
 
 
@@ -33,8 +34,11 @@
   this->setClassID(CL_SHARED_NETWORK_DATA, "SharedNetworkData");
 
+  this->nodeType = NET_CLIENT;
   this->hostID = -1;
   this->defaultSyncStream = NULL;
-  this->newUniqueID = MAX_CONNECTIONS + 2;
-  this->bGameServer = false;
+
+  // setUniqueID( maxCon+2 ) because we need one id for every handshake
+  // and one for handshake to reject client maxCon+1
+  this->newUniqueID = 2;
 }
 
Index: trunk/src/lib/network/shared_network_data.h
===================================================================
--- trunk/src/lib/network/shared_network_data.h	(revision 9391)
+++ trunk/src/lib/network/shared_network_data.h	(revision 9406)
@@ -8,10 +8,13 @@
 
 #include "base_object.h"
+#include "netdefs.h"
+#include "proxy/network_settings.h"
 
+//!< maximal connectinons for the server
+#define NET_MAX_CONNECTIONS 2
 
 class NetworkStream;
 class Synchronizeable;
-template<typename>
-    class tList;
+
 
 /* and here is the class itsself*/
@@ -25,10 +28,19 @@
 
     /** @returns the next uniqueID free for an object */
-    inline int getNewUniqueID() { return ( this->bGameServer)?this->newUniqueID++:-1; }
+    inline int getNewUniqueID() { return ( this->nodeType != NET_CLIENT)?this->newUniqueID++:-1; }
+    /** sets the @param newUniqueID: the new offset for the next unique id */
+    inline void setNewUniqueID(int newUniqueID) { this->newUniqueID = newUniqueID; }
 
-    /** @returns true is this node is a game server */
-    inline bool isGameServer() { return this->bGameServer; }
+    /** @returns true is this node is a master server */
+    inline bool isMasterServer() { return this->nodeType == NET_MASTER_SERVER; }
+    /** @returns true is this node is a proxy server */
+    inline bool isProxyServer() { return this->nodeType == NET_PROXY_SERVER_ACTIVE; }
+    /** @returns true is this node is a client*/
+    inline bool isClient() { return this->nodeType == NET_CLIENT; }
     /** sets the game server flag @param bGameServer true if it is a game server */
-    inline void setGameServer(bool bGameServer) { this->bGameServer = bGameServer; }
+    inline void setNodeType(int nodeType) { this->nodeType = nodeType; }
+
+    /** @returns the maximum number of players for this server */
+    inline int getMaxPlayer() { return NetworkSettings::getInstance()->getMaxPlayer(); }
 
     /** @returns the hostID of the node */
@@ -49,5 +61,6 @@
   private:
     int                             newUniqueID;             //!< next uniqueID
-    bool                            bGameServer;             //!< true if it is a server
+    int                             nodeType;                //!< saves the node type here
+
     int                             hostID;                  //!< The Host-ID of the Manager
     NetworkStream*                  defaultSyncStream;       //!< default synchronize NetworkStream
Index: trunk/src/lib/network/synchronizeable.cc
===================================================================
--- trunk/src/lib/network/synchronizeable.cc	(revision 9391)
+++ trunk/src/lib/network/synchronizeable.cc	(revision 9406)
@@ -11,6 +11,6 @@
 
 ### File Specific:
-   main-programmer: Silvan Nellen
-   co-programmer: Benjamin Wuest
+   main-programmer: Christoph Renner (rennerc@ee.ethz.ch)
+   co-programmer: Patrick Boenzli (patrick@orxonox.ethz.ch)
 */
 
@@ -29,4 +29,6 @@
 #include "synchronizeable.h"
 
+#include "converter.h"
+
 
 
@@ -38,9 +40,9 @@
   this->setClassID(CL_SYNCHRONIZEABLE, "Synchronizeable");
   this->owner = 0;
-  this->setIsServer(SharedNetworkData::getInstance()->getHostID() == 0);
+//   this->setIsServer(SharedNetworkData::getInstance()->getHostID() == 0);
   this->uniqueID = NET_UID_UNASSIGNED;
   this->networkStream = NULL;
   this->bSynchronize = false;
-  
+
   if( State::isOnline())
   {
@@ -54,5 +56,5 @@
   assert( syncVarList.size() == 0 );
   mLeafClassId = this->registerVarId( new SynchronizeableInt( (int*)&this->getLeafClassID(), (int*)&this->getLeafClassID(), "leafClassId" ) );
-    
+
   this->registerVar( new SynchronizeableInt( &this->owner, &this->owner, "owner" ) );
   this->registerVar( new SynchronizeableString( &this->objectName, &this->objectName, "objectName" ) );
@@ -69,9 +71,10 @@
   {
     this->networkStream->disconnectSynchronizeable(*this);
-  
-    if ( this->isServer() && this->beSynchronized() && this->getUniqueID() > 0 && !this->isA( CL_MESSAGE_MANAGER ) )
+
+    if ( (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer() )
+           && this->beSynchronized() && this->getUniqueID() > 0 && !this->isA( CL_MESSAGE_MANAGER ) )
       NetworkGameManager::getInstance()->removeSynchronizeable( this->getUniqueID() );
   }
-    
+
   for ( SyncVarList::iterator it = syncVarList.begin(); it != syncVarList.end(); it++ )
   {
@@ -79,5 +82,5 @@
   }
   syncVarList.clear();
-  
+
   for ( UserStateHistory::iterator it = recvStates.begin(); it != recvStates.end(); it++ )
   {
@@ -93,5 +96,5 @@
 
   }
-  
+
   for ( UserStateHistory::iterator it = sentStates.begin(); it != sentStates.end(); it++ )
   {
@@ -105,32 +108,19 @@
       delete *it2;
     }
-
-  }
-}
-
-/**
- * Sets the server flag to a given value
- * @param isServer: the boolean value which the server flag is to set to
- */
-void Synchronizeable::setIsServer(bool isServer)
-{
-  if( isServer )
-    this->state = this->state | STATE_SERVER;
-  else
-    this->state = this->state & (~STATE_SERVER);
-}
-
-
-/**
- * Determines if the server flag is set
- * @return true, if the server flag is true, false else
- */
-bool Synchronizeable::isServer()
-{
-  return (this->state & STATE_SERVER) >0;
-}
-
-
-
+  }
+}
+
+
+
+/**
+ * creates a diff image from two states
+ * @param userId: the userid of the user where the image will be sent to
+ * @param data: the binary data array to write to
+ * @param maxLength: maximal length of the data written (length of available space in the array)
+ * @param stateId: the state id that this diff will represent
+ * @param priorityTH: the priority threshold: all syncs below this threshold won't be synchronized
+ *
+ * @todo check for permissions
+ */
 int Synchronizeable::getStateDiff( int userId, byte* data, int maxLength, int stateId, int fromStateId, int priorityTH )
 {
@@ -169,5 +159,5 @@
         (*it2)->data = NULL;
       }
-      
+
       delete *it2;
     }
@@ -181,9 +171,4 @@
   while ( it != sentStates[userId].end() && (*it)->stateId != fromStateId )
     it++;
-  
-//  if ( getLeafClassID() == CL_SPACE_SHIP )
-//  {
-//    PRINTF(0)("getStateDiff:SpaceShip from: %d stateId: %d\n", (it == sentStates[userId].end())?-1:fromStateId, stateId);
-//  }
 
   if ( it == sentStates[userId].end() )
@@ -196,5 +181,5 @@
 
     stateFrom = initialEntry;
-    
+
     sentStates[userId].push_back( stateFrom );
   }
@@ -205,5 +190,5 @@
 
   sentStates[userId].push_back( stateTo );
-  
+
   stateTo->stateId = stateId;
   stateTo->dataLength = neededSize;
@@ -214,6 +199,6 @@
   int i = 0;
   int n;
-  
-  bool hasPermission;
+
+  bool hasPermission = false;
   bool sizeChanged = false;
 
@@ -221,20 +206,40 @@
   for ( SyncVarList::iterator it = syncVarList.begin(); it != syncVarList.end(); it++ )
   {
-    hasPermission = (
-            this->isServer() && (*it)->checkPermission( PERMISSION_SERVER ) ||
-        this->owner == SharedNetworkData::getInstance()->getHostID() && (*it)->checkPermission( PERMISSION_OWNER ) ||
-            this->isServer() && this->owner != userId && (*it)->checkPermission( PERMISSION_OWNER ) ||
-            (*it)->checkPermission( PERMISSION_ALL ) 
-                    );
-    
-    if ( sizeIter == stateFrom->sizeList.end() || *sizeIter != (*it)->getSize() ) 
+    // DATA PERMISSIONS
+    // check if this synchronizeable has the permissions to write the data
+
+    // first check MASTER_SERVER permissions
+    if( SharedNetworkData::getInstance()->isMasterServer() && (*it)->checkPermission( PERMISSION_MASTER_SERVER ))
+      hasPermission = true;
+    // now check PROXY_SERVER permissions
+    else if( SharedNetworkData::getInstance()->isProxyServer() && (*it)->checkPermission( PERMISSION_MASTER_SERVER ))
+      hasPermission = true;
+    // now check OWNER permissions
+    else if( this->owner == SharedNetworkData::getInstance()->getHostID() && (*it)->checkPermission( PERMISSION_OWNER ))
+      hasPermission = true;
+    // now check ALL permissions
+    else if( (*it)->checkPermission( PERMISSION_ALL ))
+      hasPermission = true;
+    // SPECIAL: get write permissions if i am master server and i am able to overwrite the client stuff
+    else if( SharedNetworkData::getInstance()->isMasterServer() && this->owner != userId && (*it)->checkPermission( PERMISSION_OWNER ))
+      hasPermission = true;
+    // SPECIAL: get write permissions if i am proxy server and i am able to overwrite the client stuff
+    else if( SharedNetworkData::getInstance()->isProxyServer()  && this->owner != userId && (*it)->checkPermission( PERMISSION_OWNER ))
+      hasPermission = true;
+    else
+      hasPermission = false;
+
+
+    if ( sizeIter == stateFrom->sizeList.end() || *sizeIter != (*it)->getSize() )
       sizeChanged = true;
-    
+
     if ( ( hasPermission && (*it)->getPriority() >= priorityTH ) || sizeChanged )
     {
       n = (*it)->writeToBuf( stateTo->data+i, stateTo->dataLength - i );
       //NETPRINTF(0)("getvar %s %d\n", (*it)->getName().c_str(), n);
+      //PRINTF(0)("getvar %s %d\n", (*it)->getName().c_str(), n);
       stateTo->sizeList.push_back( n );
-      //(*it)->debug();
+      // this is only for very hardcore debug sessions
+      // (*it)->debug();
       i += n;
     }
@@ -257,5 +262,5 @@
   if ( i != neededSize )
   {
-    PRINTF(0)("strange error: (%s) %d != %d\n", this->getClassName(), i, neededSize);
+    PRINTF(0)("strange error: (%s) %d != %d\n", this->getClassCName(), i, neededSize);
     assert(false);
   }
@@ -281,4 +286,5 @@
  * @param fromStateId id of the base state id
  * @return number bytes read
+ *
  * @todo check for permissions
  */
@@ -299,14 +305,10 @@
   StateHistoryEntry * stateFrom = NULL;
 
+  // search the state from wich the diff is made of
   StateHistory::iterator it = recvStates[userId].begin();
   while ( it != recvStates[userId].end() && (*it)->stateId != fromStateId )
     it++;
 
-  
-//  if ( getLeafClassID() == CL_SPACE_SHIP )
-//  {
-//    PRINTF(0)("setStateDiff:SpaceShip from: %d stateId: %d\n", (it == recvStates[userId].end())?-1:fromStateId, stateId);
-//  }
-
+  // if this is the first state to receive
   if ( it == recvStates[userId].end() )
   {
@@ -318,11 +320,12 @@
 
     stateFrom = initialEntry;
-    
+
     recvStates[userId].push_back( stateFrom );
   }
   else
     stateFrom = (*it);
-  
-  //apply diff
+
+
+  // apply diff
   for ( int i = 0; i<length; i++ )
   {
@@ -331,26 +334,50 @@
     else
       stateTo->data[i] = data[i];
-    
-  }
-  
+  }
+
   //add state to state history
   recvStates[userId].push_back( stateTo );
-  
+
   int i = 0;
   int n = 0;
   std::list<int> changes;
-  
+  bool hasPermission = false;
+
+  // extract the new state for every client
   for ( SyncVarList::iterator it = syncVarList.begin(); it != syncVarList.end(); it++ )
   {
-    if (
-        (*it)->checkPermission( PERMISSION_SERVER ) && networkStream->isUserServer( userId ) ||
-        (*it)->checkPermission( PERMISSION_OWNER ) && this->owner == userId ||
-        networkStream->isUserServer( userId ) && this->owner != SharedNetworkData::getInstance()->getHostID() && (*it)->checkPermission( PERMISSION_OWNER ) ||
-        (*it)->checkPermission( PERMISSION_ALL ) 
-       )
+    // DATA PERMISSIONS
+    // check if this synchronizeable has the permissions to write the data
+
+    // first check MASTER_SERVER permissions
+    if(  this->networkStream->isUserMasterServer( userId ) && (*it)->checkPermission( PERMISSION_MASTER_SERVER ))
+      hasPermission = true;
+    // now check PROXY_SERVER permissions
+    else if( this->networkStream->isUserProxyServer( userId )  && (*it)->checkPermission( PERMISSION_MASTER_SERVER ))
+      hasPermission = true;
+    // now check OWNER permissions
+    else if( this->owner == userId && (*it)->checkPermission( PERMISSION_OWNER ))
+      hasPermission = true;
+    // now check ALL permissions
+    else if( (*it)->checkPermission( PERMISSION_ALL ))
+      hasPermission = true;
+    // SPECIAL: get write permissions if im sending to a master server that does not own this sync
+    else if( this->networkStream->isUserMasterServer( userId ) && this->owner != SharedNetworkData::getInstance()->getHostID() && (*it)->checkPermission( PERMISSION_OWNER ))
+      hasPermission = true;
+    // SPECIAL: get write permissions if im sending to a proxy server that does not own this sync
+    else if( this->networkStream->isUserProxyServer( userId )  && this->owner != SharedNetworkData::getInstance()->getHostID() && (*it)->checkPermission( PERMISSION_OWNER ))
+      hasPermission = true;
+    else
+      hasPermission = false;
+
+
+
+    // if it has the permission to write do it
+    if( hasPermission)
     {
       n = (*it)->readFromBuf( stateTo->data + i, stateTo->dataLength - i );
       i += n;
-      //NETPRINTF(0)("%s::setvar %s %d\n", getClassName(), (*it)->getName().c_str(), n);
+      //NETPRINTF(0)("%s::setvar %s %d\n", getClassCName(), (*it)->getName().c_str(), n);
+      //PRINTF(0)("%s::setvar %s %d\n", getClassCName(), (*it)->getName().c_str(), n);
       //(*it)->debug();
       if ( (*it)->getHasChanged() )
@@ -361,7 +388,7 @@
     else
     {
-//      PRINTF(0)("DONT SET VAR BECAUSE OF PERMISSION: %s %d %d %d %d %d %d\n", (*it)->getName().c_str(), (*it)->checkPermission( PERMISSION_SERVER ), (*it)->checkPermission( PERMISSION_OWNER ), (*it)->checkPermission( PERMISSION_ALL ), networkStream->isUserServer( userId ), this->owner, userId );
+//      PRINTF(0)("DONT SET VAR BECAUSE OF PERMISSION: %s %d %d %d %d %d %d\n", (*it)->getName().c_str(), (*it)->checkPermission( PERMISSION_MASTER_SERVER ), (*it)->checkPermission( PERMISSION_OWNER ), (*it)->checkPermission( PERMISSION_ALL ), networkStream->isUserServer( userId ), this->owner, userId );
       n = (*it)->getSizeFromBuf( stateTo->data + i, stateTo->dataLength - i );
-      //NETPRINTF(0)("%s::setvar %s %d\n", getClassName(), (*it)->getName().c_str(), n);
+      //NETPRINTF(0)("%s::setvar %s %d\n", getClassCName(), (*it)->getName().c_str(), n);
       //(*it)->debug();
       i += n;
@@ -370,5 +397,5 @@
 
   this->varChangeHandler( changes );
-  
+
   return i;
 }
@@ -423,13 +450,13 @@
         (*it)->data = NULL;
       }
-    
+
       delete *it;
     }
     recvStates[userId].clear();
   }
- 
+
   if ( sentStates.size() > userId )
   {
-    
+
     for ( std::list<StateHistoryEntry*>::iterator it = sentStates[userId].begin(); it != sentStates[userId].end(); it++ )
     {
@@ -439,5 +466,5 @@
         (*it)->data = NULL;
       }
-    
+
       delete *it;
     }
@@ -448,7 +475,7 @@
 /**
  * this function is called after recieving a state.
- * @param userId 
- * @param stateId 
- * @param fromStateId 
+ * @param userId
+ * @param stateId
+ * @param fromStateId
  */
 void Synchronizeable::handleRecvState( int userId, int stateId, int fromStateId )
@@ -457,5 +484,5 @@
   if ( recvStates.size() <= userId )
     recvStates.resize( userId+1 );
-  
+
   //remove old states
   StateHistory::iterator it = recvStates[userId].begin();
@@ -485,5 +512,5 @@
       StateHistory::iterator delIt = it;
       it ++;
-      
+
       if ( (*delIt)->data )
       {
@@ -493,13 +520,13 @@
       delete *delIt;
       recvStates[userId].erase( delIt );
-      
+
       continue;
     }
     it++;
   }
-  
+
   StateHistory::iterator fromState = recvStates[userId].end();
   StateHistory::iterator toState = recvStates[userId].end();
-  
+
   for ( it = recvStates[userId].begin(); it != recvStates[userId].end(); it++ )
   {
@@ -508,19 +535,19 @@
     if ( (*it)->stateId == fromStateId )
       fromState = it;
-    
+
     if ( fromState != recvStates[userId].end() && toState != recvStates[userId].end() )
       break;
   }
-  
+
   // setStateDiff was not called and i know fromStateId
   if ( fromState != recvStates[userId].end() && toState == recvStates[userId].end() )
   {
     StateHistoryEntry * entry = new StateHistoryEntry;
-    
+
     entry->dataLength = (*fromState)->dataLength;
     if ( entry->dataLength > 0 )
     {
       entry->data = new byte[entry->dataLength];
-          
+
       assert( (*fromState)->data );
       memcpy( entry->data, (*fromState)->data, entry->dataLength );
@@ -528,8 +555,8 @@
     else
       entry->data = NULL;
-    
+
     entry->sizeList = (*fromState)->sizeList;
     entry->stateId = stateId;
-    
+
     recvStates[userId].push_back(entry);
   }
@@ -538,7 +565,7 @@
 /**
  * this function is called after sending a state
- * @param userId 
- * @param stateId 
- * @param fromStateId 
+ * @param userId
+ * @param stateId
+ * @param fromStateId
  */
 void Synchronizeable::handleSentState( int userId, int stateId, int fromStateId )
@@ -557,5 +584,5 @@
       StateHistory::iterator delIt = it;
       it ++;
-      
+
       if ( (*delIt)->data )
       {
@@ -565,5 +592,5 @@
       delete *delIt;
       sentStates[userId].erase( delIt );
-      
+
       continue;
     }
@@ -571,8 +598,8 @@
   }
 
-  
+
   StateHistory::iterator fromState = sentStates[userId].end();
   StateHistory::iterator toState = sentStates[userId].end();
-  
+
   for ( it = sentStates[userId].begin(); it != sentStates[userId].end(); it++ )
   {
@@ -581,20 +608,20 @@
     if ( (*it)->stateId == fromStateId )
       fromState = it;
-    
+
     if ( fromState != sentStates[userId].end() && toState != sentStates[userId].end() )
       break;
   }
 
-  
+
   // getStateDiff was not called and i know fromStateId
   if ( fromState != sentStates[userId].end() && toState == sentStates[userId].end() )
   {
     StateHistoryEntry * entry = new StateHistoryEntry;
-    
+
     entry->dataLength = (*fromState)->dataLength;
     if ( entry->dataLength > 0 )
     {
       entry->data = new byte[entry->dataLength];
-      
+
       assert( (*fromState)->data );
       memcpy( entry->data, (*fromState)->data, entry->dataLength );
@@ -602,13 +629,13 @@
     else
       entry->data = NULL;
-    
+
     entry->sizeList = (*fromState)->sizeList;
     entry->stateId = stateId;
-    
+
     sentStates[userId].push_back(entry);
   }
-  
-}
-
-
-
+
+}
+
+
+
Index: trunk/src/lib/network/synchronizeable.h
===================================================================
--- trunk/src/lib/network/synchronizeable.h	(revision 9391)
+++ trunk/src/lib/network/synchronizeable.h	(revision 9406)
@@ -1,5 +1,5 @@
 /*!
  * @file synchronizeable.h
-    \brief interface for all classes that have to be synchronized
+ * @brief interface for all classes that have to be synchronized
  */
 
@@ -8,8 +8,5 @@
 
 #include "base_object.h"
-#include "netdefs.h"
-#include "converter.h"
-#include "vector.h"
-#include "quaternion.h"
+
 #include "synchronizeable_var/synchronizeable_var.h"
 #include "synchronizeable_var/synchronizeable_vector.h"
@@ -20,11 +17,9 @@
 #include "synchronizeable_var/synchronizeable_bool.h"
 #include "synchronizeable_var/synchronizeable_uint.h"
-
+#include "synchronizeable_var/synchronizeable_ip.h"
 
 #include <vector>
 #include <list>
 
-//State constants: They have to be of the form 2^n
-#define STATE_SERVER 1
 
 struct StateHistoryEntry
@@ -51,7 +46,4 @@
     virtual ~Synchronizeable();
 
-    void setIsServer( bool isServer );
-    bool isServer();
-
     virtual void varChangeHandler( std::list<int> & id );
 
@@ -61,5 +53,5 @@
     virtual void handleSentState( int userId, int stateId, int fromStateId );
     virtual void handleRecvState( int userId, int stateId, int fromStateId );
-    
+
     void registerVar( SynchronizeableVar * var );
     int registerVarId( SynchronizeableVar * var );
@@ -82,5 +74,5 @@
   protected:
     NetworkStream*    networkStream;  //!< reference network stream we are connected to
-    int               state;
+
 
   private:
Index: trunk/src/lib/network/synchronizeable_var/synchronizeable_bool.cc
===================================================================
--- trunk/src/lib/network/synchronizeable_var/synchronizeable_bool.cc	(revision 9391)
+++ trunk/src/lib/network/synchronizeable_var/synchronizeable_bool.cc	(revision 9406)
@@ -16,4 +16,5 @@
 
 #include "synchronizeable_bool.h"
+#include <cassert>
 
 
@@ -44,7 +45,7 @@
 {
   assert( maxLength >= 1 );
-  
+
   buf[0] = ( *vPtrIn ) ? 1 : 0;
-  
+
   return 1;
 }
@@ -59,11 +60,11 @@
 {
   assert( maxLength >= 1 );
-  
+
   bool oldVal = *vPtrOut;
-  
+
   *vPtrOut = buf[0] != 0;
-  
+
   setHasChanged( oldVal != *vPtrOut );
-  
+
   return 1;
 }
Index: trunk/src/lib/network/synchronizeable_var/synchronizeable_bool.h
===================================================================
--- trunk/src/lib/network/synchronizeable_var/synchronizeable_bool.h	(revision 9391)
+++ trunk/src/lib/network/synchronizeable_var/synchronizeable_bool.h	(revision 9406)
@@ -2,20 +2,20 @@
  * @file synchronizeable_int.h
  * @brief Definition of SynchronizeableInt
-*/
-
-#include "synchronizeable_var/synchronizeable_var.h"
+ */
 
 #ifndef _SYNCHRONIZEABLE_BOOL_H
 #define _SYNCHRONIZEABLE_BOOL_H
 
+#include "synchronizeable_var.h"
+
 class SynchronizeableBool : public SynchronizeableVar {
 
   public:
-    SynchronizeableBool( bool * ptrIn, bool * ptrOut, std::string name, int permission = PERMISSION_SERVER, int priority = 0 );
+    SynchronizeableBool( bool * ptrIn, bool * ptrOut, std::string name, int permission = PERMISSION_MASTER_SERVER, int priority = 0 );
     virtual ~SynchronizeableBool();
-    
+
     virtual int writeToBuf( byte * buf, int maxLength );
     virtual int readFromBuf( byte * buf, int maxLength );
-    
+
     /**
      * check if writeToBuf will return the same size every time
@@ -23,7 +23,7 @@
      */
     virtual bool hasStaticSize(){ return true; };
-    
+
     virtual void debug();
-    
+
   private:
     bool * vPtrIn;       //!< pointer to data (read)
Index: trunk/src/lib/network/synchronizeable_var/synchronizeable_float.cc
===================================================================
--- trunk/src/lib/network/synchronizeable_var/synchronizeable_float.cc	(revision 9391)
+++ trunk/src/lib/network/synchronizeable_var/synchronizeable_float.cc	(revision 9406)
@@ -17,4 +17,5 @@
 #include "synchronizeable_float.h"
 #include "converter.h"
+#include <cassert>
 
 
@@ -46,7 +47,7 @@
 {
   int res = Converter::floatToByteArray( *vPtrIn, buf, maxLength );
-  
+
   assert( res == FLOATSIZE );
-  
+
   return res;
 }
@@ -61,13 +62,13 @@
 {
   assert( maxLength >= FLOATSIZE );
-  
+
   float oldVal = *vPtrOut;
-  
+
   int res = Converter::byteArrayToFloat( buf, vPtrOut );
-  
+
   setHasChanged( oldVal != *vPtrOut );
-  
+
   assert( res == FLOATSIZE );
-  
+
   return res;
 }
Index: trunk/src/lib/network/synchronizeable_var/synchronizeable_float.h
===================================================================
--- trunk/src/lib/network/synchronizeable_var/synchronizeable_float.h	(revision 9391)
+++ trunk/src/lib/network/synchronizeable_var/synchronizeable_float.h	(revision 9406)
@@ -2,20 +2,21 @@
  * @file synchronizeable_float.h
  * @brief Definition of SynchronizeableFloat
-*/
+ */
 
-#include "synchronizeable_var/synchronizeable_var.h"
 
 #ifndef _SYNCHRONIZEABLE_FLOAT_H
 #define _SYNCHRONIZEABLE_FLOAT_H
 
+#include "synchronizeable_var.h"
+
 class SynchronizeableFloat : public SynchronizeableVar {
 
   public:
-    SynchronizeableFloat( float * ptrIn, float * ptrOut, std::string name, int permission = PERMISSION_SERVER, int priority = 0 );
+    SynchronizeableFloat( float * ptrIn, float * ptrOut, std::string name, int permission = PERMISSION_MASTER_SERVER, int priority = 0 );
     virtual ~SynchronizeableFloat();
-    
+
     virtual int writeToBuf( byte * buf, int maxLength );
     virtual int readFromBuf( byte * buf, int maxLength );
-        
+
     /**
      * check if writeToBuf will return the same size every time
@@ -23,7 +24,7 @@
      */
     virtual bool hasStaticSize(){ return true; };
-    
+
     virtual void debug();
-    
+
   private:
     float * vPtrIn;       //!< pointer to data (read)
Index: trunk/src/lib/network/synchronizeable_var/synchronizeable_int.cc
===================================================================
--- trunk/src/lib/network/synchronizeable_var/synchronizeable_int.cc	(revision 9391)
+++ trunk/src/lib/network/synchronizeable_var/synchronizeable_int.cc	(revision 9406)
@@ -18,4 +18,5 @@
 #include "converter.h"
 
+#include <cassert>
 
 /**
@@ -46,7 +47,7 @@
 {
   int res = Converter::intToByteArray( *vPtrIn, buf, maxLength );
-  
+
   assert( res == INTSIZE );
-  
+
   return res;
 }
@@ -61,13 +62,13 @@
 {
   assert( maxLength >= INTSIZE );
-  
+
   int oldVal = *vPtrOut;
-  
+
   int res = Converter::byteArrayToInt( buf, vPtrOut );
-  
+
   setHasChanged( oldVal != *vPtrOut );
-  
+
   assert( res == INTSIZE );
-  
+
   return res;
 }
Index: trunk/src/lib/network/synchronizeable_var/synchronizeable_int.h
===================================================================
--- trunk/src/lib/network/synchronizeable_var/synchronizeable_int.h	(revision 9391)
+++ trunk/src/lib/network/synchronizeable_var/synchronizeable_int.h	(revision 9406)
@@ -4,18 +4,19 @@
 */
 
-#include "synchronizeable_var/synchronizeable_var.h"
 
 #ifndef _SYNCHRONIZEABLE_INT_H
 #define _SYNCHRONIZEABLE_INT_H
 
+#include "synchronizeable_var.h"
+
 class SynchronizeableInt : public SynchronizeableVar {
 
   public:
-    SynchronizeableInt( int * ptrIn, int * ptrOut, std::string name, int permission = PERMISSION_SERVER, int priority = 0 );
+    SynchronizeableInt( int * ptrIn, int * ptrOut, std::string name, int permission = PERMISSION_MASTER_SERVER, int priority = 0 );
     virtual ~SynchronizeableInt();
-    
+
     virtual int writeToBuf( byte * buf, int maxLength );
     virtual int readFromBuf( byte * buf, int maxLength );
-    
+
     /**
      * check if writeToBuf will return the same size every time
@@ -23,7 +24,7 @@
      */
     virtual bool hasStaticSize(){ return true; };
-    
+
     virtual void debug();
-    
+
   protected:
     int * vPtrIn;       //!< pointer to data (read)
Index: trunk/src/lib/network/synchronizeable_var/synchronizeable_ip.cc
===================================================================
--- trunk/src/lib/network/synchronizeable_var/synchronizeable_ip.cc	(revision 9406)
+++ trunk/src/lib/network/synchronizeable_var/synchronizeable_ip.cc	(revision 9406)
@@ -0,0 +1,108 @@
+/*
+   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: Patrick Boenzli
+*/
+
+
+#include "synchronizeable_ip.h"
+#include "converter.h"
+#include "netdefs.h"
+#include "ip.h"
+#include <cassert>
+
+/**
+ * standard constructor
+ * @todo this constructor is not jet implemented - do it
+*/
+SynchronizeableIP::SynchronizeableIP( IP * ptrIn, IP * ptrOut, std::string name, int permission, int priority) : SynchronizeableVar( ptrIn, ptrOut, name, 2*INTSIZE, permission, priority )
+{
+  this->vPtrIn = ptrIn;
+  this->vPtrOut = ptrOut;
+}
+
+
+/**
+ * standard deconstructor
+*/
+SynchronizeableIP::~SynchronizeableIP ()
+{
+}
+
+/**
+ * write var data to byte buffer
+ * @param buf pointer to write to
+ * @param maxLength writeToBuf will not write more than maxLength bytes
+ * @return number bytes written
+ */
+int SynchronizeableIP::writeToBuf( byte * buf, int maxLength )
+{
+  int n = 0;
+  int res;
+
+  res = Converter::intToByteArray( (int)vPtrIn->host(), buf, maxLength );
+  assert(res > 0);
+  n += res;
+
+
+  res = Converter::intToByteArray( (int)vPtrIn->port(), buf + n, maxLength);
+  assert(res > 0);
+  n += res;
+
+  assert( 2 * INTSIZE == n);
+
+  return n;
+}
+
+/**
+ * read var data from byte buffer
+ * @param buf pointer to read from
+ * @param maxLength readFromBuf will not read more than maxLength bytes
+ * @return number bytes read
+ */
+int SynchronizeableIP::readFromBuf( byte * buf, int maxLength )
+{
+  assert( maxLength >= 2 * INTSIZE);
+
+  int host, port;
+
+  int res;
+  int n = 0;
+
+  IP oldVal = *vPtrOut;
+
+  res = Converter::byteArrayToInt( buf + n, &host);
+  assert( res > 0);
+  n += res;
+
+
+  res = Converter::byteArrayToInt( buf + n, &port);
+  assert( res > 0);
+  n += res;
+
+  *this->vPtrOut = IP(host, port);
+
+  this->setHasChanged( *this->vPtrOut != oldVal);
+
+  assert( n == 2 * INTSIZE);
+
+  return n;
+}
+
+
+/**
+ * print out variable value
+ */
+void SynchronizeableIP::SynchronizeableIP::debug( )
+{
+  printf("SYNCHRONIZEABLE_VAR: %s IN: %i, %i OUT: %i, %i\n", name.c_str(), vPtrIn->host(), vPtrIn->port(), vPtrOut->host(), vPtrOut->port());
+}
+
Index: trunk/src/lib/network/synchronizeable_var/synchronizeable_ip.h
===================================================================
--- trunk/src/lib/network/synchronizeable_var/synchronizeable_ip.h	(revision 9406)
+++ trunk/src/lib/network/synchronizeable_var/synchronizeable_ip.h	(revision 9406)
@@ -0,0 +1,38 @@
+/*!
+ * @file synchronizeable_ip.h
+ * @brief Definition of SynchronizeableIP
+*/
+
+
+#ifndef _SYNCHRONIZEABLE_IP_H
+#define _SYNCHRONIZEABLE_IP_H
+
+#include "synchronizeable_var.h"
+
+class IP;
+
+class SynchronizeableIP : public SynchronizeableVar {
+
+  public:
+    SynchronizeableIP( IP *ptrIn, IP * ptrOut, std::string name, int permission = PERMISSION_MASTER_SERVER, int priority = 0 );
+    virtual ~SynchronizeableIP();
+
+    virtual int writeToBuf( byte * buf, int maxLength );
+    virtual int readFromBuf( byte * buf, int maxLength );
+
+    /**
+     * check if writeToBuf will return the same size every time
+     * @return true if same size every time
+     */
+    virtual bool hasStaticSize(){ return true; }
+
+    virtual void debug();
+
+
+  private:
+    IP * vPtrIn;       //!< pointer to data (read)
+    IP * vPtrOut;      //!< pointer to data (write)
+
+};
+
+#endif /* _PROTO_CLASS_H */
Index: trunk/src/lib/network/synchronizeable_var/synchronizeable_quaternion.cc
===================================================================
--- trunk/src/lib/network/synchronizeable_var/synchronizeable_quaternion.cc	(revision 9391)
+++ trunk/src/lib/network/synchronizeable_var/synchronizeable_quaternion.cc	(revision 9406)
@@ -17,4 +17,5 @@
 #include "synchronizeable_quaternion.h"
 #include "converter.h"
+#include <cassert>
 
 
@@ -98,9 +99,9 @@
   assert( res > 0 );
   n += res;
-  
+
   Quaternion oldVal = *vPtrOut;
 
   *vPtrOut = Quaternion( Vector(x, y, z), w );
-  
+
   setHasChanged( ! ( oldVal == *vPtrOut ) );
 
Index: trunk/src/lib/network/synchronizeable_var/synchronizeable_quaternion.h
===================================================================
--- trunk/src/lib/network/synchronizeable_var/synchronizeable_quaternion.h	(revision 9391)
+++ trunk/src/lib/network/synchronizeable_var/synchronizeable_quaternion.h	(revision 9406)
@@ -4,8 +4,8 @@
 */
 
-#include "synchronizeable_var/synchronizeable_var.h"
-
 #ifndef _SYNCHRONIZEABLE_QUATERNION_H
 #define _SYNCHRONIZEABLE_QUATERNION_H
+
+#include "synchronizeable_var.h"
 
 #include "quaternion.h"
@@ -14,10 +14,10 @@
 
   public:
-    SynchronizeableQuaternion( Quaternion * ptrIn, Quaternion * ptrOut, std::string name, int permission = PERMISSION_SERVER, int priority = 0 );
+    SynchronizeableQuaternion( Quaternion * ptrIn, Quaternion * ptrOut, std::string name, int permission = PERMISSION_MASTER_SERVER, int priority = 0 );
     virtual ~SynchronizeableQuaternion();
-    
+
     virtual int writeToBuf( byte * buf, int maxLength );
     virtual int readFromBuf( byte * buf, int maxLength );
-        
+
     /**
      * check if writeToBuf will return the same size every time
@@ -25,7 +25,7 @@
      */
     virtual bool hasStaticSize(){ return true; };
-    
+
     virtual void debug();
-    
+
   private:
     Quaternion * vPtrIn;       //!< pointer to data (read)
Index: trunk/src/lib/network/synchronizeable_var/synchronizeable_string.cc
===================================================================
--- trunk/src/lib/network/synchronizeable_var/synchronizeable_string.cc	(revision 9391)
+++ trunk/src/lib/network/synchronizeable_var/synchronizeable_string.cc	(revision 9406)
@@ -17,4 +17,5 @@
 #include "synchronizeable_string.h"
 #include "converter.h"
+#include <cassert>
 
 
@@ -46,9 +47,14 @@
 {
   int res = Converter::stringToByteArray( *vPtrIn, buf, maxLength );
-  
+
   assert( res > 0 );
   assert( res == vPtrIn->length()+INTSIZE );
-  
+
   return res;
+}
+
+int SynchronizeableString::getSize()
+{
+   return vPtrIn->length()+INTSIZE;
 }
 
@@ -62,9 +68,9 @@
 {
   std::string oldVal = *vPtrOut;
-      
+
   int res = Converter::byteArrayToString( buf, *vPtrOut, maxLength );
-  
+
   setHasChanged( oldVal != *vPtrOut );
-  
+
   if ( res < 0 )
   {
@@ -72,5 +78,5 @@
   }
   assert( res > 0 );
-  
+
   return res;
 }
@@ -94,9 +100,9 @@
 {
   std::string t;
-  
+
   int res = Converter::byteArrayToString( buf, t, maxLength );
-  
+
   assert( res > 0 );
-  
+
   return res;
 }
Index: trunk/src/lib/network/synchronizeable_var/synchronizeable_string.h
===================================================================
--- trunk/src/lib/network/synchronizeable_var/synchronizeable_string.h	(revision 9391)
+++ trunk/src/lib/network/synchronizeable_var/synchronizeable_string.h	(revision 9406)
@@ -4,9 +4,8 @@
 */
 
-#include "synchronizeable_var/synchronizeable_var.h"
-#include "converter.h"
-
 #ifndef _SYNCHRONIZEABLE_STRING_H
 #define _SYNCHRONIZEABLE_STRING_H
+
+#include "synchronizeable_var.h"
 
 #include <string>
@@ -15,11 +14,11 @@
 
   public:
-    SynchronizeableString( std::string * ptrIn, std::string * ptrOut, std::string name, int permission = PERMISSION_SERVER, int priority = 0 );
+    SynchronizeableString( std::string * ptrIn, std::string * ptrOut, std::string name, int permission = PERMISSION_MASTER_SERVER, int priority = 0 );
     virtual ~SynchronizeableString();
-    
+
     virtual int writeToBuf( byte * buf, int maxLength );
     virtual int readFromBuf( byte * buf, int maxLength );
-    
-        
+
+
     /**
      * check if writeToBuf will return the same size every time
@@ -27,11 +26,11 @@
      */
     virtual bool hasStaticSize(){ return false; };
-    
-    virtual int getSize(){ return vPtrIn->length()+INTSIZE; }
-    
+
+    virtual int getSize();
+
     virtual int getSizeFromBuf( byte * buf, int maxLength );
-    
+
     virtual void debug();
-    
+
   private:
     std::string * vPtrIn;       //!< pointer to data (read)
Index: trunk/src/lib/network/synchronizeable_var/synchronizeable_uint.h
===================================================================
--- trunk/src/lib/network/synchronizeable_var/synchronizeable_uint.h	(revision 9391)
+++ trunk/src/lib/network/synchronizeable_var/synchronizeable_uint.h	(revision 9406)
@@ -4,15 +4,16 @@
 */
 
-#include "synchronizeable_var/synchronizeable_int.h"
 
 #ifndef _SYNCHRONIZEABLE_UINT_H
 #define _SYNCHRONIZEABLE_UINT_H
 
+#include "synchronizeable_int.h"
+
 class SynchronizeableUInt : public SynchronizeableInt {
 
   public:
-    SynchronizeableUInt( unsigned int * ptrIn, unsigned int * ptrOut, std::string name, int permission = PERMISSION_SERVER, int priority = 0 );
+    SynchronizeableUInt( unsigned int * ptrIn, unsigned int * ptrOut, std::string name, int permission = PERMISSION_MASTER_SERVER, int priority = 0 );
     virtual ~SynchronizeableUInt();
-    
+
     virtual void debug();
 
Index: trunk/src/lib/network/synchronizeable_var/synchronizeable_var.cc
===================================================================
--- trunk/src/lib/network/synchronizeable_var/synchronizeable_var.cc	(revision 9391)
+++ trunk/src/lib/network/synchronizeable_var/synchronizeable_var.cc	(revision 9406)
@@ -16,5 +16,6 @@
 
 #include "synchronizeable_var.h"
-
+#include "netdefs.h"
+#include <cassert>
 
 
Index: trunk/src/lib/network/synchronizeable_var/synchronizeable_var.h
===================================================================
--- trunk/src/lib/network/synchronizeable_var/synchronizeable_var.h	(revision 9391)
+++ trunk/src/lib/network/synchronizeable_var/synchronizeable_var.h	(revision 9406)
@@ -7,12 +7,12 @@
 #define _SYNCHRONIZEABLE_VAR_H
 
+#include "nettypes.h"
 #include <string>
-#include "netdefs.h"
-#include <assert.h>
 
 enum {
-  PERMISSION_SERVER = 1,
-  PERMISSION_OWNER  = 2,
-  PERMISSION_ALL    = 4
+  PERMISSION_MASTER_SERVER = 1,
+  PERMISSION_PROXY_SERVER  = 2,
+  PERMISSION_OWNER         = 4,
+  PERMISSION_ALL           = 8
 };
 
@@ -20,5 +20,5 @@
 
   public:
-    SynchronizeableVar( void * ptrIn, void * ptrOut, std::string name, int length, int permission = PERMISSION_SERVER, int priority = 0 );
+    SynchronizeableVar( void * ptrIn, void * ptrOut, std::string name, int length, int permission = PERMISSION_MASTER_SERVER, int priority = 0 );
     virtual ~SynchronizeableVar();
 
@@ -28,6 +28,6 @@
      */
     inline bool beWatched(){ return this->bWatched; }
-    
-    /** 
+
+    /**
      * set flag if synchronizeable wants to be informed on changes
      */
@@ -96,5 +96,5 @@
      */
     inline void resetPriority() { this->priority = this->realPriority; }
-    
+
     /**
      * reads actual size from buffer. this is used when size is not constant
@@ -104,5 +104,5 @@
      */
     virtual inline int getSizeFromBuf( byte * buf, int maxLength ){ return this->getSize(); }
-    
+
     /**
      * set variable id
@@ -110,11 +110,11 @@
      */
     inline void setVarId( int id ){ this->varId = id; }
-    
-    /** 
+
+    /**
      * get variable id
      * @return variable id
      */
     inline int getVarId(){ return varId; }
-    
+
     /**
      * set hasChanged
@@ -122,11 +122,11 @@
      */
     inline void setHasChanged( bool changed ){ this->changed = changed; }
-    
-    /** 
+
+    /**
      * get hasChanged
      * @return variable id
      */
     inline bool getHasChanged(){ return changed; }
-    
+
     /**
      * print out variable value
@@ -137,10 +137,10 @@
   private:
     bool bWatched;      //!< true if synchronizeable wants to be informed on changes
-    
+
     int permission;     //!< who is allowed to change this var
     int priority;       //!< priority assigned to var
     int realPriority;   //!< priority assigned to var, increased every time not sent
     int varId;          //!< id to identify varables
-    
+
     bool changed;       //!< true if last readFromBuf changed anything
 
Index: trunk/src/lib/network/synchronizeable_var/synchronizeable_vector.cc
===================================================================
--- trunk/src/lib/network/synchronizeable_var/synchronizeable_vector.cc	(revision 9391)
+++ trunk/src/lib/network/synchronizeable_var/synchronizeable_vector.cc	(revision 9406)
@@ -17,4 +17,5 @@
 #include "synchronizeable_vector.h"
 #include "converter.h"
+#include <cassert>
 
 
@@ -79,5 +80,5 @@
   int res;
   int n = 0;
-  
+
   Vector oldVec = *vPtrOut;
 
@@ -95,5 +96,5 @@
 
   *vPtrOut = Vector( x, y, z );
-  
+
   setHasChanged( !(*vPtrOut == oldVec) );
 
Index: trunk/src/lib/network/synchronizeable_var/synchronizeable_vector.h
===================================================================
--- trunk/src/lib/network/synchronizeable_var/synchronizeable_vector.h	(revision 9391)
+++ trunk/src/lib/network/synchronizeable_var/synchronizeable_vector.h	(revision 9406)
@@ -4,8 +4,8 @@
 */
 
-#include "synchronizeable_var/synchronizeable_var.h"
-
 #ifndef _SYNCHRONIZEABLE_VECTOR_H
 #define _SYNCHRONIZEABLE_VECTOR_H
+
+#include "synchronizeable_var.h"
 
 #include "vector.h"
@@ -14,10 +14,10 @@
 
   public:
-    SynchronizeableVector( Vector * ptrIn, Vector * ptrOut, std::string name, int permission = PERMISSION_SERVER, int priority = 0 );
+    SynchronizeableVector( Vector * ptrIn, Vector * ptrOut, std::string name, int permission = PERMISSION_MASTER_SERVER, int priority = 0 );
     virtual ~SynchronizeableVector();
-    
+
     virtual int writeToBuf( byte * buf, int maxLength );
     virtual int readFromBuf( byte * buf, int maxLength );
-    
+
     /**
      * check if writeToBuf will return the same size every time
@@ -25,7 +25,7 @@
      */
     virtual bool hasStaticSize(){ return true; }
-    
+
     virtual void debug();
-    
+
   private:
     Vector * vPtrIn;       //!< pointer to data (read)
Index: trunk/src/lib/network/tcp_server_socket.cc
===================================================================
--- trunk/src/lib/network/tcp_server_socket.cc	(revision 9391)
+++ trunk/src/lib/network/tcp_server_socket.cc	(revision 9406)
@@ -136,2 +136,3 @@
   _isListening = false;
 }
+
Index: trunk/src/lib/network/tcp_server_socket.h
===================================================================
--- trunk/src/lib/network/tcp_server_socket.h	(revision 9391)
+++ trunk/src/lib/network/tcp_server_socket.h	(revision 9406)
@@ -28,5 +28,5 @@
     virtual void close();
     virtual void update() {};
-    
+
   private:
     TCPsocket listenSocket;
@@ -36,5 +36,5 @@
 
     void init();
- 
+
 };
 
Index: trunk/src/lib/network/tcp_socket.h
===================================================================
--- trunk/src/lib/network/tcp_socket.h	(revision 9391)
+++ trunk/src/lib/network/tcp_socket.h	(revision 9406)
@@ -1,5 +1,5 @@
 /*!
- * @file network_socket.h
-  *  Main interface for the network module. Manages all the modules
+ * @file tcp_socket.h
+  *  tcp socket network interface
 
 */
@@ -16,5 +16,5 @@
 #define _INCOMING_BUFFER_SIZE 2024000
 #define _OUTGOING_BUFFER_SIZE 2024000
-#define _LOCAL_BUFFER_SIZE 1024
+#define _LOCAL_BUFFER_SIZE 2048
 //sleep if incoming buffer is full
 #define _MSECONDS_SLEEP_FULL_BUFFER 10
@@ -47,6 +47,8 @@
 
     virtual void connectToServer( std::string host, int port );
-    
+
     virtual void disconnectServer();
+    virtual void reconnectToServer( std::string host, int port);
+    virtual void reconnectToServerSoft( std::string host, int port);
 
     virtual bool writePacket(byte * data, int length);
Index: trunk/src/lib/network/udp_socket.cc
===================================================================
--- trunk/src/lib/network/udp_socket.cc	(revision 9391)
+++ trunk/src/lib/network/udp_socket.cc	(revision 9406)
@@ -74,4 +74,5 @@
 {
   this->init();
+  this->ip = ip;
   this->serverSocket = serverSocket;
   this->userId = userId;
@@ -105,11 +106,9 @@
   assert( serverSocket == NULL );
 
-  IPaddress ip;
-  
   this->randomByte = generateNewRandomByte();
 
   PRINTF(0)("connect to server %s on port %d\n", host.c_str(), port);
 
-  if ( SDLNet_ResolveHost( &ip, host.c_str(), port ) != 0 )
+  if ( SDLNet_ResolveHost( &this->ip, host.c_str(), port ) != 0 )
   {
     PRINTF(1)("SDLNet_ResolveHost: %s\n", SDLNet_GetError() );
@@ -126,5 +125,5 @@
   }
 
-  int channel = SDLNet_UDP_Bind(socket, 1, &ip);
+  int channel = SDLNet_UDP_Bind(socket, 1, &this->ip);
   if ( channel == -1 )
   {
@@ -147,5 +146,37 @@
   bOk = false;
   socket = NULL;
-}
+
+  this->ip.host = 0;
+  this->ip.port = 0;
+}
+
+
+/**
+ * reconnects to
+ * @param host new server address
+ * @param port new port number
+ *
+ * this terminates the current connection and starts a new connection to the new server
+ */
+void UdpSocket::reconnectToServer( std::string host, int port)
+{
+  // first disconnect the old server
+  this->disconnectServer();
+
+  // now connect to the new
+  this->connectToServer( host, port);
+}
+
+
+/**
+ * reconnects to
+ * @param host new server address
+ * @param port new port number
+ *
+ * this terminates the current connection and starts a new connection to the new server
+ */
+void UdpSocket::reconnectToServerSoft( std::string host, int port)
+{}
+
 
 /**
@@ -179,5 +210,5 @@
 
     byte udpCmd = 0;
-    
+
     if ( networkPacket.length > 0 )
     {
@@ -189,5 +220,5 @@
     else
       return 0;
-      
+
     if ( !checkRandomByte( networkPacket.data[0] ) )
       return 0;
@@ -198,5 +229,5 @@
       networkPacket.data = NULL;
     }
-    
+
     if ( !checkUdpCmd( udpCmd ) )
       return 0;
@@ -207,5 +238,5 @@
   {
     int numrecv = SDLNet_UDP_Recv( socket, packet);
-    
+
     byte udpCmd = 0;
 
@@ -218,8 +249,8 @@
       else
         return 0;
-            
+
       if ( !checkRandomByte( packet->data[0] ) )
         return 0;
-              
+
       if ( !checkUdpCmd( udpCmd ) )
         return 0;
@@ -283,5 +314,5 @@
     return false;
   }
-  
+
   if ( !this->serverSocket && ( udpCmd & UDPCMD_INVALIDRNDBYTE ) )
   {
@@ -292,5 +323,5 @@
     return false;
   }
-  
+
   return true;
 }
@@ -300,7 +331,7 @@
   srand( SDL_GetTicks() );
   byte res = ( rand() & 0xFC );
-  
+
   PRINTF(0)("generated random byte: %x\n", res);
-  
+
   return res;
 }
Index: trunk/src/lib/network/udp_socket.h
===================================================================
--- trunk/src/lib/network/udp_socket.h	(revision 9391)
+++ trunk/src/lib/network/udp_socket.h	(revision 9406)
@@ -31,25 +31,26 @@
 
     virtual void connectToServer( std::string host, int port );
-    
     virtual void disconnectServer();
 
+    virtual void reconnectToServer( std::string host, int port);
+    virtual void reconnectToServerSoft( std::string host, int port);
+
     virtual bool writePacket(byte * data, int length );
+    virtual int readPacket(byte * data, int maxLength);
 
-    virtual int readPacket(byte * data, int maxLength);
-    
+
   private:
     UdpServerSocket * serverSocket;   //!< will get packets here
     int               userId;         //!< user id used by serverSocket
-    IPaddress         ip;             //!< host,port
     UDPsocket         socket;         //!< socket used to send/recieve
     UDPpacket *       packet;
-    
+
     byte              randomByte;     //!< contains random bytes & 0xFC
-    
+
     bool writeRawPacket( byte * data, int length );
     bool checkUdpCmd( byte udpCmd );
     bool checkRandomByte( byte rndByte );
     byte generateNewRandomByte();
-    
+
     void init();
 
Index: trunk/src/lib/parser/cmdline_parser/cmdline_parser.cc
===================================================================
--- trunk/src/lib/parser/cmdline_parser/cmdline_parser.cc	(revision 9391)
+++ trunk/src/lib/parser/cmdline_parser/cmdline_parser.cc	(revision 9406)
@@ -18,5 +18,5 @@
 #include "src/lib/util/substring.h"
 
-using namespace std;
+
 
 
Index: trunk/src/lib/parser/ini_parser/ini_parser.cc
===================================================================
--- trunk/src/lib/parser/ini_parser/ini_parser.cc	(revision 9391)
+++ trunk/src/lib/parser/ini_parser/ini_parser.cc	(revision 9406)
@@ -35,5 +35,5 @@
 #endif
 
-using namespace std;
+
 
 /**
@@ -142,5 +142,5 @@
       if ( (*lineBegin == '#' || *lineBegin == ';'))
       {
-        string newCommenLine = lineBegin;
+        std::string newCommenLine = lineBegin;
         this->commentList.push_back(newCommenLine);
         continue;
@@ -242,4 +242,5 @@
   }
   fclose(stream);
+  return true;
 }
 
Index: trunk/src/lib/parser/preferences/cmd_line_prefs_reader.cc
===================================================================
--- trunk/src/lib/parser/preferences/cmd_line_prefs_reader.cc	(revision 9391)
+++ trunk/src/lib/parser/preferences/cmd_line_prefs_reader.cc	(revision 9406)
@@ -20,5 +20,5 @@
 #include "preferences.h"
 
-using namespace std;
+
 
 RegistredArgs CmdLinePrefsReader::regArgs;
Index: trunk/src/lib/parser/preferences/ini_file_prefs_reader.cc
===================================================================
--- trunk/src/lib/parser/preferences/ini_file_prefs_reader.cc	(revision 9391)
+++ trunk/src/lib/parser/preferences/ini_file_prefs_reader.cc	(revision 9406)
@@ -18,5 +18,5 @@
 #include "ini_file_prefs_reader.h"
 
-using namespace std;
+
 
 
Index: trunk/src/lib/particles/box_emitter.cc
===================================================================
--- trunk/src/lib/particles/box_emitter.cc	(revision 9391)
+++ trunk/src/lib/particles/box_emitter.cc	(revision 9406)
@@ -25,5 +25,5 @@
 #include "stdlibincl.h"
 
-using namespace std;
+
 
 
Index: trunk/src/lib/particles/dot_emitter.cc
===================================================================
--- trunk/src/lib/particles/dot_emitter.cc	(revision 9391)
+++ trunk/src/lib/particles/dot_emitter.cc	(revision 9406)
@@ -24,5 +24,5 @@
 #include "debug.h"
 
-using namespace std;
+
 
 
Index: trunk/src/lib/particles/dot_particles.cc
===================================================================
--- trunk/src/lib/particles/dot_particles.cc	(revision 9391)
+++ trunk/src/lib/particles/dot_particles.cc	(revision 9406)
@@ -33,5 +33,5 @@
     ->defaultValues("maps/evil-flower.png");
 
-using namespace std;
+
 
 /**
Index: trunk/src/lib/particles/engine/particle_engine.cc
===================================================================
--- trunk/src/lib/particles/engine/particle_engine.cc	(revision 9391)
+++ trunk/src/lib/particles/engine/particle_engine.cc	(revision 9406)
@@ -24,5 +24,5 @@
 #include "util/loading/load_param.h"
 
-using namespace std;
+
 
 /**
Index: trunk/src/lib/particles/model_particles.cc
===================================================================
--- trunk/src/lib/particles/model_particles.cc	(revision 9391)
+++ trunk/src/lib/particles/model_particles.cc	(revision 9406)
@@ -33,5 +33,5 @@
 ->defaultValues("maps/evil-flower.png");
 
-using namespace std;
+
 
 /**
@@ -136,5 +136,5 @@
     }
   else
-    PRINTF(2)("no model loaded onto ParticleSystem-%s\n", this->getName());
+    PRINTF(2)("no model loaded onto ParticleSystem-%s\n", this->getCName());
   glPopAttrib();
 }
Index: trunk/src/lib/particles/particle_emitter.cc
===================================================================
--- trunk/src/lib/particles/particle_emitter.cc	(revision 9391)
+++ trunk/src/lib/particles/particle_emitter.cc	(revision 9406)
@@ -24,5 +24,5 @@
 #include "stdlibincl.h"
 
-using namespace std;
+
 
 /**
@@ -198,5 +198,5 @@
 void ParticleEmitter::debug() const
 {
-  PRINT(0)(" ParticleEmitter %s::%s\n", this->getClassName(), this->getName());
+  PRINT(0)(" ParticleEmitter %s::%s\n", this->getClassCName(), this->getCName());
   PRINT(0)("  EmissionRate: %f, Speed: %f, SpreadAngle: %f\n", this->getEmissionRate(), this->getEmissionVelocity(), this->getSpread());
 }
Index: trunk/src/lib/particles/particle_system.cc
===================================================================
--- trunk/src/lib/particles/particle_system.cc	(revision 9391)
+++ trunk/src/lib/particles/particle_system.cc	(revision 9406)
@@ -32,5 +32,5 @@
 #include <algorithm>
 
-using namespace std;
+
 /**
  *  standard constructor
@@ -139,5 +139,5 @@
       {
         PRINTF(2)("Tried to load an Element of type '%s' that should be a ParticleEmitter onto '%s::%s'.\n",
-                  emitter->getClassName(), this->getClassName(), this->getName());
+                  emitter->getClassCName(), this->getClassCName(), this->getCName());
         delete emitter;
       }
@@ -145,5 +145,5 @@
     else
     {
-      PRINTF(2)("Could not Generate Emitter for system %s::%s (wrong type in XML-format)\n", this->getClassName(), getName());
+      PRINTF(2)("Could not Generate Emitter for system %s::%s (wrong type in XML-format)\n", this->getClassCName(), getCName());
     }
   }
@@ -157,5 +157,5 @@
 {
   this->maxCount = maxCount;
-  PRINTF(4)("MAXCOUNT of %s::%s is %d\n", this->getClassName(), this->getName(),maxCount);
+  PRINTF(4)("MAXCOUNT of %s::%s is %d\n", this->getClassCName(), this->getCName(), maxCount);
 }
 
@@ -170,5 +170,5 @@
   this->lifeSpan = lifeSpan;
   this->randomLifeSpan = randomLifeSpan;
-  PRINTF(4)("LifeTime of %s::%s is %f\n", this->getClassName(), this->getName(), lifeSpan);
+  PRINTF(4)("LifeTime of %s::%s is %f\n", this->getClassCName(), this->getCName(), lifeSpan);
 }
 
@@ -188,5 +188,5 @@
     this->conserve = conserve;
 
-  PRINTF(4)("Conserve of %s::%s is %f\n", this->getClassName(), this->getName(),conserve);
+  PRINTF(4)("Conserve of %s::%s is %f\n", this->getClassCName(), this->getCName(), conserve);
 }
 
@@ -206,5 +206,5 @@
 
   PRINTF(4)("Radius of %s::%s at timeSlice %f is %f with a Random of %f\n",
-    this->getClassName(), this->getName(),lifeCycleTime, radius, randRadius);
+    this->getClassCName(), this->getCName(), lifeCycleTime, radius, randRadius);
 }
 
@@ -237,5 +237,5 @@
 
   PRINTF(4)("Color of %s::%s on timeslice %f is r:%f g:%f b:%f a:%f\n",
-    this->getClassName(), this->getName(), lifeCycleTime, red, green, blue, alpha);
+    this->getClassCName(), this->getCName(), lifeCycleTime, red, green, blue, alpha);
 }
 
@@ -278,5 +278,5 @@
     (*emitter)->updateNode(.1), (*emitter)->updateNode(.1);
 
-  PRINTF(4)("Precaching %s::%s %d seconds %d timesPerSecond\n", this->getClassName(), this->getName(), seconds, ticksPerSecond);
+  PRINTF(4)("Precaching %s::%s %d seconds %d timesPerSecond\n", this->getClassCName(), this->getCName(), seconds, ticksPerSecond);
   for (unsigned int i = 0; i < seconds*ticksPerSecond; i++)
     this->tick(1.0/(float)ticksPerSecond);
@@ -460,5 +460,5 @@
     int i = 1;
     Particle* tmpPart = this->deadList;
-    while (tmpPart = tmpPart->next) { ++i; }
+    while ((tmpPart = tmpPart->next) != NULL) { ++i; }
     PRINT(0)("count: %d\n", i);
   }
Index: trunk/src/lib/particles/plane_emitter.cc
===================================================================
--- trunk/src/lib/particles/plane_emitter.cc	(revision 9391)
+++ trunk/src/lib/particles/plane_emitter.cc	(revision 9406)
@@ -25,5 +25,5 @@
 #include "stdlibincl.h"
 
-using namespace std;
+
 
 
Index: trunk/src/lib/particles/quick_animation.cc
===================================================================
--- trunk/src/lib/particles/quick_animation.cc	(revision 9391)
+++ trunk/src/lib/particles/quick_animation.cc	(revision 9406)
@@ -20,5 +20,5 @@
 #include <algorithm>
 
-using namespace std;
+
 
 /**
Index: trunk/src/lib/particles/spark_particles.cc
===================================================================
--- trunk/src/lib/particles/spark_particles.cc	(revision 9391)
+++ trunk/src/lib/particles/spark_particles.cc	(revision 9406)
@@ -29,5 +29,5 @@
 
 
-using namespace std;
+
 
 CREATE_FACTORY(SparkParticles, CL_SPARK_PARTICLES);
Index: trunk/src/lib/particles/sprite_particles.cc
===================================================================
--- trunk/src/lib/particles/sprite_particles.cc	(revision 9391)
+++ trunk/src/lib/particles/sprite_particles.cc	(revision 9406)
@@ -33,5 +33,5 @@
     ->defaultValues("maps/evil-flower.png");
 
-using namespace std;
+
 
 /**
Index: trunk/src/lib/physics/fields/field.cc
===================================================================
--- trunk/src/lib/physics/fields/field.cc	(revision 9391)
+++ trunk/src/lib/physics/fields/field.cc	(revision 9406)
@@ -22,5 +22,5 @@
 #include "util/loading/factory.h"
 #include "util/loading/load_param.h"
-using namespace std;
+
 
 /**
Index: trunk/src/lib/physics/fields/gravity.cc
===================================================================
--- trunk/src/lib/physics/fields/gravity.cc	(revision 9391)
+++ trunk/src/lib/physics/fields/gravity.cc	(revision 9406)
@@ -21,5 +21,5 @@
 #include "util/loading/factory.h"
 
-using namespace std;
+
 
 CREATE_FACTORY(Gravity, CL_FIELD_GRAVITY);
Index: trunk/src/lib/physics/fields/point_gravity.cc
===================================================================
--- trunk/src/lib/physics/fields/point_gravity.cc	(revision 9391)
+++ trunk/src/lib/physics/fields/point_gravity.cc	(revision 9406)
@@ -18,5 +18,5 @@
 #include "point_gravity.h"
 
-using namespace std;
+
 
 
Index: trunk/src/lib/physics/fields/twirl.cc
===================================================================
--- trunk/src/lib/physics/fields/twirl.cc	(revision 9391)
+++ trunk/src/lib/physics/fields/twirl.cc	(revision 9406)
@@ -18,5 +18,5 @@
 #include "twirl.h"
 
-using namespace std;
+
 
 
Index: trunk/src/lib/physics/physics_connection.cc
===================================================================
--- trunk/src/lib/physics/physics_connection.cc	(revision 9391)
+++ trunk/src/lib/physics/physics_connection.cc	(revision 9406)
@@ -27,5 +27,5 @@
 #include "util/loading/load_param.h"
 
-using namespace std;
+
 
 CREATE_FACTORY(PhysicsConnection, CL_PHYSICS_CONNECTION);
@@ -81,5 +81,5 @@
   }
   else
-    PRINTF(5)("subject::%s\n", this->subject->getName());
+    PRINTF(5)("subject::%s\n", this->subject->getCName());
 }
 
@@ -95,5 +95,5 @@
   }
   else
-    PRINTF(5)("field::%s\n", this->field->getName());
+    PRINTF(5)("field::%s\n", this->field->getCName());
 
 }
Index: trunk/src/lib/physics/physics_engine.cc
===================================================================
--- trunk/src/lib/physics/physics_engine.cc	(revision 9391)
+++ trunk/src/lib/physics/physics_engine.cc	(revision 9406)
@@ -23,5 +23,5 @@
 #include "util/loading/load_param.h"
 
-using namespace std;
+
 
 
@@ -162,5 +162,5 @@
 Field* PhysicsEngine::getFieldByName(const std::string& fieldName) const
 {
-  list<Field*>::const_iterator field;
+  std::list<Field*>::const_iterator field;
   for (field = this->fields.begin(); field != this->fields.end(); field++)
     if (fieldName == (*field)->getName())
@@ -199,5 +199,5 @@
 PhysicsConnection* PhysicsEngine::getPhysicsConnectionByName(const std::string& physicsConnectionName) const
 {
-  list<PhysicsConnection*>::const_iterator pc;
+  std::list<PhysicsConnection*>::const_iterator pc;
   for (pc = this->connections.begin(); pc != this->connections.end(); pc++)
     if (physicsConnectionName == (*pc)->getName())
@@ -218,5 +218,5 @@
   /* go through all the PhysicsInterface(s) and tick them,
   meaning let the fields work */
-  list<PhysicsConnection*>::iterator pc;
+  std::list<PhysicsConnection*>::iterator pc;
   for (pc = this->connections.begin(); pc != this->connections.end(); pc++)
     (*pc)->apply();
@@ -225,5 +225,5 @@
   if (this->interfaces != NULL || (this->interfaces = ClassList::getList(CL_PHYSICS_INTERFACE)) != NULL)
   {
-    list<BaseObject*>::const_iterator tickPhys;
+    std::list<BaseObject*>::const_iterator tickPhys;
     for (tickPhys = this->interfaces->begin(); tickPhys != this->interfaces->end(); tickPhys++)
       dynamic_cast<PhysicsInterface*>(*tickPhys)->tickPhys(dt);
Index: trunk/src/lib/physics/physics_interface.cc
===================================================================
--- trunk/src/lib/physics/physics_interface.cc	(revision 9391)
+++ trunk/src/lib/physics/physics_interface.cc	(revision 9406)
@@ -29,5 +29,5 @@
 #include "stdincl.h"
 
-using namespace std;
+
 
 
@@ -68,5 +68,5 @@
     {
     // todo: find out if children are PhysicsInterface in an efficient way
-    if (strcmp( pn->getClassName(), "PhysicsInterface")) {
+    if (strcmp( pn->getClassCName(), "PhysicsInterface")) {
     massSum += ((PhysicsInterface*)pn)->getTotalMass();
     }
@@ -77,5 +77,5 @@
     if (massSum != this->massChildren ) {
     this->massChildren = massSum;
-    if (strcmp( massCalcPNode->parent->getClassName(), "PhysicsInterface"))
+    if (strcmp( massCalcPNode->parent->getClassCName(), "PhysicsInterface"))
     ((PhysicsInterface*)massCalcPNode->parent)->recalcMass();
     } else {
Index: trunk/src/lib/shell/shell_command.cc
===================================================================
--- trunk/src/lib/shell/shell_command.cc	(revision 9391)
+++ trunk/src/lib/shell/shell_command.cc	(revision 9406)
@@ -119,7 +119,9 @@
 
     CmdList::const_iterator elem;
-    for (elem = cmdClass->commandList.begin(); elem != cmdClass->commandList.end(); elem++)
-      if (commandName == (*elem)->getName())
-        return (*elem);
+    for (unsigned int i = 0; i < cmdClass->commandList.size(); i++)
+    {
+      if (commandName == cmdClass->commandList[i]->getName())
+        return (cmdClass->commandList[i]);
+    }
     return NULL;
   }
@@ -137,5 +139,6 @@
     if (likely(checkClass != NULL))
       return ShellCommand::getCommand(commandName, checkClass);
-    return NULL;
+    else
+      return NULL;
   }
 
@@ -149,5 +152,5 @@
   const ShellCommand* const ShellCommand::getCommandFromInput(const std::string& inputLine, unsigned int& paramBegin, std::vector<BaseObject*>* boList)
   {
-    return ShellCommand::getCommandFromInput(SubString(inputLine, SubString::WhiteSpaces), paramBegin);
+    return ShellCommand::getCommandFromInput(SubString(inputLine, SubString::WhiteSpaces), paramBegin, boList);
   }
 
@@ -199,5 +202,5 @@
       {
         // Search for Objects.
-        retCmd = ShellCommand::getCommand(strings[1], cmdClass);
+        retCmd = ShellCommand::getCommand((strings.size() > 1) ? strings[1] : "", cmdClass);
         if (retCmd != NULL)
         {
@@ -210,5 +213,5 @@
       if (retCmd == NULL && strings.size() >= 2)
       {
-        retCmd = ShellCommand::getCommand(strings[2], cmdClass);
+        retCmd = ShellCommand::getCommand((strings.size() > 2) ? strings[2] : "", cmdClass);
         if (retCmd != NULL)
         {
@@ -254,5 +257,5 @@
       {
         for (bo = objectList->begin(); bo != objectList->end(); bo++)
-          if ((*bo)->getName() != NULL && !nocaseCmp(objectDescriptor, (*bo)->getName(), objectDescriptor.size()))
+          if (!nocaseCmp(objectDescriptor, (*bo)->getName(), objectDescriptor.size()))
             boList->push_back(*bo);
       }
@@ -298,6 +301,6 @@
       for(std::vector<BaseObject*>::const_iterator bo = boList.begin(); bo != boList.end(); ++bo)
       {
-        PRINT(0)("Command '%s' on '%s::%s'\n", sc->getName(), (*bo)->getClassName(), (*bo)->getName());
-        (*sc->executor)((*bo), inputSplits.getSubSet(paramBegin));
+        PRINT(0)("Command '%s' on '%s::%s'\n", sc->getCName(), (*bo)->getClassCName(), (*bo)->getCName());
+        (*sc->executor)((*bo), inputSplits.subSet(paramBegin));
       }
       return true;
@@ -331,5 +334,5 @@
     if (this->alias != NULL)
     {
-      PRINTF(2)("not more than one Alias allowed for functions (%s::%s)\n", this->getName(), this->shellClass->getName());
+      PRINTF(2)("not more than one Alias allowed for functions (%s::%s)\n", this->getCName(), this->shellClass->getCName());
     }
     else
@@ -369,5 +372,5 @@
     {
       PRINTF(1)("Parameter %d not inside of valid ParameterCount %d of Command %s::%s\n",
-                parameter, this->executor->getParamCount(), this->getName(), this->shellClass->getName());
+                parameter, this->executor->getParamCount(), this->getCName(), this->shellClass->getCName());
     }
     else
@@ -375,5 +378,5 @@
 //       if(this->completors[parameter] == NULL)
 //       delete this->completors[parameter];
-//       this->completors[parameter] = completorPlugin.clone(); 
+//       this->completors[parameter] = completorPlugin.clone();
     }
     return this;
@@ -385,5 +388,5 @@
   void ShellCommand::help() const
   {
-    PRINT(0)("%s ", this->getName());
+    PRINT(0)("%s ", this->getCName());
   }
 
Index: trunk/src/lib/shell/shell_command_class.cc
===================================================================
--- trunk/src/lib/shell/shell_command_class.cc	(revision 9391)
+++ trunk/src/lib/shell/shell_command_class.cc	(revision 9406)
@@ -199,5 +199,5 @@
         for (cmdIT = (*classIT)->commandList.begin(); cmdIT != (*classIT)->commandList.end(); cmdIT++)
         {
-          PRINT(0)("  command:'%s' : params:%d: ", (*cmdIT)->getName(), (*cmdIT)->executor->getParamCount());
+          PRINT(0)("  command:'%s' : params:%d: ", (*cmdIT)->getCName(), (*cmdIT)->executor->getParamCount());
           /// FIXME
           /*          for (unsigned int i = 0; i< elem->paramCount; i++)
Index: trunk/src/lib/shell/shell_completion.cc
===================================================================
--- trunk/src/lib/shell/shell_completion.cc	(revision 9391)
+++ trunk/src/lib/shell/shell_completion.cc	(revision 9406)
@@ -290,6 +290,5 @@
     for(bo = inputList.begin(); bo != inputList.end(); bo++)
     {
-      if ((*bo)->getName() != NULL &&
-          strlen((*bo)->getName()) >= searchLength &&
+      if ((*bo)->getName().size() >= searchLength &&
           !nocaseCmp((*bo)->getName(), completionBegin, searchLength))
       {
Index: trunk/src/lib/sound/ogg_player.cc
===================================================================
--- trunk/src/lib/sound/ogg_player.cc	(revision 9391)
+++ trunk/src/lib/sound/ogg_player.cc	(revision 9406)
@@ -481,5 +481,5 @@
     if (comment == NULL)
     {
-      PRINTF(2)("Retrieving Comment of %s failed\n", this->getName());
+      PRINTF(2)("Retrieving Comment of %s failed\n", this->getCName());
       return;
     }
Index: trunk/src/lib/util/Makefile.am
===================================================================
--- trunk/src/lib/util/Makefile.am	(revision 9391)
+++ trunk/src/lib/util/Makefile.am	(revision 9406)
@@ -6,5 +6,4 @@
 libORXlibutil_a_SOURCES = \
 		substring.cc \
-		tokenizer.cc \
 		color.cc \
 		helper_functions.cc \
@@ -24,4 +23,5 @@
 		filesys/file.cc \
 		filesys/directory.cc \
+		filesys/net_link.cc \
 		\
 		preferences.cc \
@@ -32,5 +32,4 @@
 noinst_HEADERS = \
 		substring.h \
-		tokenizer.h \
 		multi_type.h \
 		color.h \
@@ -44,4 +43,5 @@
 		filesys/file.h \
 		filesys/directory.h \
+		filesys/net_link.h \
 		\
 		preferences.h \
Index: trunk/src/lib/util/executor/executor_functional.h
===================================================================
--- trunk/src/lib/util/executor/executor_functional.h	(revision 9391)
+++ trunk/src/lib/util/executor/executor_functional.h	(revision 9406)
@@ -179,5 +179,5 @@
   {
     (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-      fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) );
+      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])));
   };
 
@@ -222,6 +222,6 @@
   {
     (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-      fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)),
-      fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)));
+      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),
+      (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])));
   };
 
@@ -276,7 +276,7 @@
   {
     (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-      fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)),
-      fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)),
-      fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)));
+      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),
+      (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])),
+      (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2])));
   };
 
@@ -333,8 +333,8 @@
   {
     (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-      fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)),
-      fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)),
-      fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)),
-      fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)));
+      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),
+      (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])),
+      (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2])),
+      (sub.size() > 3) ? fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)) : (fromMulti<type3>(this->defaultValue[3])));
   };
 
@@ -392,9 +392,9 @@
   {
     (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-      fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)),
-      fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)),
-      fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)),
-      fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)),
-      fromString<type4>(sub[4], getDefault<type4>(this->defaultValue, 4)));
+      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),
+      (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])),
+      (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2])),
+      (sub.size() > 3) ? fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)) : (fromMulti<type3>(this->defaultValue[3])),
+      (sub.size() > 4) ? fromString<type4>(sub[4], getDefault<type4>(this->defaultValue, 4)) : (fromMulti<type4>(this->defaultValue[4])));
   };
 
Index: trunk/src/lib/util/executor/functor_list.h
===================================================================
--- trunk/src/lib/util/executor/functor_list.h	(revision 9391)
+++ trunk/src/lib/util/executor/functor_list.h	(revision 9406)
@@ -135,4 +135,5 @@
 
   //! mixed values:
+  FUNCTOR_LIST(2)(l_STRING, l_INT);
   FUNCTOR_LIST(2)(l_STRING, l_FLOAT);
   FUNCTOR_LIST(2)(l_UINT, l_LONG);
Index: trunk/src/lib/util/filesys/net_link.cc
===================================================================
--- trunk/src/lib/util/filesys/net_link.cc	(revision 9406)
+++ trunk/src/lib/util/filesys/net_link.cc	(revision 9406)
@@ -0,0 +1,83 @@
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#include "net_link.h"
+#include "debug.h"
+
+
+#ifdef __OSX__
+#include <ApplicationServices/ApplicationServices.h>
+#elif defined __WIN32__
+//#include <shellapi.h>
+#endif
+
+
+NetLink::NetLink(const std::string& linkName)
+{
+  this->_link = linkName;
+}
+
+
+void NetLink::openInBrowser() const
+{
+  SDL_CreateThread(NetLink::openupInBrowser, (void*)&this->_link);
+}
+
+OrxThread::Mutex NetLink::_mutex;
+std::string NetLink::_defaultBrowser = "firefox";
+std::list<std::string> NetLink::_browserList = NetLink::buildBrowserList();
+
+
+
+
+int NetLink::openupInBrowser(void* url)
+{
+  OrxThread::MutexLock lock(&NetLink::_mutex);
+
+  std::string URL = *(std::string*)url;
+#ifdef __linux__
+  system ((std::string(NetLink::defaultBrowser()) + " " + URL).c_str());
+
+#elif defined __OSX__
+  CFURLRef url_handle = CFURLCreateWithBytes (NULL, (UInt8 *)URL.c_str(), URL.size(),
+                                              kCFStringEncodingASCII, NULL);
+  LSOpenCFURLRef (url_handle, NULL);
+  CFRelease (url_handle);
+
+#elif defined __WIN32__
+  /*  ShellExecute(GetActiveWindow(),
+               "open", URL.c_str(), NULL, NULL, SW_SHOWNORMAL);
+}*/
+#endif
+  PRINTF(3)("loaded external webpage %s\n", URL.c_str());
+
+  return 0;
+}
+
+void NetLink::setDefaultBrowser(const std::string& browserName)
+{
+  OrxThread::MutexLock lock(&NetLink::_mutex);
+  NetLink::_defaultBrowser = browserName;
+}
+
+std::list<std::string> NetLink::buildBrowserList()
+{
+  std::list<std::string> browserList;
+  browserList.push_back("firefox");
+  browserList.push_back("mozilla");
+  browserList.push_back("konqueror");
+
+  return  browserList;
+}
Index: trunk/src/lib/util/filesys/net_link.h
===================================================================
--- trunk/src/lib/util/filesys/net_link.h	(revision 9406)
+++ trunk/src/lib/util/filesys/net_link.h	(revision 9406)
@@ -0,0 +1,53 @@
+/*!
+ * @file net_link.h
+ * @brief Definition of a NetLink class
+ * NetLink is a File link to a page of file link to the Internet,
+ * or the local file-system
+ *
+ * Opening a link should be made easy through this class
+ *
+ * !! DANGER IT IS POSSIBLE TO EXECUTE ALL PROGRAMMS WITH USER'S RIGHTS
+ * !! ON THE DESIGNATED MACHINE
+ * !! THIS CLASS SHOULD BE USED WITH CAUTION WHEN USING OVER IN NETWORK
+ * !! MODE
+ */
+
+#ifndef __NET_LINK_H__
+#define __NET_LINK_H__
+
+#include <string>
+#include <list>
+
+#include "threading.h"
+
+//! NetLink is a File and Link executer for Internet Links
+/**
+ * @example: NetLink("http://www.orxonox.net").openInBrowser();
+ */
+class NetLink
+{
+public:
+  NetLink(const std::string& linkName);
+
+  void openInBrowser() const;
+
+  static void setDefaultBrowser(const std::string& browserName);
+  static const std::string& defaultBrowser() {  return NetLink::_defaultBrowser; };
+
+private:
+  static int openupInBrowser(void* url);
+
+  static std::list<std::string> buildBrowserList();
+
+
+private:
+  std::string                     _link;             //!< Linkname
+
+
+  // static lists.
+  static OrxThread::Mutex         _mutex;            //!< One mutex to lock them all.
+  static std::string              _defaultBrowser;   //!< The default Browser.
+  static std::list<std::string>   _browserList;
+};
+
+#endif /** __NET_LINK_H__ */
Index: trunk/src/lib/util/helper_functions.cc
===================================================================
--- trunk/src/lib/util/helper_functions.cc	(revision 9391)
+++ trunk/src/lib/util/helper_functions.cc	(revision 9406)
@@ -19,5 +19,5 @@
 #include "stdlibincl.h"
 
-using namespace std;
+
 
 /**
Index: trunk/src/lib/util/loading/dynamic_loader.cc
===================================================================
--- trunk/src/lib/util/loading/dynamic_loader.cc	(revision 9391)
+++ trunk/src/lib/util/loading/dynamic_loader.cc	(revision 9406)
@@ -23,5 +23,5 @@
 
 
-using namespace std;
+
 
 
Index: trunk/src/lib/util/loading/factory.cc
===================================================================
--- trunk/src/lib/util/loading/factory.cc	(revision 9391)
+++ trunk/src/lib/util/loading/factory.cc	(revision 9406)
@@ -19,5 +19,5 @@
 //#include "shell_command.h"
 
-using namespace std;
+
 
 //SHELL_COMMAND(create, Factory, fabricate);
@@ -117,5 +117,5 @@
   if (factory != Factory::factoryList->end())
   {
-    PRINTF(2)("Create a new Object of type %s\n", (*factory)->getName());
+    PRINTF(2)("Create a new Object of type %s\n", (*factory)->getCName());
     return (*factory)->fabricateObject(root);
   }
@@ -145,5 +145,5 @@
   if (factory != Factory::factoryList->end())
   {
-    PRINTF(4)("Create a new Object of type %s\n", (*factory)->getName());
+    PRINTF(4)("Create a new Object of type %s\n", (*factory)->getCName());
     return (*factory)->fabricateObject(NULL);
   }
@@ -173,5 +173,5 @@
   if (factory != Factory::factoryList->end())
   {
-    PRINTF(4)("Create a new Object of type %s\n", (*factory)->getName());
+    PRINTF(4)("Create a new Object of type %s\n", (*factory)->getCName());
     return (*factory)->fabricateObject(NULL);
   }
Index: trunk/src/lib/util/loading/load_param.cc
===================================================================
--- trunk/src/lib/util/loading/load_param.cc	(revision 9391)
+++ trunk/src/lib/util/loading/load_param.cc	(revision 9406)
@@ -65,5 +65,5 @@
           ((this->executor->getType() & Executor_NoLoadString) == Executor_NoLoadString)))
     {
-      PRINTF(4)("Loading value '%s' with Parameters '%s' onto: %s::%s\n", this->paramName.c_str(), loadString.c_str(), this->object->getClassName(), this->object->getName());
+      PRINTF(4)("Loading value '%s' with Parameters '%s' onto: %s::%s\n", this->paramName.c_str(), loadString.c_str(), this->object->getClassCName(), this->object->getCName());
       (*this->executor)(this->object, SubString(loadString, ",", SubString::WhiteSpaces, false, '\\'));
     }
@@ -164,5 +164,5 @@
 {
     // locating the class
-    this->classDesc = LoadClassDescription::addClass(object->getClassName());
+    this->classDesc = LoadClassDescription::addClass(object->getClassCName());
 
     if ((this->paramDesc = this->classDesc->addParam(paramName)) != NULL)
Index: trunk/src/lib/util/loading/resource.cc
===================================================================
--- trunk/src/lib/util/loading/resource.cc	(revision 9391)
+++ trunk/src/lib/util/loading/resource.cc	(revision 9406)
@@ -18,5 +18,5 @@
 #include "resource.h"
 
-using namespace std;
+
 
 
Index: trunk/src/lib/util/loading/resource_manager.cc
===================================================================
--- trunk/src/lib/util/loading/resource_manager.cc	(revision 9391)
+++ trunk/src/lib/util/loading/resource_manager.cc	(revision 9406)
@@ -50,5 +50,5 @@
 #include <unistd.h>
 
-using namespace std;
+
 
 /**
Index: trunk/src/lib/util/multi_type.cc
===================================================================
--- trunk/src/lib/util/multi_type.cc	(revision 9391)
+++ trunk/src/lib/util/multi_type.cc	(revision 9406)
@@ -18,9 +18,4 @@
 #include "multi_type.h"
 
-//#include "stdincl.h"
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
 #include <sstream>
 
@@ -28,6 +23,4 @@
 #include "debug.h"
 #endif
-
-using namespace std;
 
 /**
Index: trunk/src/lib/util/sigslot/signal.h
===================================================================
--- trunk/src/lib/util/sigslot/signal.h	(revision 9406)
+++ trunk/src/lib/util/sigslot/signal.h	(revision 9406)
@@ -0,0 +1,2220 @@
+/**
+ * @file signal.h
+ * @adaption from the beautiful sigslot implementation of sarah Thompson
+ */
+
+// sigslot.h: Signal/Slot classes
+//
+// Written by Sarah Thompson (sarah@telergy.com) 2002.
+//
+// License: Public domain. You are free to use this code however you like, with the proviso that
+//          the author takes on no responsibility or liability for any use.
+//
+// QUICK DOCUMENTATION
+//
+//        (see also the full documentation at http://sigslot.sourceforge.net/)
+//
+// #define switches
+//     SIGSLOT_PURE_ISO                   - Define this to force ISO C++ compliance. This also disables
+//                                         all of the thread safety support on platforms where it is
+//                                         available.
+//
+//     SIGSLOT_USE_POSIX_THREADS          - Force use of Posix threads when using a C++ compiler other than
+//                                          gcc on a platform that supports Posix threads. (When using gcc,
+//                                          this is the default - use SIGSLOT_PURE_ISO to disable this if
+//                                          necessary)
+//
+//     SIGSLOT_DEFAULT_MT_POLICY          - Where thread support is enabled, this defaults to multi_threaded_global.
+//                                          Otherwise, the default is single_threaded. #define this yourself to
+//                                          override the default. In pure ISO mode, anything other than
+//                                          single_threaded will cause a compiler error.
+//
+// PLATFORM NOTES
+//
+//     Win32                              - On Win32, the WIN32 symbol must be #defined. Most mainstream
+//                                          compilers do this by default, but you may need to define it
+//                                          yourself if your build environment is less standard. This causes
+//                                          the Win32 thread support to be compiled in and used automatically.
+//
+//     Unix/Linux/BSD, etc.                - If you're using gcc, it is assumed that you have Posix threads
+//                                          available, so they are used automatically. You can override this
+//                                          (as under Windows) with the SIGSLOT_PURE_ISO switch. If you're using
+//                                          something other than gcc but still want to use Posix threads, you
+//                                          need to #define SIGSLOT_USE_POSIX_THREADS.
+//
+//     ISO C++                            - If none of the supported platforms are detected, or if
+//                                          SIGSLOT_PURE_ISO is defined, all multithreading support is turned off,
+//                                          along with any code that might cause a pure ISO C++ environment to
+//                                          complain. Before you ask, gcc -ansi -pedantic won't compile this
+//                                          library, but gcc -ansi is fine. Pedantic mode seems to throw a lot of
+//                                          errors that aren't really there. If you feel like investigating this,
+//                                          please contact the author.
+//
+//
+// THREADING MODES
+//
+//     single_threaded                    - Your program is assumed to be single threaded from the point of view
+//                                          of signal/slot usage (i.e. all objects using signals and slots are
+//                                          created and destroyed from a single thread). Behaviour if objects are
+//                                          destroyed concurrently is undefined (i.e. you'll get the occasional
+//                                          segmentation fault/memory exception).
+//
+//     multi_threaded_global              - Your program is assumed to be multi threaded. Objects using signals and
+//                                          slots can be safely created and destroyed from any thread, even when
+//                                          connections exist. In multi_threaded_global mode, this is achieved by a
+//                                          single global mutex (actually a critical section on Windows because they
+//                                          are faster). This option uses less OS resources, but results in more
+//                                          opportunities for contention, possibly resulting in more context switches
+//                                          than are strictly necessary.
+//
+//     multi_threaded_local               - Behaviour in this mode is essentially the same as multi_threaded_global,
+//                                          except that each signal, and each object that inherits has_slots, all
+//                                          have their own mutex/critical section. In practice, this means that
+//                                          mutex collisions (and hence context switches) only happen if they are
+//                                          absolutely essential. However, on some platforms, creating a lot of
+//                                          mutexes can slow down the whole OS, so use this option with care.
+//
+// USING THE LIBRARY
+//
+//        See the full documentation at http://sigslot.sourceforge.net/
+//
+//
+
+#ifndef SIGNAL_H__
+#define SIGNAL_H__
+
+#include <set>
+#include <list>
+
+#include "slot.h"
+
+
+namespace sigslot
+{
+  template<class mt_policy>
+  class _connection_base0
+  {
+  public:
+    virtual has_slots<mt_policy>* getdest() const = 0;
+    virtual void emit() = 0;
+    virtual _connection_base0* clone() = 0;
+    virtual _connection_base0* duplicate(has_slots<mt_policy>* pnewdest) = 0;
+  };
+
+  template<class arg1_type, class mt_policy>
+  class _connection_base1
+  {
+  public:
+    virtual has_slots<mt_policy>* getdest() const = 0;
+    virtual void emit(arg1_type) = 0;
+    virtual _connection_base1<arg1_type, mt_policy>* clone() = 0;
+    virtual _connection_base1<arg1_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) = 0;
+  };
+
+  template<class arg1_type, class arg2_type, class mt_policy>
+  class _connection_base2
+  {
+  public:
+    virtual has_slots<mt_policy>* getdest() const = 0;
+    virtual void emit(arg1_type, arg2_type) = 0;
+    virtual _connection_base2<arg1_type, arg2_type, mt_policy>* clone() = 0;
+    virtual _connection_base2<arg1_type, arg2_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) = 0;
+  };
+
+  template<class arg1_type, class arg2_type, class arg3_type, class mt_policy>
+  class _connection_base3
+  {
+  public:
+    virtual has_slots<mt_policy>* getdest() const = 0;
+    virtual void emit(arg1_type, arg2_type, arg3_type) = 0;
+    virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>* clone() = 0;
+    virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) = 0;
+  };
+
+  template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, class mt_policy>
+  class _connection_base4
+  {
+  public:
+    virtual has_slots<mt_policy>* getdest() const = 0;
+    virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type) = 0;
+    virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* clone() = 0;
+    virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) = 0;
+  };
+
+  template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
+  class arg5_type, class mt_policy>
+  class _connection_base5
+  {
+  public:
+    virtual has_slots<mt_policy>* getdest() const = 0;
+    virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type,
+                      arg5_type) = 0;
+    virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type,
+    arg5_type, mt_policy>* clone() = 0;
+    virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type,
+    arg5_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) = 0;
+  };
+
+  template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
+  class arg5_type, class arg6_type, class mt_policy>
+  class _connection_base6
+  {
+  public:
+    virtual has_slots<mt_policy>* getdest() const = 0;
+    virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
+                      arg6_type) = 0;
+    virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type,
+    arg5_type, arg6_type, mt_policy>* clone() = 0;
+    virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type,
+    arg5_type, arg6_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) = 0;
+  };
+
+  template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
+  class arg5_type, class arg6_type, class arg7_type, class mt_policy>
+  class _connection_base7
+  {
+  public:
+    virtual has_slots<mt_policy>* getdest() const = 0;
+    virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
+                      arg6_type, arg7_type) = 0;
+    virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type,
+    arg5_type, arg6_type, arg7_type, mt_policy>* clone() = 0;
+    virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type,
+    arg5_type, arg6_type, arg7_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) = 0;
+  };
+
+  template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
+  class arg5_type, class arg6_type, class arg7_type, class arg8_type, class mt_policy>
+  class _connection_base8
+  {
+  public:
+    virtual has_slots<mt_policy>* getdest() const = 0;
+    virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
+                      arg6_type, arg7_type, arg8_type) = 0;
+    virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type,
+    arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* clone() = 0;
+    virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type,
+    arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) = 0;
+  };
+
+  template<class mt_policy>
+  class _signal_base0 : public _signal_base<mt_policy>
+  {
+  public:
+    typedef std::list<_connection_base0<mt_policy> *>  connections_list;
+
+    _signal_base0()
+    {
+      ;
+    }
+
+    _signal_base0(const _signal_base0& s)
+        : _signal_base<mt_policy>(s)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::const_iterator it = s.m_connected_slots.begin();
+      typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        (*it)->getdest()->signal_connect(this);
+        m_connected_slots.push_back((*it)->clone());
+
+        ++it;
+      }
+    }
+
+    ~_signal_base0()
+    {
+      disconnect_all();
+    }
+
+    void disconnect_all()
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::const_iterator it = m_connected_slots.begin();
+      typename connections_list::const_iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        (*it)->getdest()->signal_disconnect(this);
+        delete *it;
+
+        ++it;
+      }
+
+      m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
+    }
+
+    void disconnect(has_slots<mt_policy>* pclass)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        if((*it)->getdest() == pclass)
+        {
+          delete *it;
+          m_connected_slots.erase(it);
+          pclass->signal_disconnect(this);
+          return;
+        }
+
+        ++it;
+      }
+    }
+
+    void slot_disconnect(has_slots<mt_policy>* pslot)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        typename connections_list::iterator itNext = it;
+        ++itNext;
+
+        if((*it)->getdest() == pslot)
+        {
+          m_connected_slots.erase(it);
+          //                        delete *it;
+        }
+
+        it = itNext;
+      }
+    }
+
+    void slot_duplicate(const has_slots<mt_policy>* oldtarget, has_slots<mt_policy>* newtarget)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        if((*it)->getdest() == oldtarget)
+        {
+          m_connected_slots.push_back((*it)->duplicate(newtarget));
+        }
+
+        ++it;
+      }
+    }
+
+  protected:
+    connections_list m_connected_slots;
+  };
+
+  template<class arg1_type, class mt_policy>
+  class _signal_base1 : public _signal_base<mt_policy>
+  {
+  public:
+    typedef std::list<_connection_base1<arg1_type, mt_policy> *>  connections_list;
+
+    _signal_base1()
+    {
+      ;
+    }
+
+    _signal_base1(const _signal_base1<arg1_type, mt_policy>& s)
+        : _signal_base<mt_policy>(s)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::const_iterator it = s.m_connected_slots.begin();
+      typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        (*it)->getdest()->signal_connect(this);
+        m_connected_slots.push_back((*it)->clone());
+
+        ++it;
+      }
+    }
+
+    void slot_duplicate(const has_slots<mt_policy>* oldtarget, has_slots<mt_policy>* newtarget)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        if((*it)->getdest() == oldtarget)
+        {
+          m_connected_slots.push_back((*it)->duplicate(newtarget));
+        }
+
+        ++it;
+      }
+    }
+
+    ~_signal_base1()
+    {
+      disconnect_all();
+    }
+
+    void disconnect_all()
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::const_iterator it = m_connected_slots.begin();
+      typename connections_list::const_iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        (*it)->getdest()->signal_disconnect(this);
+        delete *it;
+
+        ++it;
+      }
+
+      m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
+    }
+
+    void disconnect(has_slots<mt_policy>* pclass)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        if((*it)->getdest() == pclass)
+        {
+          delete *it;
+          m_connected_slots.erase(it);
+          pclass->signal_disconnect(this);
+          return;
+        }
+
+        ++it;
+      }
+    }
+
+    void slot_disconnect(has_slots<mt_policy>* pslot)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        typename connections_list::iterator itNext = it;
+        ++itNext;
+
+        if((*it)->getdest() == pslot)
+        {
+          m_connected_slots.erase(it);
+          //                        delete *it;
+        }
+
+        it = itNext;
+      }
+    }
+
+
+  protected:
+    connections_list m_connected_slots;
+  };
+
+  template<class arg1_type, class arg2_type, class mt_policy>
+  class _signal_base2 : public _signal_base<mt_policy>
+  {
+  public:
+    typedef std::list<_connection_base2<arg1_type, arg2_type, mt_policy> *>
+    connections_list;
+
+    _signal_base2()
+    {
+      ;
+    }
+
+    _signal_base2(const _signal_base2<arg1_type, arg2_type, mt_policy>& s)
+        : _signal_base<mt_policy>(s)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::const_iterator it = s.m_connected_slots.begin();
+      typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        (*it)->getdest()->signal_connect(this);
+        m_connected_slots.push_back((*it)->clone());
+
+        ++it;
+      }
+    }
+
+    void slot_duplicate(const has_slots<mt_policy>* oldtarget, has_slots<mt_policy>* newtarget)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        if((*it)->getdest() == oldtarget)
+        {
+          m_connected_slots.push_back((*it)->duplicate(newtarget));
+        }
+
+        ++it;
+      }
+    }
+
+    ~_signal_base2()
+    {
+      disconnect_all();
+    }
+
+    void disconnect_all()
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::const_iterator it = m_connected_slots.begin();
+      typename connections_list::const_iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        (*it)->getdest()->signal_disconnect(this);
+        delete *it;
+
+        ++it;
+      }
+
+      m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
+    }
+
+    void disconnect(has_slots<mt_policy>* pclass)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        if((*it)->getdest() == pclass)
+        {
+          delete *it;
+          m_connected_slots.erase(it);
+          pclass->signal_disconnect(this);
+          return;
+        }
+
+        ++it;
+      }
+    }
+
+    void slot_disconnect(has_slots<mt_policy>* pslot)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        typename connections_list::iterator itNext = it;
+        ++itNext;
+
+        if((*it)->getdest() == pslot)
+        {
+          m_connected_slots.erase(it);
+          //                        delete *it;
+        }
+
+        it = itNext;
+      }
+    }
+
+  protected:
+    connections_list m_connected_slots;
+  };
+
+  template<class arg1_type, class arg2_type, class arg3_type, class mt_policy>
+  class _signal_base3 : public _signal_base<mt_policy>
+  {
+  public:
+    typedef std::list<_connection_base3<arg1_type, arg2_type, arg3_type, mt_policy> *>
+    connections_list;
+
+    _signal_base3()
+    {
+      ;
+    }
+
+    _signal_base3(const _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy>& s)
+        : _signal_base<mt_policy>(s)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::const_iterator it = s.m_connected_slots.begin();
+      typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        (*it)->getdest()->signal_connect(this);
+        m_connected_slots.push_back((*it)->clone());
+
+        ++it;
+      }
+    }
+
+    void slot_duplicate(const has_slots<mt_policy>* oldtarget, has_slots<mt_policy>* newtarget)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        if((*it)->getdest() == oldtarget)
+        {
+          m_connected_slots.push_back((*it)->duplicate(newtarget));
+        }
+
+        ++it;
+      }
+    }
+
+    ~_signal_base3()
+    {
+      disconnect_all();
+    }
+
+    void disconnect_all()
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::const_iterator it = m_connected_slots.begin();
+      typename connections_list::const_iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        (*it)->getdest()->signal_disconnect(this);
+        delete *it;
+
+        ++it;
+      }
+
+      m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
+    }
+
+    void disconnect(has_slots<mt_policy>* pclass)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        if((*it)->getdest() == pclass)
+        {
+          delete *it;
+          m_connected_slots.erase(it);
+          pclass->signal_disconnect(this);
+          return;
+        }
+
+        ++it;
+      }
+    }
+
+    void slot_disconnect(has_slots<mt_policy>* pslot)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        typename connections_list::iterator itNext = it;
+        ++itNext;
+
+        if((*it)->getdest() == pslot)
+        {
+          m_connected_slots.erase(it);
+          //                        delete *it;
+        }
+
+        it = itNext;
+      }
+    }
+
+  protected:
+    connections_list m_connected_slots;
+  };
+
+  template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, class mt_policy>
+  class _signal_base4 : public _signal_base<mt_policy>
+  {
+  public:
+    typedef std::list<_connection_base4<arg1_type, arg2_type, arg3_type,
+    arg4_type, mt_policy> *>  connections_list;
+
+    _signal_base4()
+    {
+      ;
+    }
+
+    _signal_base4(const _signal_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>& s)
+        : _signal_base<mt_policy>(s)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::const_iterator it = s.m_connected_slots.begin();
+      typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        (*it)->getdest()->signal_connect(this);
+        m_connected_slots.push_back((*it)->clone());
+
+        ++it;
+      }
+    }
+
+    void slot_duplicate(const has_slots<mt_policy>* oldtarget, has_slots<mt_policy>* newtarget)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        if((*it)->getdest() == oldtarget)
+        {
+          m_connected_slots.push_back((*it)->duplicate(newtarget));
+        }
+
+        ++it;
+      }
+    }
+
+    ~_signal_base4()
+    {
+      disconnect_all();
+    }
+
+    void disconnect_all()
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::const_iterator it = m_connected_slots.begin();
+      typename connections_list::const_iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        (*it)->getdest()->signal_disconnect(this);
+        delete *it;
+
+        ++it;
+      }
+
+      m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
+    }
+
+    void disconnect(has_slots<mt_policy>* pclass)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        if((*it)->getdest() == pclass)
+        {
+          delete *it;
+          m_connected_slots.erase(it);
+          pclass->signal_disconnect(this);
+          return;
+        }
+
+        ++it;
+      }
+    }
+
+    void slot_disconnect(has_slots<mt_policy>* pslot)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        typename connections_list::iterator itNext = it;
+        ++itNext;
+
+        if((*it)->getdest() == pslot)
+        {
+          m_connected_slots.erase(it);
+          //                        delete *it;
+        }
+
+        it = itNext;
+      }
+    }
+
+  protected:
+    connections_list m_connected_slots;
+  };
+
+  template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
+  class arg5_type, class mt_policy>
+  class _signal_base5 : public _signal_base<mt_policy>
+  {
+  public:
+    typedef std::list<_connection_base5<arg1_type, arg2_type, arg3_type,
+    arg4_type, arg5_type, mt_policy> *>  connections_list;
+
+    _signal_base5()
+    {
+      ;
+    }
+
+    _signal_base5(const _signal_base5<arg1_type, arg2_type, arg3_type, arg4_type,
+                  arg5_type, mt_policy>& s)
+        : _signal_base<mt_policy>(s)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::const_iterator it = s.m_connected_slots.begin();
+      typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        (*it)->getdest()->signal_connect(this);
+        m_connected_slots.push_back((*it)->clone());
+
+        ++it;
+      }
+    }
+
+    void slot_duplicate(const has_slots<mt_policy>* oldtarget, has_slots<mt_policy>* newtarget)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        if((*it)->getdest() == oldtarget)
+        {
+          m_connected_slots.push_back((*it)->duplicate(newtarget));
+        }
+
+        ++it;
+      }
+    }
+
+    ~_signal_base5()
+    {
+      disconnect_all();
+    }
+
+    void disconnect_all()
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::const_iterator it = m_connected_slots.begin();
+      typename connections_list::const_iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        (*it)->getdest()->signal_disconnect(this);
+        delete *it;
+
+        ++it;
+      }
+
+      m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
+    }
+
+    void disconnect(has_slots<mt_policy>* pclass)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        if((*it)->getdest() == pclass)
+        {
+          delete *it;
+          m_connected_slots.erase(it);
+          pclass->signal_disconnect(this);
+          return;
+        }
+
+        ++it;
+      }
+    }
+
+    void slot_disconnect(has_slots<mt_policy>* pslot)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        typename connections_list::iterator itNext = it;
+        ++itNext;
+
+        if((*it)->getdest() == pslot)
+        {
+          m_connected_slots.erase(it);
+          //                        delete *it;
+        }
+
+        it = itNext;
+      }
+    }
+
+  protected:
+    connections_list m_connected_slots;
+  };
+
+  template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
+  class arg5_type, class arg6_type, class mt_policy>
+  class _signal_base6 : public _signal_base<mt_policy>
+  {
+  public:
+    typedef std::list<_connection_base6<arg1_type, arg2_type, arg3_type,
+    arg4_type, arg5_type, arg6_type, mt_policy> *>  connections_list;
+
+    _signal_base6()
+    {
+      ;
+    }
+
+    _signal_base6(const _signal_base6<arg1_type, arg2_type, arg3_type, arg4_type,
+                  arg5_type, arg6_type, mt_policy>& s)
+        : _signal_base<mt_policy>(s)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::const_iterator it = s.m_connected_slots.begin();
+      typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        (*it)->getdest()->signal_connect(this);
+        m_connected_slots.push_back((*it)->clone());
+
+        ++it;
+      }
+    }
+
+    void slot_duplicate(const has_slots<mt_policy>* oldtarget, has_slots<mt_policy>* newtarget)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        if((*it)->getdest() == oldtarget)
+        {
+          m_connected_slots.push_back((*it)->duplicate(newtarget));
+        }
+
+        ++it;
+      }
+    }
+
+    ~_signal_base6()
+    {
+      disconnect_all();
+    }
+
+    void disconnect_all()
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::const_iterator it = m_connected_slots.begin();
+      typename connections_list::const_iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        (*it)->getdest()->signal_disconnect(this);
+        delete *it;
+
+        ++it;
+      }
+
+      m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
+    }
+
+    void disconnect(has_slots<mt_policy>* pclass)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        if((*it)->getdest() == pclass)
+        {
+          delete *it;
+          m_connected_slots.erase(it);
+          pclass->signal_disconnect(this);
+          return;
+        }
+
+        ++it;
+      }
+    }
+
+    void slot_disconnect(has_slots<mt_policy>* pslot)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        typename connections_list::iterator itNext = it;
+        ++itNext;
+
+        if((*it)->getdest() == pslot)
+        {
+          m_connected_slots.erase(it);
+          //                        delete *it;
+        }
+
+        it = itNext;
+      }
+    }
+
+  protected:
+    connections_list m_connected_slots;
+  };
+
+  template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
+  class arg5_type, class arg6_type, class arg7_type, class mt_policy>
+  class _signal_base7 : public _signal_base<mt_policy>
+  {
+  public:
+    typedef std::list<_connection_base7<arg1_type, arg2_type, arg3_type,
+    arg4_type, arg5_type, arg6_type, arg7_type, mt_policy> *>  connections_list;
+
+    _signal_base7()
+    {
+      ;
+    }
+
+    _signal_base7(const _signal_base7<arg1_type, arg2_type, arg3_type, arg4_type,
+                  arg5_type, arg6_type, arg7_type, mt_policy>& s)
+        : _signal_base<mt_policy>(s)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::const_iterator it = s.m_connected_slots.begin();
+      typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        (*it)->getdest()->signal_connect(this);
+        m_connected_slots.push_back((*it)->clone());
+
+        ++it;
+      }
+    }
+
+    void slot_duplicate(const has_slots<mt_policy>* oldtarget, has_slots<mt_policy>* newtarget)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        if((*it)->getdest() == oldtarget)
+        {
+          m_connected_slots.push_back((*it)->duplicate(newtarget));
+        }
+
+        ++it;
+      }
+    }
+
+    ~_signal_base7()
+    {
+      disconnect_all();
+    }
+
+    void disconnect_all()
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::const_iterator it = m_connected_slots.begin();
+      typename connections_list::const_iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        (*it)->getdest()->signal_disconnect(this);
+        delete *it;
+
+        ++it;
+      }
+
+      m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
+    }
+
+    void disconnect(has_slots<mt_policy>* pclass)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        if((*it)->getdest() == pclass)
+        {
+          delete *it;
+          m_connected_slots.erase(it);
+          pclass->signal_disconnect(this);
+          return;
+        }
+
+        ++it;
+      }
+    }
+
+    void slot_disconnect(has_slots<mt_policy>* pslot)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        typename connections_list::iterator itNext = it;
+        ++itNext;
+
+        if((*it)->getdest() == pslot)
+        {
+          m_connected_slots.erase(it);
+          //                        delete *it;
+        }
+
+        it = itNext;
+      }
+    }
+
+  protected:
+    connections_list m_connected_slots;
+  };
+
+  template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
+  class arg5_type, class arg6_type, class arg7_type, class arg8_type, class mt_policy>
+  class _signal_base8 : public _signal_base<mt_policy>
+  {
+  public:
+    typedef std::list<_connection_base8<arg1_type, arg2_type, arg3_type,
+    arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, mt_policy> *>
+    connections_list;
+
+    _signal_base8()
+    {
+      ;
+    }
+
+    _signal_base8(const _signal_base8<arg1_type, arg2_type, arg3_type, arg4_type,
+                  arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>& s)
+        : _signal_base<mt_policy>(s)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::const_iterator it = s.m_connected_slots.begin();
+      typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        (*it)->getdest()->signal_connect(this);
+        m_connected_slots.push_back((*it)->clone());
+
+        ++it;
+      }
+    }
+
+    void slot_duplicate(const has_slots<mt_policy>* oldtarget, has_slots<mt_policy>* newtarget)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        if((*it)->getdest() == oldtarget)
+        {
+          m_connected_slots.push_back((*it)->duplicate(newtarget));
+        }
+
+        ++it;
+      }
+    }
+
+    ~_signal_base8()
+    {
+      disconnect_all();
+    }
+
+    void disconnect_all()
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::const_iterator it = m_connected_slots.begin();
+      typename connections_list::const_iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        (*it)->getdest()->signal_disconnect(this);
+        delete *it;
+
+        ++it;
+      }
+
+      m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
+    }
+
+    void disconnect(has_slots<mt_policy>* pclass)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        if((*it)->getdest() == pclass)
+        {
+          delete *it;
+          m_connected_slots.erase(it);
+          pclass->signal_disconnect(this);
+          return;
+        }
+
+        ++it;
+      }
+    }
+
+    void slot_disconnect(has_slots<mt_policy>* pslot)
+    {
+      lock_block<mt_policy> lock(this);
+      typename connections_list::iterator it = m_connected_slots.begin();
+      typename connections_list::iterator itEnd = m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        typename connections_list::iterator itNext = it;
+        ++itNext;
+
+        if((*it)->getdest() == pslot)
+        {
+          m_connected_slots.erase(it);
+          //                        delete *it;
+        }
+
+        it = itNext;
+      }
+    }
+
+  protected:
+    connections_list m_connected_slots;
+  };
+
+
+  template<class dest_type, class mt_policy>
+  class _connection0 : public _connection_base0<mt_policy>
+  {
+  public:
+    _connection0()
+    {
+      m_pobject = NULL;
+      m_pmemfun = NULL;
+    }
+
+    _connection0(dest_type* pobject, void (dest_type::*pmemfun)())
+    {
+      m_pobject = pobject;
+      m_pmemfun = pmemfun;
+    }
+
+    virtual _connection_base0<mt_policy>* clone()
+    {
+      return new _connection0<dest_type, mt_policy>(*this);
+    }
+
+    virtual _connection_base0<mt_policy>* duplicate(has_slots<mt_policy>* pnewdest)
+    {
+      return new _connection0<dest_type, mt_policy>(dynamic_cast<dest_type*>(pnewdest), m_pmemfun);
+    }
+
+    virtual void emit()
+    {
+      (m_pobject->*m_pmemfun)();
+    }
+
+    virtual has_slots<mt_policy>* getdest() const
+    {
+      return m_pobject;
+    }
+
+  private:
+    dest_type* m_pobject;
+    void (dest_type::* m_pmemfun)();
+  };
+
+  template<class dest_type, class arg1_type, class mt_policy>
+  class _connection1 : public _connection_base1<arg1_type, mt_policy>
+  {
+  public:
+    _connection1()
+    {
+      m_pobject = NULL;
+      m_pmemfun = NULL;
+    }
+
+    _connection1(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type))
+    {
+      m_pobject = pobject;
+      m_pmemfun = pmemfun;
+    }
+
+    virtual _connection_base1<arg1_type, mt_policy>* clone()
+    {
+      return new _connection1<dest_type, arg1_type, mt_policy>(*this);
+    }
+
+    virtual _connection_base1<arg1_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest)
+    {
+      return new _connection1<dest_type, arg1_type, mt_policy>(dynamic_cast<dest_type*>(pnewdest), m_pmemfun);
+    }
+
+    virtual void emit(arg1_type a1)
+    {
+      (m_pobject->*m_pmemfun)(a1);
+    }
+
+    virtual has_slots<mt_policy>* getdest() const
+    {
+      return m_pobject;
+    }
+
+  private:
+    dest_type* m_pobject;
+    void (dest_type::* m_pmemfun)(arg1_type);
+  };
+
+  template<class dest_type, class arg1_type, class arg2_type, class mt_policy>
+  class _connection2 : public _connection_base2<arg1_type, arg2_type, mt_policy>
+  {
+  public:
+    _connection2()
+    {
+      m_pobject = NULL;
+      m_pmemfun = NULL;
+    }
+
+    _connection2(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
+                 arg2_type))
+    {
+      m_pobject = pobject;
+      m_pmemfun = pmemfun;
+    }
+
+    virtual _connection_base2<arg1_type, arg2_type, mt_policy>* clone()
+    {
+      return new _connection2<dest_type, arg1_type, arg2_type, mt_policy>(*this);
+    }
+
+    virtual _connection_base2<arg1_type, arg2_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest)
+    {
+      return new _connection2<dest_type, arg1_type, arg2_type, mt_policy>(dynamic_cast<dest_type*>(pnewdest), m_pmemfun);
+    }
+
+    virtual void emit(arg1_type a1, arg2_type a2)
+    {
+      (m_pobject->*m_pmemfun)(a1, a2);
+    }
+
+    virtual has_slots<mt_policy>* getdest() const
+    {
+      return m_pobject;
+    }
+
+  private:
+    dest_type* m_pobject;
+    void (dest_type::* m_pmemfun)(arg1_type, arg2_type);
+  };
+
+  template<class dest_type, class arg1_type, class arg2_type, class arg3_type, class mt_policy>
+  class _connection3 : public _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>
+  {
+  public:
+    _connection3()
+    {
+      m_pobject = NULL;
+      m_pmemfun = NULL;
+    }
+
+    _connection3(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
+                 arg2_type, arg3_type))
+    {
+      m_pobject = pobject;
+      m_pmemfun = pmemfun;
+    }
+
+    virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>* clone()
+    {
+      return new _connection3<dest_type, arg1_type, arg2_type, arg3_type, mt_policy>(*this);
+    }
+
+    virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest)
+    {
+      return new _connection3<dest_type, arg1_type, arg2_type, arg3_type, mt_policy>(dynamic_cast<dest_type*>(pnewdest), m_pmemfun);
+    }
+
+    virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3)
+    {
+      (m_pobject->*m_pmemfun)(a1, a2, a3);
+    }
+
+    virtual has_slots<mt_policy>* getdest() const
+    {
+      return m_pobject;
+    }
+
+  private:
+    dest_type* m_pobject;
+    void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type);
+  };
+
+  template<class dest_type, class arg1_type, class arg2_type, class arg3_type,
+  class arg4_type, class mt_policy>
+  class _connection4 : public _connection_base4<arg1_type, arg2_type,
+        arg3_type, arg4_type, mt_policy>
+  {
+  public:
+    _connection4()
+    {
+      m_pobject = NULL;
+      m_pmemfun = NULL;
+    }
+
+    _connection4(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
+                 arg2_type, arg3_type, arg4_type))
+    {
+      m_pobject = pobject;
+      m_pmemfun = pmemfun;
+    }
+
+    virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* clone()
+    {
+      return new _connection4<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>(*this);
+    }
+
+    virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest)
+    {
+      return new _connection4<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>(dynamic_cast<dest_type*>(pnewdest), m_pmemfun);
+    }
+
+    virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3,
+                      arg4_type a4)
+    {
+      (m_pobject->*m_pmemfun)(a1, a2, a3, a4);
+    }
+
+    virtual has_slots<mt_policy>* getdest() const
+    {
+      return m_pobject;
+    }
+
+  private:
+    dest_type* m_pobject;
+    void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type,
+                                  arg4_type);
+  };
+
+  template<class dest_type, class arg1_type, class arg2_type, class arg3_type,
+  class arg4_type, class arg5_type, class mt_policy>
+  class _connection5 : public _connection_base5<arg1_type, arg2_type,
+        arg3_type, arg4_type, arg5_type, mt_policy>
+  {
+  public:
+    _connection5()
+    {
+      m_pobject = NULL;
+      m_pmemfun = NULL;
+    }
+
+    _connection5(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
+                 arg2_type, arg3_type, arg4_type, arg5_type))
+    {
+      m_pobject = pobject;
+      m_pmemfun = pmemfun;
+    }
+
+    virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type,
+    arg5_type, mt_policy>* clone()
+    {
+      return new _connection5<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
+             arg5_type, mt_policy>(*this);
+    }
+
+    virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type,
+    arg5_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest)
+    {
+      return new _connection5<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
+      arg5_type, mt_policy>(dynamic_cast<dest_type*>(pnewdest), m_pmemfun);
+    }
+
+    virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
+                      arg5_type a5)
+    {
+      (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5);
+    }
+
+    virtual has_slots<mt_policy>* getdest() const
+    {
+      return m_pobject;
+    }
+
+  private:
+    dest_type* m_pobject;
+    void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
+                                  arg5_type);
+  };
+
+  template<class dest_type, class arg1_type, class arg2_type, class arg3_type,
+  class arg4_type, class arg5_type, class arg6_type, class mt_policy>
+  class _connection6 : public _connection_base6<arg1_type, arg2_type,
+        arg3_type, arg4_type, arg5_type, arg6_type, mt_policy>
+  {
+  public:
+    _connection6()
+    {
+      m_pobject = NULL;
+      m_pmemfun = NULL;
+    }
+
+    _connection6(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
+                 arg2_type, arg3_type, arg4_type, arg5_type, arg6_type))
+    {
+      m_pobject = pobject;
+      m_pmemfun = pmemfun;
+    }
+
+    virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type,
+    arg5_type, arg6_type, mt_policy>* clone()
+    {
+      return new _connection6<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
+             arg5_type, arg6_type, mt_policy>(*this);
+    }
+
+    virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type,
+    arg5_type, arg6_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest)
+    {
+      return new _connection6<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
+      arg5_type, arg6_type, mt_policy>(dynamic_cast<dest_type*>(pnewdest), m_pmemfun);
+    }
+
+    virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
+                      arg5_type a5, arg6_type a6)
+    {
+      (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5, a6);
+    }
+
+    virtual has_slots<mt_policy>* getdest() const
+    {
+      return m_pobject;
+    }
+
+  private:
+    dest_type* m_pobject;
+    void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
+                                  arg5_type, arg6_type);
+  };
+
+  template<class dest_type, class arg1_type, class arg2_type, class arg3_type,
+  class arg4_type, class arg5_type, class arg6_type, class arg7_type, class mt_policy>
+  class _connection7 : public _connection_base7<arg1_type, arg2_type,
+        arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, mt_policy>
+  {
+  public:
+    _connection7()
+    {
+      m_pobject = NULL;
+      m_pmemfun = NULL;
+    }
+
+    _connection7(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
+                 arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type))
+    {
+      m_pobject = pobject;
+      m_pmemfun = pmemfun;
+    }
+
+    virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type,
+    arg5_type, arg6_type, arg7_type, mt_policy>* clone()
+    {
+      return new _connection7<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
+             arg5_type, arg6_type, arg7_type, mt_policy>(*this);
+    }
+
+    virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type,
+    arg5_type, arg6_type, arg7_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest)
+    {
+      return new _connection7<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
+      arg5_type, arg6_type, arg7_type, mt_policy>(dynamic_cast<dest_type*>(pnewdest), m_pmemfun);
+    }
+
+    virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
+                      arg5_type a5, arg6_type a6, arg7_type a7)
+    {
+      (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5, a6, a7);
+    }
+
+    virtual has_slots<mt_policy>* getdest() const
+    {
+      return m_pobject;
+    }
+
+  private:
+    dest_type* m_pobject;
+    void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
+                                  arg5_type, arg6_type, arg7_type);
+  };
+
+  template<class dest_type, class arg1_type, class arg2_type, class arg3_type,
+  class arg4_type, class arg5_type, class arg6_type, class arg7_type,
+  class arg8_type, class mt_policy>
+  class _connection8 : public _connection_base8<arg1_type, arg2_type,
+        arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>
+  {
+  public:
+    _connection8()
+    {
+      m_pobject = NULL;
+      m_pmemfun = NULL;
+    }
+
+    _connection8(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
+                 arg2_type, arg3_type, arg4_type, arg5_type, arg6_type,
+                 arg7_type, arg8_type))
+    {
+      m_pobject = pobject;
+      m_pmemfun = pmemfun;
+    }
+
+    virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type,
+    arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* clone()
+    {
+      return new _connection8<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
+             arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>(*this);
+    }
+
+    virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type,
+    arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest)
+    {
+      return new _connection8<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
+      arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>(dynamic_cast<dest_type*>(pnewdest), m_pmemfun);
+    }
+
+    virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
+                      arg5_type a5, arg6_type a6, arg7_type a7, arg8_type a8)
+    {
+      (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5, a6, a7, a8);
+    }
+
+    virtual has_slots<mt_policy>* getdest() const
+    {
+      return m_pobject;
+    }
+
+  private:
+    dest_type* m_pobject;
+    void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
+                                  arg5_type, arg6_type, arg7_type, arg8_type);
+  };
+
+  template<class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
+  class signal0 : public _signal_base0<mt_policy>
+  {
+  public:
+    signal0()
+    {
+      ;
+    }
+
+    signal0(const signal0<mt_policy>& s)
+        : _signal_base0<mt_policy>(s)
+    {
+      ;
+    }
+
+    template<class desttype>
+    void connect(desttype* pclass, void (desttype::*pmemfun)())
+    {
+      lock_block<mt_policy> lock(this);
+      _connection0<desttype, mt_policy>* conn =
+        new _connection0<desttype, mt_policy>(pclass, pmemfun);
+      this->m_connected_slots.push_back(conn);
+      pclass->signal_connect(this);
+    }
+
+    void emit()
+    {
+      lock_block<mt_policy> lock(this);
+      typename _signal_base0<mt_policy>::connections_list::const_iterator itNext, it = this->m_connected_slots.begin();
+      typename _signal_base0<mt_policy>::connections_list::const_iterator itEnd = this->m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        itNext = it;
+        ++itNext;
+
+        (*it)->emit();
+
+        it = itNext;
+      }
+    }
+
+    void operator()()
+    {
+      lock_block<mt_policy> lock(this);
+      typename _signal_base0<mt_policy>::connections_list::const_iterator itNext, it = this->m_connected_slots.begin();
+      typename _signal_base0<mt_policy>::connections_list::const_iterator itEnd = this->m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        itNext = it;
+        ++itNext;
+
+        (*it)->emit();
+
+        it = itNext;
+      }
+    }
+  };
+
+  template<class arg1_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
+  class signal1 : public _signal_base1<arg1_type, mt_policy>
+  {
+  public:
+    signal1()
+    {
+      ;
+    }
+
+    signal1(const signal1<arg1_type, mt_policy>& s)
+        : _signal_base1<arg1_type, mt_policy>(s)
+    {
+      ;
+    }
+
+    template<class desttype>
+    void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type))
+    {
+      lock_block<mt_policy> lock(this);
+      _connection1<desttype, arg1_type, mt_policy>* conn =
+        new _connection1<desttype, arg1_type, mt_policy>(pclass, pmemfun);
+      this->m_connected_slots.push_back(conn);
+      pclass->signal_connect(this);
+    }
+
+    void emit(arg1_type a1)
+    {
+      lock_block<mt_policy> lock(this);
+      typename _signal_base1<arg1_type, mt_policy>::connections_list::const_iterator itNext, it = this->m_connected_slots.begin();
+      typename _signal_base1<arg1_type, mt_policy>::connections_list::const_iterator itEnd = this->m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        itNext = it;
+        ++itNext;
+
+        (*it)->emit(a1);
+
+        it = itNext;
+      }
+    }
+
+    void operator()(arg1_type a1)
+    {
+      lock_block<mt_policy> lock(this);
+      typename _signal_base1<arg1_type, mt_policy>::connections_list::const_iterator itNext, it = this->m_connected_slots.begin();
+      typename _signal_base1<arg1_type, mt_policy>::connections_list::const_iterator itEnd = this->m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        itNext = it;
+        ++itNext;
+
+        (*it)->emit(a1);
+
+        it = itNext;
+      }
+    }
+  };
+
+  template<class arg1_type, class arg2_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
+  class signal2 : public _signal_base2<arg1_type, arg2_type, mt_policy>
+  {
+  public:
+    signal2()
+    {
+      ;
+    }
+
+    signal2(const signal2<arg1_type, arg2_type, mt_policy>& s)
+        : _signal_base2<arg1_type, arg2_type, mt_policy>(s)
+    {
+      ;
+    }
+
+    template<class desttype>
+    void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
+                 arg2_type))
+    {
+      lock_block<mt_policy> lock(this);
+      _connection2<desttype, arg1_type, arg2_type, mt_policy>* conn = new
+          _connection2<desttype, arg1_type, arg2_type, mt_policy>(pclass, pmemfun);
+      this->m_connected_slots.push_back(conn);
+      pclass->signal_connect(this);
+    }
+
+    void emit(arg1_type a1, arg2_type a2)
+    {
+      lock_block<mt_policy> lock(this);
+      typename _signal_base2<arg1_type, arg2_type, mt_policy>::connections_list::const_iterator itNext, it = this->m_connected_slots.begin();
+      typename _signal_base2<arg1_type, arg2_type, mt_policy>::connections_list::const_iterator itEnd = this->m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        itNext = it;
+        ++itNext;
+
+        (*it)->emit(a1, a2);
+
+        it = itNext;
+      }
+    }
+
+    void operator()(arg1_type a1, arg2_type a2)
+    {
+      lock_block<mt_policy> lock(this);
+      typename _signal_base2<arg1_type, arg2_type, mt_policy>::connections_list::const_iterator itNext, it = this->m_connected_slots.begin();
+      typename _signal_base2<arg1_type, arg2_type, mt_policy>::connections_list::const_iterator itEnd = this->m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        itNext = it;
+        ++itNext;
+
+        (*it)->emit(a1, a2);
+
+        it = itNext;
+      }
+    }
+  };
+
+  template<class arg1_type, class arg2_type, class arg3_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
+  class signal3 : public _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy>
+  {
+  public:
+    signal3()
+    {
+      ;
+    }
+
+    signal3(const signal3<arg1_type, arg2_type, arg3_type, mt_policy>& s)
+        : _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy>(s)
+    {
+      ;
+    }
+
+    template<class desttype>
+    void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
+                 arg2_type, arg3_type))
+    {
+      lock_block<mt_policy> lock(this);
+      _connection3<desttype, arg1_type, arg2_type, arg3_type, mt_policy>* conn =
+        new _connection3<desttype, arg1_type, arg2_type, arg3_type, mt_policy>(pclass,
+            pmemfun);
+      this->m_connected_slots.push_back(conn);
+      pclass->signal_connect(this);
+    }
+
+    void emit(arg1_type a1, arg2_type a2, arg3_type a3)
+    {
+      lock_block<mt_policy> lock(this);
+      typename _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy>::connections_list::const_iterator itNext, it = this->m_connected_slots.begin();
+      typename _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy>::connections_list::const_iterator itEnd = this->m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        itNext = it;
+        ++itNext;
+
+        (*it)->emit(a1, a2, a3);
+
+        it = itNext;
+      }
+    }
+
+    void operator()(arg1_type a1, arg2_type a2, arg3_type a3)
+    {
+      lock_block<mt_policy> lock(this);
+      typename _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy>::connections_list::const_iterator itNext, it = this->m_connected_slots.begin();
+      typename _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy>::connections_list::const_iterator itEnd = this->m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        itNext = it;
+        ++itNext;
+
+        (*it)->emit(a1, a2, a3);
+
+        it = itNext;
+      }
+    }
+  };
+
+  template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
+  class signal4 : public _signal_base4<arg1_type, arg2_type, arg3_type,
+        arg4_type, mt_policy>
+  {
+  public:
+    signal4()
+    {
+      ;
+    }
+
+    signal4(const signal4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>& s)
+        : _signal_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>(s)
+    {
+      ;
+    }
+
+    template<class desttype>
+    void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
+                 arg2_type, arg3_type, arg4_type))
+    {
+      lock_block<mt_policy> lock(this);
+      _connection4<desttype, arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>*
+      conn = new _connection4<desttype, arg1_type, arg2_type, arg3_type,
+             arg4_type, mt_policy>(pclass, pmemfun);
+      this->m_connected_slots.push_back(conn);
+      pclass->signal_connect(this);
+    }
+
+    void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4)
+    {
+      lock_block<mt_policy> lock(this);
+      typename _signal_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>::connections_list::const_iterator itNext, it = this->m_connected_slots.begin();
+      typename _signal_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>::connections_list::const_iterator itEnd = this->m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        itNext = it;
+        ++itNext;
+
+        (*it)->emit(a1, a2, a3, a4);
+
+        it = itNext;
+      }
+    }
+
+    void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4)
+    {
+      lock_block<mt_policy> lock(this);
+      typename _signal_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>::connections_list::const_iterator itNext, it = this->m_connected_slots.begin();
+      typename _signal_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>::connections_list::const_iterator itEnd = this->m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        itNext = it;
+        ++itNext;
+
+        (*it)->emit(a1, a2, a3, a4);
+
+        it = itNext;
+      }
+    }
+  };
+
+  template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
+  class arg5_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
+  class signal5 : public _signal_base5<arg1_type, arg2_type, arg3_type,
+        arg4_type, arg5_type, mt_policy>
+  {
+  public:
+    signal5()
+    {
+      ;
+    }
+
+    signal5(const signal5<arg1_type, arg2_type, arg3_type, arg4_type,
+            arg5_type, mt_policy>& s)
+        : _signal_base5<arg1_type, arg2_type, arg3_type, arg4_type,
+        arg5_type, mt_policy>(s)
+    {
+      ;
+    }
+
+    template<class desttype>
+    void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
+                 arg2_type, arg3_type, arg4_type, arg5_type))
+    {
+      lock_block<mt_policy> lock(this);
+      _connection5<desttype, arg1_type, arg2_type, arg3_type, arg4_type,
+      arg5_type, mt_policy>* conn = new _connection5<desttype, arg1_type, arg2_type,
+                                    arg3_type, arg4_type, arg5_type, mt_policy>(pclass, pmemfun);
+      this->m_connected_slots.push_back(conn);
+      pclass->signal_connect(this);
+    }
+
+    void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
+              arg5_type a5)
+    {
+      lock_block<mt_policy> lock(this);
+      typename _signal_base5<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, mt_policy>::connections_list::const_iterator itNext, it = this->m_connected_slots.begin();
+      typename _signal_base5<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, mt_policy>::connections_list::const_iterator itEnd = this->m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        itNext = it;
+        ++itNext;
+
+        (*it)->emit(a1, a2, a3, a4, a5);
+
+        it = itNext;
+      }
+    }
+
+    void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
+                    arg5_type a5)
+    {
+      lock_block<mt_policy> lock(this);
+      typename _signal_base5<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, mt_policy>::connections_list::const_iterator itNext, it = this->m_connected_slots.begin();
+      typename _signal_base5<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, mt_policy>::connections_list::const_iterator itEnd = this->m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        itNext = it;
+        ++itNext;
+
+        (*it)->emit(a1, a2, a3, a4, a5);
+
+        it = itNext;
+      }
+    }
+  };
+
+
+  template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
+  class arg5_type, class arg6_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
+  class signal6 : public _signal_base6<arg1_type, arg2_type, arg3_type,
+        arg4_type, arg5_type, arg6_type, mt_policy>
+  {
+  public:
+    signal6()
+    {
+      ;
+    }
+
+    signal6(const signal6<arg1_type, arg2_type, arg3_type, arg4_type,
+            arg5_type, arg6_type, mt_policy>& s)
+        : _signal_base6<arg1_type, arg2_type, arg3_type, arg4_type,
+        arg5_type, arg6_type, mt_policy>(s)
+    {
+      ;
+    }
+
+    template<class desttype>
+    void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
+                 arg2_type, arg3_type, arg4_type, arg5_type, arg6_type))
+    {
+      lock_block<mt_policy> lock(this);
+      _connection6<desttype, arg1_type, arg2_type, arg3_type, arg4_type,
+      arg5_type, arg6_type, mt_policy>* conn =
+        new _connection6<desttype, arg1_type, arg2_type, arg3_type,
+        arg4_type, arg5_type, arg6_type, mt_policy>(pclass, pmemfun);
+      this->m_connected_slots.push_back(conn);
+      pclass->signal_connect(this);
+    }
+
+    void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
+              arg5_type a5, arg6_type a6)
+    {
+      lock_block<mt_policy> lock(this);
+      typename _signal_base6<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, mt_policy>::connections_list::const_iterator itNext, it = this->m_connected_slots.begin();
+      typename _signal_base6<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, mt_policy>::connections_list::const_iterator itEnd = this->m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        itNext = it;
+        ++itNext;
+
+        (*it)->emit(a1, a2, a3, a4, a5, a6);
+
+        it = itNext;
+      }
+    }
+
+    void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
+                    arg5_type a5, arg6_type a6)
+    {
+      lock_block<mt_policy> lock(this);
+      typename _signal_base6<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, mt_policy>::connections_list::const_iterator itNext, it = this->m_connected_slots.begin();
+      typename _signal_base6<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, mt_policy>::connections_list::const_iterator itEnd = this->m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        itNext = it;
+        ++itNext;
+
+        (*it)->emit(a1, a2, a3, a4, a5, a6);
+
+        it = itNext;
+      }
+    }
+  };
+
+  template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
+  class arg5_type, class arg6_type, class arg7_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
+  class signal7 : public _signal_base7<arg1_type, arg2_type, arg3_type,
+        arg4_type, arg5_type, arg6_type, arg7_type, mt_policy>
+  {
+  public:
+    signal7()
+    {
+      ;
+    }
+
+    signal7(const signal7<arg1_type, arg2_type, arg3_type, arg4_type,
+            arg5_type, arg6_type, arg7_type, mt_policy>& s)
+        : _signal_base7<arg1_type, arg2_type, arg3_type, arg4_type,
+        arg5_type, arg6_type, arg7_type, mt_policy>(s)
+    {
+      ;
+    }
+
+    template<class desttype>
+    void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
+                 arg2_type, arg3_type, arg4_type, arg5_type, arg6_type,
+                 arg7_type))
+    {
+      lock_block<mt_policy> lock(this);
+      _connection7<desttype, arg1_type, arg2_type, arg3_type, arg4_type,
+      arg5_type, arg6_type, arg7_type, mt_policy>* conn =
+        new _connection7<desttype, arg1_type, arg2_type, arg3_type,
+        arg4_type, arg5_type, arg6_type, arg7_type, mt_policy>(pclass, pmemfun);
+      this->m_connected_slots.push_back(conn);
+      pclass->signal_connect(this);
+    }
+
+    void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
+              arg5_type a5, arg6_type a6, arg7_type a7)
+    {
+      lock_block<mt_policy> lock(this);
+      typename _signal_base7<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, mt_policy>::connections_list::const_iterator itNext, it = this->m_connected_slots.begin();
+      typename _signal_base7<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, mt_policy>::connections_list::const_iterator itEnd = this->m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        itNext = it;
+        ++itNext;
+
+        (*it)->emit(a1, a2, a3, a4, a5, a6, a7);
+
+        it = itNext;
+      }
+    }
+
+    void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
+                    arg5_type a5, arg6_type a6, arg7_type a7)
+    {
+      lock_block<mt_policy> lock(this);
+      typename _signal_base7<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, mt_policy>::connections_list::const_iterator itNext, it = this->m_connected_slots.begin();
+      typename _signal_base7<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, mt_policy>::connections_list::const_iterator itEnd = this->m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        itNext = it;
+        ++itNext;
+
+        (*it)->emit(a1, a2, a3, a4, a5, a6, a7);
+
+        it = itNext;
+      }
+    }
+  };
+
+  template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
+  class arg5_type, class arg6_type, class arg7_type, class arg8_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
+  class signal8 : public _signal_base8<arg1_type, arg2_type, arg3_type,
+        arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>
+  {
+  public:
+    signal8()
+    {
+      ;
+    }
+
+    signal8(const signal8<arg1_type, arg2_type, arg3_type, arg4_type,
+            arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>& s)
+        : _signal_base8<arg1_type, arg2_type, arg3_type, arg4_type,
+        arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>(s)
+    {
+      ;
+    }
+
+    template<class desttype>
+    void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
+                 arg2_type, arg3_type, arg4_type, arg5_type, arg6_type,
+                 arg7_type, arg8_type))
+    {
+      lock_block<mt_policy> lock(this);
+      _connection8<desttype, arg1_type, arg2_type, arg3_type, arg4_type,
+      arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* conn =
+        new _connection8<desttype, arg1_type, arg2_type, arg3_type,
+        arg4_type, arg5_type, arg6_type, arg7_type,
+        arg8_type, mt_policy>(pclass, pmemfun);
+      this->m_connected_slots.push_back(conn);
+      pclass->signal_connect(this);
+    }
+
+    void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
+              arg5_type a5, arg6_type a6, arg7_type a7, arg8_type a8)
+    {
+      lock_block<mt_policy> lock(this);
+      typename _signal_base8<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>::connections_list::const_iterator itNext, it = this->m_connected_slots.begin();
+      typename _signal_base8<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>::connections_list::const_iterator itEnd = this->m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        itNext = it;
+        ++itNext;
+
+        (*it)->emit(a1, a2, a3, a4, a5, a6, a7, a8);
+
+        it = itNext;
+      }
+    }
+
+    void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
+                    arg5_type a5, arg6_type a6, arg7_type a7, arg8_type a8)
+    {
+      lock_block<mt_policy> lock(this);
+      typename _signal_base8<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>::connections_list::const_iterator itNext, it = this->m_connected_slots.begin();
+      typename _signal_base8<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>::connections_list::const_iterator itEnd = this->m_connected_slots.end();
+
+      while(it != itEnd)
+      {
+        itNext = it;
+        ++itNext;
+
+        (*it)->emit(a1, a2, a3, a4, a5, a6, a7, a8);
+
+        it = itNext;
+      }
+    }
+  };
+
+}
+; // namespace sigslot
+
+#endif /* SIGNAL_H__ */
+
Index: trunk/src/lib/util/sigslot/slot.h
===================================================================
--- trunk/src/lib/util/sigslot/slot.h	(revision 9406)
+++ trunk/src/lib/util/sigslot/slot.h	(revision 9406)
@@ -0,0 +1,307 @@
+/**
+ * @file slot.h
+ * @brief Slots part of Signal Slot library from Sarah Thopson
+ * @see signal.h for more information and license.
+ */
+
+#ifndef SLOT_H__
+#define SLOT_H__
+
+#include <set>
+#include <list>
+
+
+#if defined(SIGSLOT_PURE_ISO) || (!defined(WIN32) && !defined(__GNUG__) && !defined(SIGSLOT_USE_POSIX_THREADS))
+#	define _SIGSLOT_SINGLE_THREADED
+#elif defined(WIN32)
+#	define _SIGSLOT_HAS_WIN32_THREADS
+#	include <windows.h>
+#elif defined(__GNUG__) || defined(SIGSLOT_USE_POSIX_THREADS)
+#	define _SIGSLOT_HAS_POSIX_THREADS
+#	include <pthread.h>
+#else
+#	define _SIGSLOT_SINGLE_THREADED
+#endif
+
+#ifndef SIGSLOT_DEFAULT_MT_POLICY
+#	ifdef _SIGSLOT_SINGLE_THREADED
+#		define SIGSLOT_DEFAULT_MT_POLICY single_threaded
+#	else
+#		define SIGSLOT_DEFAULT_MT_POLICY multi_threaded_local
+#	endif
+#endif
+
+namespace sigslot
+{
+
+  class single_threaded
+  {
+    public:
+      single_threaded()
+      {
+        ;
+      }
+
+      virtual ~single_threaded()
+      {
+        ;
+      }
+
+      virtual void lock()
+      {
+        ;
+      }
+
+      virtual void unlock()
+      {
+        ;
+      }
+  };
+
+#ifdef _SIGSLOT_HAS_WIN32_THREADS
+  // The multi threading policies only get compiled in if they are enabled.
+  class multi_threaded_global
+  {
+    public:
+      multi_threaded_global()
+      {
+        static bool isinitialised = false;
+
+        if(!isinitialised)
+        {
+          InitializeCriticalSection(get_critsec());
+          isinitialised = true;
+        }
+      }
+
+      multi_threaded_global(const multi_threaded_global&)
+      {
+        ;
+      }
+
+      virtual ~multi_threaded_global()
+      {
+        ;
+      }
+
+      virtual void lock()
+      {
+        EnterCriticalSection(get_critsec());
+      }
+
+      virtual void unlock()
+      {
+        LeaveCriticalSection(get_critsec());
+      }
+
+    private:
+      CRITICAL_SECTION* get_critsec()
+      {
+        static CRITICAL_SECTION g_critsec;
+        return &g_critsec;
+      }
+  };
+
+  class multi_threaded_local
+  {
+    public:
+      multi_threaded_local()
+      {
+        InitializeCriticalSection(&m_critsec);
+      }
+
+      multi_threaded_local(const multi_threaded_local&)
+      {
+        InitializeCriticalSection(&m_critsec);
+      }
+
+      virtual ~multi_threaded_local()
+      {
+        DeleteCriticalSection(&m_critsec);
+      }
+
+      virtual void lock()
+      {
+        EnterCriticalSection(&m_critsec);
+      }
+
+      virtual void unlock()
+      {
+        LeaveCriticalSection(&m_critsec);
+      }
+
+    private:
+      CRITICAL_SECTION m_critsec;
+  };
+#endif // _SIGSLOT_HAS_WIN32_THREADS
+
+#ifdef _SIGSLOT_HAS_POSIX_THREADS
+  // The multi threading policies only get compiled in if they are enabled.
+  class multi_threaded_global
+  {
+    public:
+      multi_threaded_global()
+      {
+        pthread_mutex_init(get_mutex(), NULL);
+      }
+
+      multi_threaded_global(const multi_threaded_global&)
+      {
+        ;
+      }
+
+      virtual ~multi_threaded_global()
+      {
+        ;
+      }
+
+      virtual void lock()
+      {
+        pthread_mutex_lock(get_mutex());
+      }
+
+      virtual void unlock()
+      {
+        pthread_mutex_unlock(get_mutex());
+      }
+
+    private:
+      pthread_mutex_t* get_mutex()
+      {
+        static pthread_mutex_t g_mutex;
+        return &g_mutex;
+      }
+  };
+
+  class multi_threaded_local
+  {
+    public:
+      multi_threaded_local()
+      {
+        pthread_mutex_init(&m_mutex, NULL);
+      }
+
+      multi_threaded_local(const multi_threaded_local&)
+      {
+        pthread_mutex_init(&m_mutex, NULL);
+      }
+
+      virtual ~multi_threaded_local()
+      {
+        pthread_mutex_destroy(&m_mutex);
+      }
+
+      virtual void lock()
+      {
+        pthread_mutex_lock(&m_mutex);
+      }
+
+      virtual void unlock()
+      {
+        pthread_mutex_unlock(&m_mutex);
+      }
+
+    private:
+      pthread_mutex_t m_mutex;
+  };
+#endif // _SIGSLOT_HAS_POSIX_THREADS
+
+  template<class mt_policy>
+  class lock_block
+  {
+    public:
+      mt_policy *m_mutex;
+
+      lock_block(mt_policy *mtx)
+          : m_mutex(mtx)
+      {
+        m_mutex->lock();
+      }
+
+      ~lock_block()
+      {
+        m_mutex->unlock();
+      }
+  };
+
+
+
+
+  template<class mt_policy>
+  class has_slots;
+
+
+  template<class mt_policy>
+  class _signal_base : public mt_policy
+  {
+    public:
+      virtual void slot_disconnect(has_slots<mt_policy>* pslot) = 0;
+      virtual void slot_duplicate(const has_slots<mt_policy>* poldslot, has_slots<mt_policy>* pnewslot) = 0;
+  };
+
+  template<class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
+  class has_slots //: public mt_policy
+  {
+    private:
+      typedef std::set<_signal_base<mt_policy> *> sender_set;
+      typedef typename sender_set::const_iterator const_iterator;
+
+    public:
+      has_slots()
+      {
+        ;
+      }
+
+      has_slots(const has_slots& hs)
+//          : mt_policy(hs)
+      {
+        //lock_block<mt_policy> lock(this);
+        const_iterator it = hs.m_senders.begin();
+        const_iterator itEnd = hs.m_senders.end();
+
+        while(it != itEnd)
+        {
+          (*it)->slot_duplicate(&hs, this);
+          m_senders.insert(*it);
+          ++it;
+        }
+      }
+
+      void signal_connect(_signal_base<mt_policy>* sender)
+      {
+        //lock_block<mt_policy> lock(this);
+        m_senders.insert(sender);
+      }
+
+      void signal_disconnect(_signal_base<mt_policy>* sender)
+      {
+        //lock_block<mt_policy> lock(this);
+        m_senders.erase(sender);
+      }
+
+      virtual ~has_slots()
+      {
+        disconnect_all();
+      }
+
+      void disconnect_all()
+      {
+        //lock_block<mt_policy> lock(this);
+        const_iterator it = m_senders.begin();
+        const_iterator itEnd = m_senders.end();
+
+        while(it != itEnd)
+        {
+          (*it)->slot_disconnect(this);
+          ++it;
+        }
+
+        m_senders.erase(m_senders.begin(), m_senders.end());
+      }
+
+    private:
+      sender_set m_senders;
+  };
+}
+
+#endif /* SLOT_H__ */
Index: trunk/src/lib/util/substring.cc
===================================================================
--- trunk/src/lib/util/substring.cc	(revision 9391)
+++ trunk/src/lib/util/substring.cc	(revision 9406)
@@ -28,8 +28,4 @@
 #include "substring.h"
 
-#include <string.h>
-#include <cassert>
-
-
 /**
  * @brief default constructor
@@ -108,5 +104,5 @@
 
 /** @brief An empty String */
-const std::string SubString::emptyString = "";
+// const std::string SubString::emptyString = "";
 /** @brief Helper that gets you a String consisting of all White Spaces */
 const std::string SubString::WhiteSpaces = " \n\t";
@@ -238,5 +234,8 @@
   }
   else
-    return SubString::emptyString;
+  {
+    static std::string empty;
+    return empty;
+  }
 }
 
@@ -250,5 +249,5 @@
  * SubString::SubString(const SubString& subString, unsigned int subSetBegin)
  */
-SubString SubString::getSubSet(unsigned int subSetBegin) const
+SubString SubString::subSet(unsigned int subSetBegin) const
 {
   return SubString(*this, subSetBegin);
@@ -265,5 +264,5 @@
  * SubString::SubString(const SubString& subString, unsigned int subSetBegin)
  */
-SubString SubString::getSubSet(unsigned int subSetBegin, unsigned int subSetEnd) const
+SubString SubString::subSet(unsigned int subSetBegin, unsigned int subSetEnd) const
 {
   return SubString(*this, subSetBegin, subSetEnd);
@@ -289,6 +288,4 @@
  * Supports delimiters, escape characters,
  * ignores special  characters between safemode_char and between comment_char and linend '\n'.
- *
- *
  */
 SubString::SPLIT_LINE_STATE
Index: trunk/src/lib/util/substring.h
===================================================================
--- trunk/src/lib/util/substring.h	(revision 9391)
+++ trunk/src/lib/util/substring.h	(revision 9406)
@@ -2,8 +2,22 @@
  * @file substring.h
  * @brief a small class to get the parts of a string separated by commas
+ *
+ * This class is also identified as a Tokenizer. It splits up one long
+ * String into multiple small ones by a designated Delimiter.
+ *
+ * Substring is Advanced, and it is possible, to split a string by ','
+ * but also removing leading and trailing spaces around the comma.
+ *
+ * @example
+ * Split the String std::string st = "1345, The new empire   , is , orxonox"
+ * is splitted with:
+ * SubString(st, ',', " \n\t")
+ * into
+ * "1345", "The new empire", "is", "orxonox"
+ * As you can see, the useless spaces around ',' were removed.
  */
 
-#ifndef _SUBSTRING_H
-#define _SUBSTRING_H
+#ifndef __SUBSTRING_H__
+#define __SUBSTRING_H__
 
 #include <vector>
@@ -61,6 +75,6 @@
 
   // retrieve a SubSet from the String
-  SubString getSubSet(unsigned int subSetBegin) const;
-  SubString getSubSet(unsigned int subSetBegin, unsigned int subSetEnd) const;
+  SubString subSet(unsigned int subSetBegin) const;
+  SubString subSet(unsigned int subSetBegin, unsigned int subSetEnd) const;
 
   // retrieve Information from within
@@ -70,7 +84,13 @@
   inline unsigned int size() const { return this->strings.size(); };
   /** @param i the i'th String @returns the i'th string from the subset of Strings */
-  inline const std::string& operator[](unsigned int i) const { return (i < this->strings.size()) ? this->strings[i] : emptyString; };
+  inline const std::string& operator[](unsigned int i) const { return this->strings[i]; };
   /** @param i the i'th String @returns the i'th string from the subset of Strings */
   inline const std::string& getString(unsigned int i) const { return (*this)[i]; };
+  /** @returns the front of the StringList. */
+  inline const std::string& front() const { return this->strings.front(); };
+  /** @returns the back of the StringList. */
+  inline const std::string& back() const { return this->strings.back(); };
+  /** @brief removes the back of the strings list. */
+  inline void pop_back() { this->strings.pop_back(); };
 
   // the almighty algorithm.
@@ -93,7 +113,5 @@
 private:
   std::vector<std::string>  strings;                      //!< strings produced from a single string splitted in multiple strings
-
-  static const std::string emptyString;
 };
 
-#endif /* _SUBSTRING_H */
+#endif /* __SUBSTRING_H__ */
Index: trunk/src/lib/util/threading.cc
===================================================================
--- trunk/src/lib/util/threading.cc	(revision 9391)
+++ trunk/src/lib/util/threading.cc	(revision 9406)
@@ -18,5 +18,5 @@
 #include "threading.h"
 
-using namespace std;
+
 
 namespace OrxThread
Index: trunk/src/lib/util/tokenizer.cc
===================================================================
--- trunk/src/lib/util/tokenizer.cc	(revision 9391)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/**
- * @file tokenizer.cc
- * @brief a tokenizer class
- *
- */
-
-#include "tokenizer.h"
-
-
-/**
- * tokenize a string
- */
-void Tokenizer::tokenize(const std::string& str, std::vector<std::string>& tokens, const std::string& delimiters)
-{
-    // Skip delimiters at beginning.
-  std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
-    // Find first "non-delimiter".
-  std::string::size_type pos     = str.find_first_of(delimiters, lastPos);
-
-  while (std::string::npos != pos || std::string::npos != lastPos)
-  {
-        // Found a token, add it to the vector.
-    tokens.push_back(str.substr(lastPos, pos - lastPos));
-        // Skip delimiters.  Note the "not_of"
-    lastPos = str.find_first_not_of(delimiters, pos);
-        // Find next "non-delimiter"
-    pos = str.find_first_of(delimiters, lastPos);
-  }
-}
Index: trunk/src/lib/util/tokenizer.h
===================================================================
--- trunk/src/lib/util/tokenizer.h	(revision 9391)
+++ 	(revision )
@@ -1,26 +1,0 @@
-
-/*!
- * @file tokenzier.h
- * @brief Definition of Tokenizer
- *
- */
-
-#ifndef _TOKENIZER_H
-#define _TOKENIZER_H
-
-
-#include <vector>
-#include <string>
-
-
-//! A class to handle time itself
-class Tokenizer
-{
-
-  public:
-    static void tokenize(const std::string& str, std::vector<std::string>& tokens, const std::string& delimiters = " ");
-
-
-};
-
-#endif /* _TOKENIZER_H */
Index: trunk/src/orxonox.cc
===================================================================
--- trunk/src/orxonox.cc	(revision 9391)
+++ trunk/src/orxonox.cc	(revision 9406)
@@ -58,4 +58,5 @@
 
 #include "network_manager.h"
+#include "shared_network_data.h"
 
 #include "state.h"
@@ -66,5 +67,5 @@
 int verbose = 5;
 
-using namespace std;
+
 
 SHELL_COMMAND(restart, Orxonox, restart);
@@ -72,5 +73,6 @@
 REGISTER_ARG_FLAG( l, license,    "misc",  "showLicenseAndExit", "Prints the license and exit",      "1" );
 REGISTER_ARG_FLAG( c, client,     "game",  "gameType",           "Connect to Server (-H)",           "multiplayer_client" );
-REGISTER_ARG_FLAG( s, server,     "game",  "gameType",           "Start Orxonox as Game Server",     "multiplayer_server" );
+REGISTER_ARG_FLAG( s, server,     "game",  "gameType",           "Start Orxonox as Game Server",     "multiplayer_master_server" );
+REGISTER_ARG_FLAG( x, proxy,      "game",  "gameType",           "Start Orxonox as Proxy Server",    "multiplayer_proxy_server" );
 REGISTER_ARG_ARG(  H, host,       "game",  "host",               "Host to connect to",               "host");
 REGISTER_ARG_ARG(  p, port,       "game",  "port",               "Port to use",                      "port" );
@@ -79,5 +81,6 @@
 REGISTER_ARG_FLAG( f, fullscreen, "video", "Fullscreen-mode",    "start Orxonox in fullscreen mode", "1");
 REGISTER_ARG_FLAG( w, windowed,   "video", "Fullscreen-mode",    "start Orxonox in windowed mode",   "0");
-REGISTER_ARG_ARG(  r, resolution, "video", "Resolution",         "Sets resolution / window size",    "res");
+REGISTER_ARG_ARG(  r, resolution, "video", "Resolution",         "sets resolution / window size",    "res");
+REGISTER_ARG_FLAG( d, dedicated,  "video", "Norender-mode",      "the scene is not rendered",        "1" );
 
 REGISTER_ARG_FLAG( a, audio,      "audio", "Disable-Audio",      "Enable audio",                     "0" );
@@ -144,5 +147,5 @@
   SDL_QuitSubSystem(SDL_INIT_TIMER);
   ClassList::debug();
-  
+
   Preferences::getInstance()->save();
 
@@ -301,16 +304,28 @@
 {
   PRINT(3)("> Initializing networking\n");
-
-  if( this->serverName != "") // we are a client
-  {
+  std::string gameType = Preferences::getInstance()->getString( "game", "gameType", "" );
+
+  if( gameType == "multiplayer_client")
+  {    // we are a client
     State::setOnline(true);
-    NetworkManager::getInstance()->establishConnection(this->serverName, port);
-  }
-  else if( this->port > 0)
-  {    // we are a server
+    SharedNetworkData::getInstance()->setNodeType(NET_CLIENT);
+    NetworkManager::getInstance()->createClient(this->serverName, port);
+  }
+  else if( gameType == "multiplayer_master_server")
+  {    // we are a master server
     State::setOnline(true);
-    NetworkManager::getInstance()->createServer(port);
-  }
-  return 0;
+    SharedNetworkData::getInstance()->setNodeType(NET_MASTER_SERVER);
+
+    NetworkManager::getInstance()->createMasterServer(port);
+  }
+  else if( gameType == "multiplayer_proxy_server")
+  {    // we are a proxy server
+    State::setOnline(true);
+    SharedNetworkData::getInstance()->setNodeType(NET_PROXY_SERVER_ACTIVE);
+    NetworkManager::getInstance()->createProxyServer(port);
+  }
+
+  return 0;
+
 }
 
@@ -453,11 +468,12 @@
   if ( Preferences::getInstance()->getString("misc", "bt-to-file", "1") == "1" )
   {
-    SignalHandler::getInstance()->doCatch( argv[0] );
-
+    SignalHandler::getInstance()->doCatch( argv[0], "orxonox.backtrace" );
+    SignalHandler::getInstance()->registerCallback( EventHandler::releaseMouse, NULL );
   }
 
   if( Preferences::getInstance()->getString("game", "showGui", "") == "1" )
     showGui = true;
-  else if( Preferences::getInstance()->getString( "game", "gameType", "" ) == "multiplayer_server" ||
+  else if( Preferences::getInstance()->getString( "game", "gameType", "" ) == "multiplayer_master_server" ||
+           Preferences::getInstance()->getString( "game", "gameType", "" ) == "multiplayer_proxy_server" ||
            Preferences::getInstance()->getString( "game", "gameType", "" ) == "multiplayer_client" )
     return startNetworkOrxonox(argc, argv);
@@ -493,9 +509,17 @@
     startOrxonox(argc, argv, host.c_str(), port);
   }
-  else if ( gameType == "multiplayer_server" )
+  else if ( gameType == "multiplayer_master_server" )
   {
     int port = Preferences::getInstance()->getInt( "game", "port", DEFAULT_ORXONOX_PORT );
 
     printf("Starting Orxonox as server: listening on port %i\n", port);
+
+    startOrxonox(argc, argv, "", port);
+  }
+  else if ( gameType == "multiplayer_proxy_server" )
+  {
+    int port = Preferences::getInstance()->getInt( "game", "port", DEFAULT_ORXONOX_PORT );
+
+    printf("Starting Orxonox as proxy server: listening on port %i\n", port);
 
     startOrxonox(argc, argv, "", port);
Index: trunk/src/proto/proto_class.cc
===================================================================
--- trunk/src/proto/proto_class.cc	(revision 9391)
+++ trunk/src/proto/proto_class.cc	(revision 9406)
@@ -18,5 +18,5 @@
 #include "proto_class.h"
 
-using namespace std;
+
 
 
Index: trunk/src/proto/proto_singleton.cc
===================================================================
--- trunk/src/proto/proto_singleton.cc	(revision 9391)
+++ trunk/src/proto/proto_singleton.cc	(revision 9406)
@@ -18,5 +18,5 @@
 #include "proto_singleton.h"
 
-using namespace std;
+
 
 
Index: trunk/src/proto/proto_world_entity.cc
===================================================================
--- trunk/src/proto/proto_world_entity.cc	(revision 9391)
+++ trunk/src/proto/proto_world_entity.cc	(revision 9406)
@@ -16,5 +16,5 @@
 #include "proto_world_entity.h"
 
-using namespace std;
+
 
 
Index: trunk/src/story_entities/Makefile.am
===================================================================
--- trunk/src/story_entities/Makefile.am	(revision 9391)
+++ trunk/src/story_entities/Makefile.am	(revision 9406)
@@ -13,5 +13,4 @@
 		story_entities/multi_player_world_data.cc \
 		story_entities/movie_loader.cc \
-		story_entities/simple_game_menu.cc \
 		\
 		story_entities/menu/game_menu.cc \
@@ -30,5 +29,4 @@
 		story_entities/multi_player_world_data.h \
 		story_entities/movie_loader.h \
-		story_entities/simple_game_menu.h \
 		\
 		story_entities/menu/game_menu.h \
Index: trunk/src/story_entities/campaign.cc
===================================================================
--- trunk/src/story_entities/campaign.cc	(revision 9391)
+++ trunk/src/story_entities/campaign.cc	(revision 9406)
@@ -25,5 +25,5 @@
 #include "campaign_data.h"
 
-using namespace std;
+
 
 
Index: trunk/src/story_entities/campaign_data.cc
===================================================================
--- trunk/src/story_entities/campaign_data.cc	(revision 9391)
+++ trunk/src/story_entities/campaign_data.cc	(revision 9406)
@@ -23,5 +23,5 @@
 
 
-using namespace std;
+
 
 
@@ -103,5 +103,5 @@
   int                            nextStoryID;
   int                            storyID;
-  list<StoryEntity*>::iterator   it;
+  std::list<StoryEntity*>::iterator   it;
 
   nextStoryID = 0;
@@ -124,5 +124,5 @@
   int                            nextStoryID;
   int                            storyID;
-  list<StoryEntity*>::iterator   it;
+  std::list<StoryEntity*>::iterator   it;
 
   nextStoryID = this->currentEntity->getNextStoryID();
@@ -145,5 +145,5 @@
 StoryEntity* CampaignData::getLevel(int storyID)
 {
-  list<StoryEntity*>::iterator   it;
+  std::list<StoryEntity*>::iterator   it;
   for( it = this->storyEntities.begin(); it != this->storyEntities.end(); it++)
   {
Index: trunk/src/story_entities/dedicated_server_world.cc
===================================================================
--- trunk/src/story_entities/dedicated_server_world.cc	(revision 9391)
+++ trunk/src/story_entities/dedicated_server_world.cc	(revision 9406)
@@ -28,5 +28,5 @@
 
 
-using namespace std;
+
 
 //! This creates a Factory to fabricate a DedicatedServerWorld
Index: trunk/src/story_entities/game_world.cc
===================================================================
--- trunk/src/story_entities/game_world.cc	(revision 9391)
+++ trunk/src/story_entities/game_world.cc	(revision 9406)
@@ -512,8 +512,13 @@
 void GameWorld::display ()
 {
+
+    // if this server is a dedicated server the game workd does not need to be drawn
+  if( !GraphicsEngine::getInstance()->isDedicated())
+  {
   // render the reflection texture
   this->renderPassReflection();
   // redner the refraction texture
   this->renderPassRefraction();
+  }
   // render all
   this->renderPassAll();
@@ -643,29 +648,33 @@
   LightManager::getInstance()->draw();
 
-  /* Draw the BackGround */
-  this->drawEntityList(State::getObjectManager()->getObjectList(OM_BACKGROUND));
-  engine->drawBackgroundElements();
-
-  /* draw all WorldEntiy groups */
-  for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
-    this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));
-
-  AtmosphericEngine::getInstance()->draw();
-
-  if( unlikely( this->showBV))
-  {
-    CDEngine* engine = CDEngine::getInstance();
+  // only render the world if its not dedicated mode
+  if( !GraphicsEngine::getInstance()->isDedicated())
+  {
+    /* Draw the BackGround */
+    this->drawEntityList(State::getObjectManager()->getObjectList(OM_BACKGROUND));
+    engine->drawBackgroundElements();
+
+    /* draw all WorldEntiy groups */
     for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
-      engine->drawBV(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]), this->showBVLevel);
-  }
-
-  if( unlikely(this->showPNodes))
-    PNode::getNullParent()->debugDraw(0);
+      this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));
+
+    AtmosphericEngine::getInstance()->draw();
+
+    if( unlikely( this->showBV))
+    {
+      CDEngine* engine = CDEngine::getInstance();
+      for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
+        engine->drawBV(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]), this->showBVLevel);
+    }
+
+    if( unlikely(this->showPNodes))
+      PNode::getNullParent()->debugDraw(0);
+
+    // draw the game ruls
+    if( likely(this->dataTank->gameRule != NULL))
+      this->dataTank->gameRule->draw();
+  }
 
   engine->draw();
-
-  // draw the game ruls
-  if( likely(this->dataTank->gameRule != NULL))
-    this->dataTank->gameRule->draw();
 }
 
Index: trunk/src/story_entities/game_world_data.cc
===================================================================
--- trunk/src/story_entities/game_world_data.cc	(revision 9391)
+++ trunk/src/story_entities/game_world_data.cc	(revision 9406)
@@ -61,5 +61,5 @@
 
 
-using namespace std;
+
 
 
@@ -194,5 +194,8 @@
 ErrorMessage GameWorldData::loadWorldEntities(const TiXmlElement* root)
 {
+
   const TiXmlElement* element = root->FirstChildElement("WorldEntities");
+  bool mouseCaptured = EventHandler::getInstance()->grabbedEvents();
+  EventHandler::getInstance()->grabEvents(false);
 
   if( element == NULL)
@@ -209,5 +212,5 @@
       BaseObject* created = Factory::fabricate(element);
       if( created != NULL )
-        PRINTF(4)("Created a %s: %s\n", created->getClassName(), created->getName());
+        PRINTF(4)("Created a %s: %s\n", created->getClassCName(), created->getCName());
 
       //todo do this more elegant
@@ -233,5 +236,5 @@
 
   Playable* playable;
-  const list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE);
+  const std::list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE);
   if (playableList != NULL && !playableList->empty())
   {
@@ -262,4 +265,6 @@
   /* init the pnode tree */
   PNode::getNullParent()->init();
+
+  EventHandler::getInstance()->grabEvents(mouseCaptured);
 
   return ErrorMessage();
@@ -284,5 +289,5 @@
       //    ClassList::debug( 3, CL_PARENT_NODE);
       //    PNode::getNullParent()->debugNode(0);
-      //    printf("%s::%s\n", nodeList->front()->getClassName(), nodeList->front()->getName());
+      //    printf("%s::%s\n", nodeList->front()->getClassCName(), nodeList->front()->getName());
       delete nodeList->front();
     }
Index: trunk/src/story_entities/game_world_data.h
===================================================================
--- trunk/src/story_entities/game_world_data.h	(revision 9391)
+++ trunk/src/story_entities/game_world_data.h	(revision 9406)
@@ -42,4 +42,5 @@
     void loadGameRule(const TiXmlElement* root);
 
+
   protected:
     virtual ErrorMessage loadGUI(const TiXmlElement* root);
Index: trunk/src/story_entities/menu/game_menu.cc
===================================================================
--- trunk/src/story_entities/menu/game_menu.cc	(revision 9391)
+++ trunk/src/story_entities/menu/game_menu.cc	(revision 9406)
@@ -152,14 +152,14 @@
     {
       OrxGui::GLGuiButton* startButton = new OrxGui::GLGuiPushButton("Play");
-      startButton->connect(SIGNAL(startButton, released), this, SLOT(GameMenu, showCampaigns));
+      startButton->released.connect(this, &GameMenu::showCampaigns);
       this->mainMenuBox->pack(startButton);
       startButton->select();
 
       OrxGui::GLGuiButton* networkButton = new OrxGui::GLGuiPushButton("MultiPlayer");
-      networkButton->connect(SIGNAL(networkButton, released), this, SLOT(GameMenu, showMultiPlayer));
+      networkButton->released.connect(this, &GameMenu::showMultiPlayer);
       this->mainMenuBox->pack(networkButton);
 
       OrxGui::GLGuiButton* optionsButton = new OrxGui::GLGuiPushButton("Options");
-      optionsButton->connect(SIGNAL(optionsButton, released), this, SLOT(GameMenu, showOptionsMenu));
+      optionsButton->released.connect(this, &GameMenu::showOptionsMenu);
       this->mainMenuBox->pack(optionsButton);
 
@@ -167,5 +167,5 @@
       OrxGui::GLGuiButton* quitButton = new OrxGui::GLGuiPushButton("Quit");
       this->mainMenuBox->pack(quitButton);
-      quitButton->connect(SIGNAL(quitButton, released), this, SLOT(GameMenu, quitMenu));
+      quitButton->released.connect(this, &GameMenu::quitMenu);
     }
   }
@@ -202,5 +202,5 @@
           printf("%s\n", se->getMenuScreenshoot().c_str());
           OrxGui::GLGuiImageButton* button = new OrxGui::GLGuiImageButton(se->getName(), se->getStoryID(), se->getMenuScreenshoot(), image);
-          button->connect(SIGNAL(button, startLevel), this, SLOT(GameMenu, startLevel));
+          button->startLevel.connect(this, &GameMenu::startLevel);
           labelBox->pack(button);
 
@@ -244,9 +244,9 @@
       OrxGui::GLGuiButton* clientButton = new OrxGui::GLGuiPushButton("Client");
       box->pack(clientButton);
-      clientButton->connect(SIGNAL(clientButton, released), this, SLOT(GameMenu, showClientMenu));
+      clientButton->released.connect(this, &GameMenu::showClientMenu);
 
       OrxGui::GLGuiButton* serverButton = new OrxGui::GLGuiPushButton("Server");
       box->pack(serverButton);
-      serverButton->connect(SIGNAL(serverButton, released), this, SLOT(GameMenu, showServerMenu));
+      serverButton->released.connect(this, &GameMenu::showServerMenu);
 
       networkBox->pack( box );
@@ -531,10 +531,10 @@
       this->ipInputLine->setText( Preferences::getInstance()->getString( "multiplayer", "lastVisitedServer", "localhost" ) );
       this->clientNetworkBox->pack( this->ipInputLine );
-      this->ipInputLine->connect(SIGNAL(ipInputLine, enterPushed), this, SLOT(GameMenu, connectToServer));
+      //this->ipInputLine->enterPushed.connect(this, &GameMenu::connectToServer); /// redo this.
       this->ipInputLine->select();
 
       OrxGui::GLGuiButton* connectButton = new OrxGui::GLGuiPushButton("Connect");
       clientNetworkBox->pack(connectButton);
-      connectButton->connect(SIGNAL(connectButton, released), this, SLOT(GameMenu, connectToServer));
+      connectButton->released.connect(this, &GameMenu::connectToServer);
     }
   }
@@ -574,5 +574,5 @@
       OrxGui::GLGuiButton* createButton = new OrxGui::GLGuiPushButton("Create Server");
       serverNetworkBox->pack(createButton);
-      createButton->connect(SIGNAL(createButton, released), this, SLOT(GameMenu, createServer));
+      createButton->released.connect(this, &GameMenu::createMasterServer);
     }
   }
@@ -593,5 +593,5 @@
 
   State::setOnline(true);
-  NetworkManager::getInstance()->establishConnection( this->ipInputLine->_getText(), 9999 );
+  NetworkManager::getInstance()->createClient( this->ipInputLine->_getText(), 9999 );
 
   Preferences::getInstance()->setString( "multiplayer", "lastVisitedServer", this->ipInputLine->_getText() );
@@ -600,10 +600,10 @@
 }
 
-void GameMenu::createServer( )
+void GameMenu::createMasterServer( )
 {
   PRINTF(0)("Create server\n" );
 
   State::setOnline(true);
-  NetworkManager::getInstance()->createServer( 9999 );
+  NetworkManager::getInstance()->createMasterServer( 9999 );
 
   this->startLevel( 5 );
Index: trunk/src/story_entities/menu/game_menu.h
===================================================================
--- trunk/src/story_entities/menu/game_menu.h	(revision 9391)
+++ trunk/src/story_entities/menu/game_menu.h	(revision 9406)
@@ -50,5 +50,5 @@
     
     void showServerMenu();
-    void createServer();
+    void createMasterServer();
 
 
Index: trunk/src/story_entities/menu/glgui_imagebutton.cc
===================================================================
--- trunk/src/story_entities/menu/glgui_imagebutton.cc	(revision 9391)
+++ trunk/src/story_entities/menu/glgui_imagebutton.cc	(revision 9406)
@@ -40,5 +40,5 @@
     GLGuiPushButton::releasing(pos, focused);
     if (focused)
-      this->emit(startLevel(this->levelID));
+      this->startLevel.emit(this->levelID);
   }
 
@@ -77,5 +77,5 @@
       {
 //        emit(released());
-        emit(startLevel(this->levelID));
+        startLevel.emit(this->levelID);
       }
       return true;
Index: trunk/src/story_entities/menu/glgui_imagebutton.h
===================================================================
--- trunk/src/story_entities/menu/glgui_imagebutton.h	(revision 9391)
+++ trunk/src/story_entities/menu/glgui_imagebutton.h	(revision 9406)
@@ -25,5 +25,5 @@
     void release();
 
-    DeclareSignal1(startLevel, int);
+    sigslot::signal1<int> startLevel;
 
   protected:
Index: trunk/src/story_entities/movie_loader.cc
===================================================================
--- trunk/src/story_entities/movie_loader.cc	(revision 9391)
+++ trunk/src/story_entities/movie_loader.cc	(revision 9406)
@@ -24,5 +24,5 @@
 
 
-using namespace std;
+
 
 CREATE_FACTORY(MovieLoader, CL_MOVIE_LOADER);
Index: trunk/src/story_entities/multi_player_world.cc
===================================================================
--- trunk/src/story_entities/multi_player_world.cc	(revision 9391)
+++ trunk/src/story_entities/multi_player_world.cc	(revision 9406)
@@ -31,6 +31,5 @@
 
 
-using namespace std;
-
+#include "glgui_handler.h"
 
 //! Register a command to print some multiplayer world infos
@@ -64,4 +63,5 @@
   if( this->dataTank)
     delete this->dataTank;
+  delete OrxGui::GLGuiHandler::getInstance( );
 }
 
Index: trunk/src/story_entities/multi_player_world_data.cc
===================================================================
--- trunk/src/story_entities/multi_player_world_data.cc	(revision 9391)
+++ trunk/src/story_entities/multi_player_world_data.cc	(revision 9406)
@@ -47,4 +47,5 @@
 #include "player_stats.h"
 
+#include "proxy/network_settings.h"
 
 #include "glmenu_imagescreen.h"
@@ -52,5 +53,5 @@
 
 
-using namespace std;
+
 
 
@@ -110,6 +111,6 @@
 {
   const TiXmlElement* element = NULL;
-  
-  if( NetworkManager::getInstance()->isGameServer() )
+
+  if( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
   {
     /* load the spawning points */
@@ -128,5 +129,5 @@
         BaseObject* created = Factory::fabricate(element);
         if( created != NULL )
-          printf("Created a Spawning Point %s: %s\n", created->getClassName(), created->getName());
+          printf("Created a Spawning Point %s: %s\n", created->getClassCName(), created->getCName());
 
         element = element->NextSiblingElement();
@@ -147,5 +148,5 @@
     element = element->FirstChildElement();
 
-    if( NetworkManager::getInstance()->isGameServer() )
+    if( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
     {
       while( element != NULL)
@@ -154,5 +155,5 @@
         BaseObject* created = Factory::fabricate(element);
         if( created != NULL )
-          PRINTF(1)("Created a %s: %s (0x%8x) from %s\n", created->getClassName(), created->getName(), created->getLeafClassID(), element->Value());
+          PRINTF(1)("Created a %s: %s (0x%8x) from %s\n", created->getClassCName(), created->getCName(), created->getLeafClassID(), element->Value());
         else
           PRINTF(1)("NetworkWorld: could not create this entity\n");
@@ -185,5 +186,5 @@
 
           if( created != NULL )
-            PRINTF(1)("Created a %s: %s (0x%8x) from %s\n", created->getClassName(), created->getName(), created->getLeafClassID(), element->Value());
+            PRINTF(1)("Created a %s: %s (0x%8x) from %s\n", created->getClassCName(), created->getCName(), created->getLeafClassID(), element->Value());
           else
             PRINTF(1)("NetworkWorld: could not create this entity\n");
@@ -205,5 +206,5 @@
 
 
-    if( NetworkManager::getInstance()->isGameServer())
+    if( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
     {
       this->localPlayer = new Player();
@@ -280,6 +281,8 @@
   GameWorldData::loadScene(root);
 
+//   LoadParamXML(root, "NetworkSettings", NetworkSettings::getInstance(), NetworkSettings, loadNetworkSettings);
+
   // create server playable
-  if ( NetworkManager::getInstance()->isGameServer() )
+  if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
   {
     NetworkGameManager::getInstance()->signalNewPlayer( 0 );
@@ -296,4 +299,7 @@
 ErrorMessage MultiPlayerWorldData::unloadScene()
 {
+  // delete the proxy settings
+  delete NetworkSettings::getInstance();
+
   /* call underlying function */
   return GameWorldData::unloadScene();
@@ -317,5 +323,5 @@
   {
     Playable* p = dynamic_cast<Playable*>(*entity);
-    PRINTF(0)("Got a playable, class: %s, name: %s, uid: %i\n", (*entity)->getClassName(), (*entity)->getName(), p->getUniqueID());
+    PRINTF(0)("Got a playable, class: %s, name: %s, uid: %i\n", (*entity)->getClassCName(), (*entity)->getCName(), p->getUniqueID());
   }
 
@@ -340,5 +346,5 @@
 
   PNode* cam = State::getCameraTargetNode();
-  PRINT(0)("Camera has target - class: %s, name: %s, uid: %i\n", cam->getClassName(), cam->getName(), cam->getUniqueID());
+  PRINT(0)("Camera has target - class: %s, name: %s, uid: %i\n", cam->getClassCName(), cam->getCName(), cam->getUniqueID());
 
   PRINT(0)("==================================================\n");
Index: trunk/src/story_entities/simple_game_menu.cc
===================================================================
--- trunk/src/story_entities/simple_game_menu.cc	(revision 9391)
+++ 	(revision )
@@ -1,763 +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: Patrick Boenzli
-
-*/
-
-#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD
-
-
-#include "simple_game_menu.h"
-
-#include "event_handler.h"
-
-#include "state.h"
-#include "class_list.h"
-
-#include "util/loading/load_param.h"
-#include "fast_factory.h"
-#include "util/loading/factory.h"
-#include "loading/resource_manager.h"
-
-#include "world_entity.h"
-#include "elements/image_entity.h"
-#include "terrain.h"
-#include "camera.h"
-
-#include "graphics_engine.h"
-#include "object_manager.h"
-#include "sound_engine.h"
-#include "sound_source.h"
-
-#include "cd_engine.h"
-
-#include "glgui.h"
-#include "gui/gl/specials/glgui_notifier.h"
-
-//! This creates a Factory to fabricate a SimpleGameMenu
-CREATE_FACTORY(SimpleGameMenu, CL_SIMPLE_GAME_MENU);
-
-
-
-SimpleGameMenu::SimpleGameMenu(const TiXmlElement* root)
-    : GameWorld()
-{
-  this->setClassID(CL_SIMPLE_GAME_MENU, "SimpleGameMenu");
-  this->setName("SimpleGameMenu uninitialized");
-
-  this->dataTank = new SimpleGameMenuData();
-
-  this->cameraVector = Vector(50.0, 0.0, 0.0);
-  this->menuLayers.push_back(MenuLayer());
-  this->menuLayers.push_back(MenuLayer());
-
-  this->layerIndex = 0;
-  this->menuSelectedIndex = 0;
-  this->selectorSource = NULL;
-
-
-  /// GUI
-  ///(this is as modular as it is possible).
-  OrxGui::GLGuiPushButton* pb = new OrxGui::GLGuiPushButton("PUSH ME");
-  //pb->connectSignal(OrxGui::Signal_release, this, createExecutor<SimpleGameMenu>(&SimpleGameMenu::enterGui));
-  pb->connect(SIGNAL(pb, released), this, SLOT(SimpleGameMenu, enterGui));
-  pb->show();
-  pb->setAbsCoor2D(50, 50);
-
-  OrxGui::GLGuiHandler::getInstance()->activateCursor();
-  OrxGui::GLGuiHandler::getInstance()->activate();
-  OrxGui::GLGuiHandler::getInstance()->cursor()->loadTextureSequence(ResourceManager::getInstance()->getDataDir() + "/" + "maps/reap_mouse/reap_mouse_##.png", 1, 49);
-  /////
-
-  if (root != NULL)
-    this->loadParams(root);
-
-  State::setMenuID(this->getNextStoryID());
-}
-
-/// HACK only for testing.
-void SimpleGameMenu::enterGui()
-{
-
-  OrxGui::GLGuiNotifier* notifier = new OrxGui::GLGuiNotifier();
-  notifier->show();
-  notifier->setAbsCoor2D(300, 300);
-
-
-
-  OrxGui::GLGuiBox* box = new OrxGui::GLGuiBox();
-  {
-    ///
-    OrxGui::GLGuiButton* dnpb = new OrxGui::GLGuiCheckButton("Push the button");
-
-    box->pack(dnpb);
-
-    OrxGui::GLGuiPushButton* rdnpb = new OrxGui::GLGuiPushButton("Quit ORXONOX!!");
-    rdnpb->connect(SIGNAL(rdnpb, released), this, SLOT(SimpleGameMenu, quitMenu));
-
-    box->pack(rdnpb);
-
-    OrxGui::GLGuiCheckButton* fullscreen = new OrxGui::GLGuiCheckButton("Fullscreen");
-    fullscreen->connect(SIGNAL(fullscreen, toggled), GraphicsEngine::getInstance(), SLOT(GraphicsEngine, setFullscreen));
-
-    box->pack(fullscreen);
-
-    OrxGui::GLGuiInputLine* input = new OrxGui::GLGuiInputLine();
-    input->setText("input some text here");
-    input->connect(SIGNAL(input, textChanged), notifier, SLOT(OrxGui::GLGuiNotifier, pushNotifyMessage));
-
-    box->pack(input);
-
-    OrxGui::GLGuiSlider* slider = new OrxGui::GLGuiSlider();
-    slider->connect(SIGNAL(slider, valueChanged), this, SLOT(SimpleGameMenu, TEST));
-    slider->setRange(0, 1);
-    slider->setValue(slider->min());
-    box->pack(slider);
-
-
-    OrxGui::GLGuiTable* table = new OrxGui::GLGuiTable(3, 3);
-    std::vector<std::string> headers;
-    headers.push_back("1");
-    headers.push_back("2");
-    headers.push_back("3");
-    table->setHeader(headers);
-    table->setEntry(1, 2, "Test");
-    table->setEntry(2, 1, "MultiLine SuperTest to see how it works");
-
-
-    box->pack(table);
-  }
-  box->setAbsCoor2D(50, 200);
-
-  box->showAll();
-
-
-  OrxGui::GLGuiBox* imageSelector = new OrxGui::GLGuiBox();
-  {
-    image = new OrxGui::GLGuiImage();
-    image->setWidgetSize(300, 300);
-    image->setAbsCoor2D(300, 300);
-    imageSelector->pack(image);
-
-    imageName = new OrxGui::GLGuiInputLine();
-    imageSelector->pack(imageName);
-
-    OrxGui::GLGuiSlider* slider = new OrxGui::GLGuiSlider();
-    slider->setWidgetSize(200, 30);
-    slider->setRange(0, 100);
-    slider->setStep(1);
-    slider->setValue(slider->min());
-    slider->connect(SIGNAL(slider, valueChanged), this, SLOT(SimpleGameMenu, setImage));
-
-    imageSelector->pack(slider);
-    slider->setValue(0);
-  }
-  imageSelector->showAll();
-  imageSelector->setAbsCoor2D(400, 30);
-
-
-  /////
-}
-
-
-#include "class_list.h"
-void SimpleGameMenu::setImage(int i)
-{
-  const std::list<BaseObject*>* textures = ClassList::getList(CL_TEXTURE);
-
-  if(textures)
-  {
-    std::list<BaseObject*>::const_iterator test = textures->begin();
-    std::list<BaseObject*>::const_iterator lastOK = textures->begin();
-    while (true)
-    {
-      if (--i == 0 || test == textures->end())
-        break;
-      if (dynamic_cast<Texture*>(*test)->getTexture() != 0)
-        lastOK = test;
-      test++;
-    }
-    this->image->loadImageFromTexture(*dynamic_cast<Texture*>(*lastOK));
-    this->imageName->setText((*lastOK)->getName());
-  }
-}
-
-
-#include "threading.h"
-void SimpleGameMenu::execURL() const
-{
-  std::string URL = "http://www.orxonox.net";
-  SDL_CreateThread(startURL, (void*)&URL);
-}
-
-#ifdef __OSX__
-#include <ApplicationServices/ApplicationServices.h>
-#elif defined __WIN32__
-//#include <shellapi.h>
-#endif
-
-int SimpleGameMenu::startURL(void* url)
-{
-  std::string URL = *(std::string*)url;
-#ifdef __linux__
-  system ((std::string("firefox ") + URL).c_str());
-#elif defined __OSX__
-  CFURLRef url_handle = CFURLCreateWithBytes (NULL, (UInt8 *)URL.c_str(), URL.size(),
-                        kCFStringEncodingASCII, NULL);
-  LSOpenCFURLRef (url_handle, NULL);
-  CFRelease (url_handle);
-#elif defined __WIN32__
-  /*  ShellExecute(GetActiveWindow(),
-               "open", URL.c_str(), NULL, NULL, SW_SHOWNORMAL);
-	       }*/
-#endif
-  PRINTF(3)("loaded external webpage %s\n", URL.c_str());
-}
-
-/**
-*  @brief remove the SimpleGameMenu from memory
-*
-*  delete everything explicitly, that isn't contained in the parenting tree!
-*  things contained in the tree are deleted automaticaly
-*/
-SimpleGameMenu::~SimpleGameMenu ()
-{
-  PRINTF(3)("SimpleGameMenu::~SimpleGameMenu() - deleting current world\n");
-
-  if( this->dataTank)
-    delete this->dataTank;
-  delete OrxGui::GLGuiHandler::getInstance( );
-}
-
-
-/**
-* @brief loads the parameters of a SimpleGameMenu from an XML-element
-* @param root the XML-element to load from
-*/
-void SimpleGameMenu::loadParams(const TiXmlElement* root)
-{
-  /* skip the GameWorld, since it does not define any useful loadParams for this class */
-  //static_cast<GameWorld*>(this)->loadParams(root);
-  GameWorld::loadParams(root);
-
-  PRINTF(4)("Loaded SimpleGameMenu specific stuff\n");
-}
-
-
-/**
-* @brief this is executed just before load
-*
-* since the load function sometimes needs data, that has been initialized
-* before the load and after the proceeding storyentity has finished
-*/
-ErrorMessage SimpleGameMenu::init()
-{
-  /* call underlying init funciton */
-  GameWorld::init();
-
-  this->subscribeEvent(ES_MENU, SDLK_UP);
-  this->subscribeEvent(ES_MENU, SDLK_DOWN);
-  this->subscribeEvent(ES_MENU, SDLK_RETURN);
-  this->subscribeEvent(ES_MENU, SDLK_SPACE);
-  this->subscribeEvent(ES_MENU, SDLK_ESCAPE);
-
-  this->dataTank->localCamera->setRelCoor(this->cameraVector);
-
-  GraphicsEngine::getInstance()->displayFPS(false);
-
-  this->layerIndex = 0;
-  this->menuSelectedIndex = 0;
-}
-
-
-/**
-* @brief load the data
-*/
-ErrorMessage SimpleGameMenu::loadData()
-{
-  GameWorld::loadData();
-
-  if (this->dataXML != NULL)
-  {
-    LoadParam(dataXML, "selector-sound", this, SimpleGameMenu, setSelectorSound);
-
-    TiXmlElement* element = this->dataXML->FirstChildElement("Elements");
-
-
-    if( element == NULL)
-    {
-      PRINTF(1)("SimpleGameMenu is missing 'Elements'\n");
-    }
-    else
-    {
-      element = element->FirstChildElement();
-      // load Players/Objects/Whatever
-      PRINTF(4)("Loading Elements\n");
-      while( element != NULL)
-      {
-        BaseObject* created = Factory::fabricate(element);
-        if( created != NULL )
-        {
-          PRINTF(4)("Created a %s::%s\n", created->getClassName(), created->getName());
-          if (!created->isA(CL_ELEMENT_2D))
-            PRINTF(2)("Error the Created Entity is not an Element2D but an %s::%s\n", created->getClassName(), created->getName());
-        }
-        element = element->NextSiblingElement();
-      }
-      PRINTF(4)("Done loading Elements\n");
-    }
-  }
-
-  /* get the menu list */
-  const std::list<BaseObject*>* imageEntityList = ClassList::getList(CL_IMAGE_ENTITY);
-  std::list<BaseObject*>::const_iterator entity;
-  for (entity = imageEntityList->begin(); entity != imageEntityList->end(); entity++)
-  {
-
-    if( !strcmp("Selector_Menu", (*entity)->getName()))
-    {
-      this->menuSelector = dynamic_cast<ImageEntity*>(*entity);
-      this->menuSelector->setBindNode((const PNode*)NULL);
-    }
-  }
-
-  imageEntityList = ClassList::getList(CL_TEXT_ELEMENT);
-  for (entity = imageEntityList->begin(); entity != imageEntityList->end(); entity++)
-  {
-    if( !strcmp( "StartGame_Menu", (*entity)->getName()))
-    {
-      this->menuStartGame = dynamic_cast<TextElement*>(*entity);
-      this->menuStartGame->setBindNode((const PNode*)NULL);
-      this->menuStartGame->setRelCoor2D(State::getResX() / 2.0f,
-                                        State::getResY() / 2.0f - 60.0f);
-      this->menuLayers[0].menuList.push_back(dynamic_cast<TextElement*>(*entity));
-
-    }
-    else if( !strcmp( "Multiplayer_Menu", (*entity)->getName()))
-    {
-      this->menuStartMultiplayerGame = dynamic_cast<TextElement*>(*entity);
-      this->menuStartMultiplayerGame->setBindNode((const PNode*)NULL);
-      this->menuStartMultiplayerGame->setRelCoor2D(State::getResX() / 2.0f,
-          State::getResY() / 2.0f + ((this->menuLayers[0].menuList.size() -1 ) * 60.0f));
-      this->menuLayers[0].menuList.push_back(dynamic_cast<TextElement*>(*entity));
-    }
-    else if( !strcmp( "Quit_Menu", (*entity)->getName()))
-    {
-      this->menuQuitGame = dynamic_cast<TextElement*>(*entity);
-      this->menuQuitGame->setBindNode((const PNode*)NULL);
-      this->menuQuitGame->setRelCoor2D(State::getResX() / 2.0f,
-                                       State::getResY() / 2.0f + ((this->menuLayers[0].menuList.size() -1 )* 60.0f));
-      this->menuLayers[0].menuList.push_back(dynamic_cast<TextElement*>(*entity));
-    }
-  }
-  this->menuSelected->getNullElement()->update2D(0.1f);
-  this->menuSelectedIndex = 0;
-  this->menuSelected = this->menuLayers[0].menuList[this->menuSelectedIndex];
-  this->sliderTo(this->menuSelected, 0.0f);
-
-
-  // loading the storyentities submenu (singleplayer)
-  const std::list<BaseObject*>* storyEntities = ClassList::getList(CL_STORY_ENTITY);
-  std::list<BaseObject*>::const_iterator it;
-  for( it = storyEntities->begin(); it != storyEntities->end(); it++)
-  {
-    StoryEntity* se = dynamic_cast<StoryEntity*>(*it);
-    if( se->isContainedInMenu())
-    {
-      this->menuLayers[1].storyList.push_back(se);
-
-      // generating menu item
-      TextElement* te = new TextElement();
-      te->setVisibility(false);
-      te->setText(se->getName());
-      te->setRelCoor2D(State::getResX() / 2.0f - 200.0f, State::getResY() / 2.0f + ((this->menuLayers[1].menuList.size() - 2.0f) * 60.0f));
-      this->menuLayers[1].menuList.push_back(te);
-
-      // generating screenshoot item
-      ImageEntity* ie = new ImageEntity();
-      ie->setVisibility(false);
-      ie->setBindNode((const PNode*)NULL);
-      ie->setTexture(se->getMenuScreenshoot());
-      ie->setRelCoor2D(State::getResX() / 2.0f + 250.0f, State::getResY() / 2.0f);
-      ie->setSize2D(140.0f, 105.0f);
-      this->menuLayers[1].screenshootList.push_back(ie);
-    }
-  }
-}
-
-/**
-* @brief set the Sound to play when switching menu entry.
-* @param selectorSound the sound to load.
-*/
-void SimpleGameMenu::setSelectorSound(const std::string& selectorSound)
-{
-  this->selectorSource = OrxSound::SoundEngine::getInstance()->createSource(selectorSound, NULL);
-}
-
-ErrorMessage SimpleGameMenu::unloadData()
-{
-  this->unsubscribeEvents(ES_MENU);
-
-  std::vector<MenuLayer>::iterator mit;
-  for(mit = this->menuLayers.begin(); mit != this->menuLayers.end(); mit++)
-  {
-    while(!(*mit).menuList.empty())
-    {
-      delete (*mit).menuList.back();
-      (*mit).menuList.pop_back();
-    }
-
-    (*mit).menuList.clear();
-    (*mit).storyList.clear();
-    (*mit).screenshootList.clear();
-  }
-
-  // delete the SoundSource.
-  if (this->selectorSource != NULL)
-    delete this->selectorSource;
-  this->selectorSource = NULL;
-
-  GameWorld::unloadData();
-}
-
-
-/**
-* @brief start the menu
-*/
-bool SimpleGameMenu::start()
-{
-  EventHandler::getInstance()->pushState(ES_MENU);
-
-  /* now call the underlying*/
-  GameWorld::start();
-}
-
-
-
-/**
-* stop the menu
-*/
-bool SimpleGameMenu::stop()
-{
-  EventHandler::getInstance()->popState();
-
-  /* now call the underlying*/
-  GameWorld::stop();
-}
-
-
-/**
-*  override the standard tick for more functionality
-*/
-void SimpleGameMenu::tick()
-{
-  GameWorld::tick();
-
-  // Make the GLGui tick.
-  OrxGui::GLGuiHandler::getInstance()->tick(this->dtS);
-
-  this->animateScene(this->dtS);
-}
-
-
-/**
-* @brief no collision detection in the menu
-*/
-void SimpleGameMenu::collide()
-{
-  //   this->dataTank->localCamera->
-}
-
-
-/**
-* @brief animate the scene
-*/
-void SimpleGameMenu::animateScene(float dt)
-{
-  Quaternion q(/*0.00005*/ dt * .1, Vector(0.0, 1.0, 0.0));
-  this->cameraVector = q.apply(this->cameraVector);
-  this->dataTank->localCamera->setRelCoor(this->cameraVector);
-  this->dataTank->localCamera->getTarget()->setRelCoorSoft(0,0,0);
-}
-
-void SimpleGameMenu::quitMenu()
-{
-  this->setNextStoryID(WORLD_ID_GAMEEND);
-  this->stop();
-}
-
-
-/**
-* @brief event dispatcher funciton
-* @param event the incoming event
-*/
-void SimpleGameMenu::process(const Event &event)
-{
-  /* ----------------- LAYER 1 ---------------*/
-  if( this->layerIndex == 0)
-  {
-    if( event.type == SDLK_RETURN && event.bPressed == true)
-    {
-      if( this->menuSelected == this->menuQuitGame)
-      {
-        this->setNextStoryID(WORLD_ID_GAMEEND);
-        this->stop();
-      }
-      if( this->menuSelected == this->menuStartGame)
-      {
-        // switch to first submenu
-        if( this->menuLayers[1].menuList.size() == 0)
-        {
-          PRINTF(1)("Haven't got any StoryEntities to play!\n");
-          return;
-        }
-
-        this->switchMenuLayer(this->layerIndex, 1);
-      }
-    }
-    if( event.type == SDLK_ESCAPE && event.bPressed == true)
-    {
-      this->setNextStoryID(WORLD_ID_GAMEEND);
-      this->stop();
-    }
-  }  /* ----------------- LAYER 2 ---------------*/
-  else if( this->layerIndex == 1)
-  {
-    if( event.type == SDLK_RETURN && event.bPressed == true)
-    {
-      this->setNextStoryID( this->menuLayers[1].storyList[this->menuSelectedIndex]->getStoryID());
-      this->stop();
-    }
-    if( event.type == SDLK_ESCAPE && event.bPressed == true)
-    {
-      this->switchMenuLayer(this->layerIndex, 0);
-    }
-  }
-
-
-
-  // The menu selction cursor
-  if( event.type == SDLK_DOWN && event.bPressed == true)
-  {
-    if(this->menuSelectedIndex < (this->menuLayers[this->layerIndex].menuList.size() - 1))
-    {
-      this->menuSelected = this->menuLayers[this->layerIndex].menuList[++this->menuSelectedIndex];
-      this->sliderTo(this->menuSelected, 5.0f);
-      if (this->selectorSource != NULL)
-        this->selectorSource->play();
-
-      if( this->layerIndex == 1)
-      {
-        this->menuLayers[1].screenshootList[this->menuSelectedIndex]->setVisibility(true);
-        this->menuLayers[1].screenshootList[this->menuSelectedIndex-1]->setVisibility(false);
-      }
-    }
-  }
-  else if( event.type == SDLK_UP && event.bPressed == true)
-  {
-    if(this->menuSelectedIndex > 0)
-    {
-      this->menuSelected = this->menuLayers[this->layerIndex].menuList[--this->menuSelectedIndex];
-      this->sliderTo(this->menuSelected, 5.0f);
-      if (this->selectorSource != NULL)
-        this->selectorSource->play();
-
-      if( this->layerIndex == 1)
-      {
-        this->menuLayers[1].screenshootList[this->menuSelectedIndex]->setVisibility(true);
-        this->menuLayers[1].screenshootList[this->menuSelectedIndex+1]->setVisibility(false);
-      }
-    }
-  }
-}
-
-
-/**
-* @brief switches to from one meny layer to an other
-* @param layer1 from layer
-* @param layer2 to layer
-*/
-void SimpleGameMenu::switchMenuLayer(int layer1, int layer2)
-{
-  // wrong sizes
-  if(layer1 >= this->menuLayers.size() || layer2 >= this->menuLayers.size())
-    return;
-
-
-  PRINTF(0)("Removing layer %i\n", layer1);
-  std::vector<TextElement*>::iterator te;
-  // fade old menu
-  for( te = this->menuLayers[layer1].menuList.begin(); te != this->menuLayers[layer1].menuList.end(); te++)
-  {
-    (*te)->setVisibility(false);
-  }
-
-  std::vector<ImageEntity*>::iterator it;
-
-  //also fade the screenshots if in level choosement mode
-  for( it = this->menuLayers[layer1].screenshootList.begin(); it != this->menuLayers[layer1].screenshootList.end(); it++)
-  {
-    (*it)->setVisibility(false);
-  }
-
-
-  PRINTF(0)("Showing layer %i\n", layer1);
-  // beam here the new menu
-  for( te = this->menuLayers[layer2].menuList.begin(); te != this->menuLayers[layer2].menuList.end(); te++ )
-  {
-    (*te)->setVisibility(true);
-  }
-
-
-  this->layerIndex = layer2;
-  this->menuSelected = this->menuLayers[layer2].menuList[0];
-  this->menuSelector->setAbsCoor2D(this->menuSelected->getAbsCoor2D() + Vector2D(0, this->menuSelected->getSizeY2D() *.5));
-  this->menuSelector->setSize2D(this->menuSelected->getSizeX2D()*.7, this->menuSelected->getSizeY2D());
-  this->menuSelectedIndex = 0;
-
-  if( layer2 == 1)
-    this->menuLayers[layer2].screenshootList[0]->setVisibility(true);
-}
-
-void SimpleGameMenu::sliderTo(const Element2D* element, float bias)
-{
-  if (bias > 0.0)
-  {
-    this->menuSelector->setAbsCoorSoft2D(element->getAbsCoor2D() + Vector2D(0, element->getSizeY2D() *.5), bias);
-    this->menuSelector->setSizeSoft2D(element->getSizeX2D()*.7, element->getSizeY2D(), bias);
-  }
-  else
-  {
-    this->menuSelector->setAbsCoor2D(element->getAbsCoor2D() + Vector2D(0, element->getSizeY2D() *.5));
-    this->menuSelector->setSize2D(element->getSizeX2D()*.7, element->getSizeY2D());
-  }
-}
-
-
-
-/**********************************************************************************************
-SimpleGameMenuData
-**********************************************************************************************/
-
-
-/**
-* SimpleGameMenuData constructor
-*/
-SimpleGameMenuData::SimpleGameMenuData()
-{}
-
-/**
-* SimpleGameMenuData decontructor
-*/
-SimpleGameMenuData::~SimpleGameMenuData()
-{}
-
-
-/**
-*  initialize the GameWorldDataData
-*/
-ErrorMessage SimpleGameMenuData::init()
-{
-  /* call underlying function */
-  GameWorldData::init();
-}
-
-
-/**
-*  loads the GUI data
-* @param root reference to the xml root element
-*/
-ErrorMessage SimpleGameMenuData::loadGUI(const TiXmlElement* root)
-{
-  /* call underlying function */
-  GameWorldData::loadGUI(root);
-}
-
-
-/**
-*  unloads the GUI data
-*/
-ErrorMessage SimpleGameMenuData::unloadGUI()
-{
-  /* call underlying function */
-  GameWorldData::unloadGUI();
-}
-
-
-/**
-*  overloads the GameWorld::loadWorldEntities(...) class since the menu WorldEntity loading is different (less loading stuff)
-* @param root reference to the xml root parameter
-*/
-ErrorMessage SimpleGameMenuData::loadWorldEntities(const TiXmlElement* root)
-{
-  GameWorldData::loadWorldEntities(root);
-  /*
-  const TiXmlElement* element = root->FirstChildElement("WorldEntities");
-
-  if( element != NULL)
-  {
-  element = element->FirstChildElement();
-  PRINTF(4)("Loading WorldEntities\n");
-  while(element != NULL)
-  {
-  BaseObject* created = Factory::fabricate(element);
-  if( created != NULL )
-  printf("Created a %s: %s\n", created->getClassName(), created->getName());
-
-  if( element->Value() == "SkyBox")
-  this->sky = dynamic_cast<WorldEntity*>(created);
-  if( element->Value() == "Terrain")
-  this->terrain = dynamic_cast<Terrain*>(created);
-  element = element->NextSiblingElement();
-  }
-
-  PRINTF(4)("Done loading WorldEntities\n");
-  }
-
-  // init the pnode tree
-  PNode::getNullParent()->init();
-  */
-}
-
-
-/**
-*  unloads the world entities from the xml file
-*/
-ErrorMessage SimpleGameMenuData::unloadWorldEntities()
-{
-  /* call underlying function */
-  GameWorldData::unloadWorldEntities();
-}
-
-
-/**
-*  loads the scene data
-* @param root reference to the xml root element
-*/
-ErrorMessage SimpleGameMenuData::loadScene(const TiXmlElement* root)
-{
-  /* call underlying function */
-  GameWorldData::loadScene(root);
-}
-
-
-/**
-*  unloads the scene data
-*/
-ErrorMessage SimpleGameMenuData::unloadScene()
-{
-  /* call underlying function */
-  GameWorldData::unloadScene();
-}
-
-
-
Index: trunk/src/story_entities/simple_game_menu.h
===================================================================
--- trunk/src/story_entities/simple_game_menu.h	(revision 9391)
+++ 	(revision )
@@ -1,134 +1,0 @@
-/*!
- * @file simple_game_menu.h
- *  a StoryEntity that contains a simple game menu
- */
-
-#ifndef _SIMPLE_GAME_MENU_H
-#define _SIMPLE_GAME_MENU_H
-
-
-#include "game_world.h"
-#include "event_listener.h"
-#include "game_world_data.h"
-#include <vector>
-#include "vector.h"
-
-
-#include "elements/text_element.h"
-
-#include "glgui.h"
-
-class SimpleGameMenuData;
-class TiXmlElement;
-class ImageEntity;
-
-namespace OrxSound { class SoundSource; }
-
-class MenuLayer
-{
-  public:
-    MenuLayer() {}
-    virtual ~MenuLayer() {}
-
-
-  public:
-    std::vector<TextElement*>         menuList;                        //!< the list of the menu items
-    std::vector<StoryEntity*>         storyList;                       //!< the list of the StoryEntities for the menu
-    std::vector<ImageEntity*>         screenshootList;                 //!< list of the screen shoots FIXME: make a better structure for this stuff
-};
-
-
-//! a simple game menu based on a story entity
-/**
- * This is a simple menu, that is based on the StoryEntity. Therefore this menu is absolutly
- * loadable and is exchangeable very easely :D
- */
-class SimpleGameMenu : virtual public GameWorld, virtual public EventListener
-{
-
-  public:
-    SimpleGameMenu(const TiXmlElement* root = NULL);
-    virtual ~SimpleGameMenu();
-
-    /// TODO TAKE THIS OUT
-    void enterGui();
-    void execURL() const;
-    static int startURL(void* data);
-
-    void setImage(int i);
-    OrxGui::GLGuiImage* image;
-    OrxGui::GLGuiInputLine* imageName;
-    ///
-    virtual void loadParams(const TiXmlElement* root);
-
-    virtual ErrorMessage init();
-    virtual ErrorMessage loadData();
-    virtual ErrorMessage unloadData();
-
-    virtual bool start();
-    virtual bool stop();
-
-    virtual void process(const Event &event);
-
-
-    void startLevel(int level);
-    void quitMenu();
-
-    void TEST(int val) { printf("TEST %d\n", val); }
-
-  protected:
-    virtual void tick();
-    virtual void collide();
-
-
-  private:
-    void animateScene(float dt);
-    void switchMenuLayer(int layer1, int layer2);
-    void sliderTo(const Element2D* element, float bias = 0.0f);
-    void setSelectorSound(const std::string& selectorSound);
-
-
-  private:
-    std::vector<MenuLayer>            menuLayers;                      //!< the menu layer
-    MenuLayer*                        selectedLayer;                   //!< the selected menu layer
-    int                               layerIndex;
-
-    //std::vector<ImageEntity*>         menuList;                        //!< the list of the menu items
-    ImageEntity*                      menuSelector;                    //!< ref to the selector image
-    TextElement*                      menuSelected;                    //!< ref to the selected menu entity
-    TextElement*                      menuStartGame;
-    TextElement*                      menuStartMultiplayerGame;
-    TextElement*                      menuQuitGame;
-    int                               menuSelectedIndex;
-
-    Vector                            cameraVector;
-
-    OrxSound::SoundSource*            selectorSource;
-};
-
-
-
-//! the simple game menu data
-class SimpleGameMenuData : public GameWorldData
-{
-
-  public:
-    SimpleGameMenuData();
-    virtual ~SimpleGameMenuData();
-
-    virtual ErrorMessage init();
-
-
-  protected:
-    virtual ErrorMessage loadGUI(const TiXmlElement* root);
-    virtual ErrorMessage loadWorldEntities(const TiXmlElement* root);
-    virtual ErrorMessage loadScene(const TiXmlElement* root);
-
-    virtual ErrorMessage unloadGUI();
-    virtual ErrorMessage unloadWorldEntities();
-    virtual ErrorMessage unloadScene();
-
-};
-
-
-#endif /* _GAME_WORLD_H */
Index: trunk/src/story_entities/single_player_world.cc
===================================================================
--- trunk/src/story_entities/single_player_world.cc	(revision 9391)
+++ trunk/src/story_entities/single_player_world.cc	(revision 9406)
@@ -30,5 +30,5 @@
 
 
-using namespace std;
+
 
 
Index: trunk/src/story_entities/single_player_world_data.cc
===================================================================
--- trunk/src/story_entities/single_player_world_data.cc	(revision 9391)
+++ trunk/src/story_entities/single_player_world_data.cc	(revision 9406)
@@ -21,5 +21,5 @@
 
 
-using namespace std;
+
 
 
Index: trunk/src/story_entities/story_entity.cc
===================================================================
--- trunk/src/story_entities/story_entity.cc	(revision 9391)
+++ trunk/src/story_entities/story_entity.cc	(revision 9406)
@@ -26,5 +26,5 @@
 
 
-using namespace std;
+
 
 
Index: trunk/src/subprojects/benchmark.cc
===================================================================
--- trunk/src/subprojects/benchmark.cc	(revision 9391)
+++ trunk/src/subprojects/benchmark.cc	(revision 9406)
@@ -56,5 +56,5 @@
 
   // first measure the time overhead:
-  unsigned long ini, end, dt, tmp;
+  unsigned long ini, end, dt;
   rdtscl(ini); rdtscl(end);
   dt = end - ini;
@@ -172,5 +172,4 @@
 
       mittel = 0;
-      BaseObject* bo = new BaseObject();
       for(i = 0; i < ITERATIONS; ++i)
         {
Index: trunk/src/subprojects/collision_detection/collision_test_entity.cc
===================================================================
--- trunk/src/subprojects/collision_detection/collision_test_entity.cc	(revision 9391)
+++ trunk/src/subprojects/collision_detection/collision_test_entity.cc	(revision 9406)
@@ -25,5 +25,5 @@
 #include "util/loading/factory.h"
 
-using namespace std;
+
 CREATE_FACTORY(CollisionTestEntity, CL_ENVIRONMENT);
 
Index: trunk/src/subprojects/network/network_unit_test.cc
===================================================================
--- trunk/src/subprojects/network/network_unit_test.cc	(revision 9391)
+++ trunk/src/subprojects/network/network_unit_test.cc	(revision 9406)
@@ -205,13 +205,13 @@
 
   /* create a server stream */
-  nm->createServer(port);
+  nm->createMasterServer(port);
 
   /* esatblish a connection */
-  IPaddress ip;
+  IP ip;
   int error = SDLNet_ResolveHost(&ip, "127.0.0.1", port);
   //SDLNet_ResolveHost(&ip, "localhost", port);
   if(error == -1)
     printf("\n\nerror on address resolution, program inconsistancy\n\n");
-  nm->establishConnection("localhost", port);
+  nm->createClient("localhost", port);
   nm->connectSynchronizeable( *clientSync );
   /* adding some break for connection setup */
@@ -262,5 +262,5 @@
   netMan->initialize();
   
-  netMan->createServer(/**ss, */ 9999);
+  netMan->createMasterServer(/**ss, */ 9999);
   
   SimpleSync* ss = new SimpleSync("Server");
@@ -307,5 +307,5 @@
     host = "localhost";
   
-  netMan->establishConnection(host, 9999);
+  netMan->createClient(host, 9999);
   
 //  SimpleSync* ss = new SimpleSync("SimpleSync");
@@ -353,5 +353,5 @@
   printf("Connecting to %s, on port %i\n", name, port);
 
-  IPaddress ip;
+  IP ip;
   int error = SDLNet_ResolveHost(&ip, name, port);
   if(error == -1)
@@ -361,5 +361,5 @@
   Synchronizeable* ss = new SimpleSync("SimpleSync\0");
 
-  netMan->establishConnection( name, port );
+  netMan->createClient( name, port );
   netMan->connectSynchronizeable( *ss );
 
Index: trunk/src/subprojects/recapture_mouse/Makefile.am
===================================================================
--- trunk/src/subprojects/recapture_mouse/Makefile.am	(revision 9406)
+++ trunk/src/subprojects/recapture_mouse/Makefile.am	(revision 9406)
@@ -0,0 +1,29 @@
+MAINSRCDIR=../..
+include $(MAINSRCDIR)/defs/include_paths.am
+
+LIB_PREFIX=$(MAINSRCDIR)/lib
+include $(MAINSRCDIR)/lib/BuildLibs.am
+
+
+importer_LDFLAGS = \
+		$(MWINDOWS)
+
+
+bin_PROGRAMS = \
+		recapturemouse
+
+
+DEPENDENCIES = \
+		$(MAINSRCDIR)/world_entities/libORXwe.a \
+		$(libORXlibs_a_LIBRARIES_) \
+		$(MAINSRCDIR)/util/libORXutils.a
+
+LDADD = \
+		$(MAINSRCDIR)/util/libORXutils.a \
+		$(libORXlibs_a_LIBRARIES_) \
+		$(MAINSRCDIR)/world_entities/libORXwe.a \
+		$(libORXlibs_a_LIBRARIES_) \
+		$(MAINSRCDIR)/util/libORXutils.a
+
+recapturemouse_SOURCES= \
+		recapturer.cc
Index: trunk/src/subprojects/recapture_mouse/recapturer.cc
===================================================================
--- trunk/src/subprojects/recapture_mouse/recapturer.cc	(revision 9406)
+++ trunk/src/subprojects/recapture_mouse/recapturer.cc	(revision 9406)
@@ -0,0 +1,27 @@
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+
+   this file extends the framework file, so it renders what i want.
+*/
+
+#include "event_handler.h"
+
+int verbose = 3;
+
+int main(int argc, char** argv)
+{
+  EventHandler::getInstance()->grabEvents(true);
+  EventHandler::getInstance()->grabEvents(false);
+  exit(-1);
+}
Index: trunk/src/util/Makefile.am
===================================================================
--- trunk/src/util/Makefile.am	(revision 9391)
+++ trunk/src/util/Makefile.am	(revision 9406)
@@ -14,4 +14,6 @@
 			singleplayer_shootemup.cc \
 			\
+			\
+			\
 			mission_goal.cc\
 			kill_target.cc\
@@ -24,5 +26,7 @@
 			animation/animation_player.cc \
 			\
-			track/pilot_node.cc
+			track/pilot_node.cc \
+			\
+			network_stats_widget.cc
 
 #			track/track_manager.cc \
@@ -50,5 +54,8 @@
 			animation/t_animation.h \
 			\
-			track/pilot_node.h
+			track/pilot_node.h \
+			\
+			network_stats_widget.h
+
 
 #			track/track_manager.h \
Index: trunk/src/util/animation/animation3d.cc
===================================================================
--- trunk/src/util/animation/animation3d.cc	(revision 9391)
+++ trunk/src/util/animation/animation3d.cc	(revision 9406)
@@ -25,5 +25,5 @@
 #include "p_node.h"
 
-using namespace std;
+
 
 /**
Index: trunk/src/util/animation/animation_player.cc
===================================================================
--- trunk/src/util/animation/animation_player.cc	(revision 9391)
+++ trunk/src/util/animation/animation_player.cc	(revision 9406)
@@ -20,5 +20,5 @@
 #include "compiler.h"
 
-using namespace std;
+
 
 
@@ -100,5 +100,5 @@
   {
       // iterate through all the animations and tick them.
-    list<Animation*>::iterator anim;
+    std::list<Animation*>::iterator anim;
     for (anim = this->animationList.begin(); anim != this->animationList.end(); anim++)
     {
@@ -135,5 +135,5 @@
 Animation* AnimationPlayer::getAnimationFromBaseObject(const BaseObject* baseObject) const
 {
-  list<Animation*>::const_iterator anim;
+  std::list<Animation*>::const_iterator anim;
   for (anim = this->animationList.begin(); anim != this->animationList.end(); anim++)
     if((*anim)->getBaseObject() == baseObject)
@@ -156,5 +156,5 @@
   PRINT(0)("-Animation Information---------------+\n");
   // Per ANIMATION DEBUG
-  list<Animation*>::iterator anim;
+  std::list<Animation*>::iterator anim;
   for (anim = this->animationList.begin(); anim != this->animationList.end(); anim++)
     {
Index: trunk/src/util/fast_factory.cc
===================================================================
--- trunk/src/util/fast_factory.cc	(revision 9391)
+++ trunk/src/util/fast_factory.cc	(revision 9406)
@@ -21,5 +21,5 @@
 #include <string.h>
 
-using namespace std;
+
 
 /**
@@ -79,5 +79,5 @@
 void FastFactory::registerFastFactory(FastFactory* fastFactory)
 {
-  PRINTF(4)("Registered FastFactory for '%s'\n", fastFactory->getName());
+  PRINTF(4)("Registered FastFactory for '%s'\n", fastFactory->getCName());
 
   if( FastFactory::first == NULL)
@@ -128,5 +128,5 @@
     while (tmpFac != NULL)
     {
-      if (fastFactoryName == tmpFac->getName())
+      if (fastFactoryName == tmpFac->getCName())
         return tmpFac;
       tmpFac = tmpFac->next;
@@ -145,5 +145,5 @@
   while (tmpFac != NULL)
   {
-    PRINTF(4)("DELETEING ALL OF %s\n",tmpFac->getName());
+    PRINTF(4)("DELETEING ALL OF %s\n",tmpFac->getCName());
     tmpFac->flush(hardFLUSH);
     tmpFac = tmpFac->next;
@@ -188,5 +188,5 @@
 /*  if (this->storedDeadObjects + this->storedLivingObjects >= count)
   {
-  PRINTF(3)("not creating new Objects for class %s, because the requested count already exists\n", this->getClassName());
+  PRINTF(3)("not creating new Objects for class %s, because the requested count already exists\n", this->getClassCName());
 }*/
   for (unsigned int i = this->storedDeadObjects; i < count; i++)
@@ -202,10 +202,10 @@
 BaseObject* FastFactory::resurrect()
 {
-  PRINTF(4)("Resurecting Object of type %s\n", this->getName());
+  PRINTF(4)("Resurecting Object of type %s\n", this->getCName());
   if (unlikely(this->deadList == NULL))
   {
     PRINTF(3)("The deadList of Class %s is empty, this may be either because it has not been filled yet, or the cache is to small.\n" \
         "  Developer: try increasing the count with FastFactory::prepare(contHigher than actual)\n" \
-        "    Fabricating a new %s\n", this->getName(), this->getName());
+        "    Fabricating a new %s\n", this->getCName(), this->getCName());
     this->fabricate();
     return this->resurrect();
Index: trunk/src/util/game_rules.cc
===================================================================
--- trunk/src/util/game_rules.cc	(revision 9391)
+++ trunk/src/util/game_rules.cc	(revision 9406)
@@ -27,5 +27,5 @@
 
 
-using namespace std;
+
 
 
@@ -50,5 +50,4 @@
   BaseObject::loadParams(root);
 
-  PRINTF(0)("GameRules::loadParams(...) hit me\n");
   LoadParamXML(root, "MissionGoal", this, GameRules, loadMissionGoal)
       .describe("an XML-Element to load the missions from");
@@ -59,5 +58,5 @@
 void GameRules::loadMissionGoal(const TiXmlElement* root)
 {
-  PRINTF(0)("Trying to load MissionGoals\n");
+  PRINTF(4)("Trying to load MissionGoals\n");
   const TiXmlElement* element = root->FirstChildElement();
   while( element != NULL)
@@ -88,8 +87,8 @@
 void GameRules::registerKill(const Kill& kill)
 {
-  if ( !SharedNetworkData::getInstance()->isGameServer() )
+  if ( SharedNetworkData::getInstance()->isClient() )
     return;
 
-  PRINTF(0)("Received Event: Kill\n");
+  PRINTF(4)("Received Event: Kill\n");
 
   this->killList.push_back( kill );
Index: trunk/src/util/hud.cc
===================================================================
--- trunk/src/util/hud.cc	(revision 9391)
+++ trunk/src/util/hud.cc	(revision 9406)
@@ -155,5 +155,5 @@
       if (weapon != NULL)
       {
-        //PRINTF(0)("WEAPON %s::%s in Slots\n", weapon->getClassName(), weapon->getName());
+        //PRINTF(0)("WEAPON %s::%s in Slots\n", weapon->getClassCName(), weapon->getName());
         weapon->getEnergyWidget()->show();
         weapon->getEnergyWidget()->setBackgroundColor(Color(.8,.2,.11, 0.1));
@@ -215,5 +215,5 @@
     (*weaponWidget)->setWidgetSize(.02*this->resX, .1 *this->resY);
     (*weaponWidget)->show();
-    //printf("update thing %s::%s\n", (*weaponWidget)->getClassName(), (*weaponWidget)->getName());
+    //printf("update thing %s::%s\n", (*weaponWidget)->getClassCName(), (*weaponWidget)->getName());
   }
 }
Index: trunk/src/util/kill.cc
===================================================================
--- trunk/src/util/kill.cc	(revision 9391)
+++ trunk/src/util/kill.cc	(revision 9406)
@@ -19,5 +19,5 @@
 #include "world_entity.h"
 
-using namespace std;
 
 
+
Index: trunk/src/util/kill_target.cc
===================================================================
--- trunk/src/util/kill_target.cc	(revision 9391)
+++ trunk/src/util/kill_target.cc	(revision 9406)
@@ -21,5 +21,5 @@
 #include "util/loading/load_param.h"
 
-using namespace std;
+
 
 CREATE_FACTORY(KillTarget, CL_KILL_TARGET);
@@ -56,4 +56,7 @@
 
 
-MissionState KillTarget::checkMissionGoal(float dt) {}
+MissionState KillTarget::checkMissionGoal(float dt)
+{
 
+}
+
Index: trunk/src/util/mission_goal.cc
===================================================================
--- trunk/src/util/mission_goal.cc	(revision 9391)
+++ trunk/src/util/mission_goal.cc	(revision 9406)
@@ -22,5 +22,5 @@
 #include "util/loading/load_param.h"
 
-using namespace std;
+
 
 
Index: trunk/src/util/multiplayer_team_deathmatch.cc
===================================================================
--- trunk/src/util/multiplayer_team_deathmatch.cc	(revision 9391)
+++ trunk/src/util/multiplayer_team_deathmatch.cc	(revision 9406)
@@ -49,5 +49,5 @@
 
 
-using namespace std;
+
 
 
@@ -87,5 +87,5 @@
   this->input = new OrxGui::GLGuiInputLine();
   this->input->setAbsCoor2D(180, 5);
-  this->input->connect(SIGNAL(input, enterPushed), this, SLOT(MultiplayerTeamDeathmatch, onInputEnter));
+  this->input->enterPushed.connect(this, &MultiplayerTeamDeathmatch::onInputEnter);
 }
 
@@ -154,17 +154,17 @@
       OrxGui::GLGuiPushButton * buttonSpectator = new OrxGui::GLGuiPushButton("Spectator");
       box->pack( buttonSpectator );
-      buttonSpectator->connect(SIGNAL(buttonSpectator, released), this, SLOT(MultiplayerTeamDeathmatch, onButtonSpectator));
+      buttonSpectator->released.connect(this, &MultiplayerTeamDeathmatch::onButtonSpectator);
 
       OrxGui::GLGuiPushButton * buttonRandom = new OrxGui::GLGuiPushButton("Random");
       box->pack( buttonRandom );
-      buttonRandom->connect(SIGNAL(buttonRandom, released), this, SLOT(MultiplayerTeamDeathmatch, onButtonRandom));
+      buttonRandom->released.connect(this, &MultiplayerTeamDeathmatch::onButtonRandom);
 
       OrxGui::GLGuiPushButton * buttonTeam0 = new OrxGui::GLGuiPushButton("Blue Team");
       box->pack( buttonTeam0 );
-      buttonTeam0->connect(SIGNAL(buttonTeam0, released), this, SLOT(MultiplayerTeamDeathmatch, onButtonTeam0));
+      buttonTeam0->released.connect(this, &MultiplayerTeamDeathmatch::onButtonTeam0);
 
       OrxGui::GLGuiPushButton * buttonTeam1 = new OrxGui::GLGuiPushButton("Red Team");
       box->pack( buttonTeam1 );
-      buttonTeam1->connect(SIGNAL(buttonTeam1, released), this, SLOT(MultiplayerTeamDeathmatch, onButtonTeam1));
+      buttonTeam1->released.connect(this, &MultiplayerTeamDeathmatch::onButtonTeam1);
 
       if ( bShowTeamChange )
@@ -172,10 +172,10 @@
         OrxGui::GLGuiPushButton * buttonCancel = new OrxGui::GLGuiPushButton("Cancel");
         box->pack( buttonCancel );
-        buttonCancel->connect(SIGNAL(buttonCancel, released), this, SLOT(MultiplayerTeamDeathmatch, onButtonCancel));
+        buttonCancel->released.connect(this, &MultiplayerTeamDeathmatch::onButtonCancel);
       }
 
       OrxGui::GLGuiPushButton * buttonExit = new OrxGui::GLGuiPushButton("Exit");
       box->pack( buttonExit );
-      buttonExit->connect(SIGNAL(buttonExit, released), this, SLOT(MultiplayerTeamDeathmatch, onButtonExit));
+      buttonExit->released.connect(this, &MultiplayerTeamDeathmatch::onButtonExit);
 
       box->showAll();
@@ -204,5 +204,5 @@
   assignPlayable();
 
-  if ( !SharedNetworkData::getInstance()->isGameServer() )
+  if ( SharedNetworkData::getInstance()->isClient() )
     return;
 
@@ -214,5 +214,5 @@
     this->killList.erase( this->killList.begin() );
   }
-  
+
 
 
@@ -268,5 +268,5 @@
 void MultiplayerTeamDeathmatch::checkGameRules()
 {
-  if ( !SharedNetworkData::getInstance()->isGameServer() )
+  if ( SharedNetworkData::getInstance()->isClient() )
     return;
 
@@ -320,5 +320,5 @@
       return "maps/male_fiend.pcx";
   }
-  
+
   return "";
 }
@@ -330,5 +330,5 @@
     return 10.0f;
   }
-  
+
   return 1.0f;
 }
@@ -680,5 +680,5 @@
   char st[10];
   int i = 0;
-  
+
   i = 2;
   for ( TeamScoreList::const_iterator it = scoreList[0].begin(); it != scoreList[0].end(); it++ )
@@ -719,13 +719,13 @@
     return;
   }
-  
+
   int killerUserId = killer->getOwner();
   int victimUserId = victim->getOwner();
-  
-  PRINTF(0)("%d %d %x %x %s %s\n", killerUserId, victimUserId, killer, victim, killer->getClassName(), victim->getClassName());
+
+  PRINTF(0)("%d %d %x %x %s %s\n", killerUserId, victimUserId, killer, victim, killer->getClassCName(), victim->getClassCName());
 
   PlayerStats & victimStats = *PlayerStats::getStats( victimUserId );
   PlayerStats & killerStats = *PlayerStats::getStats( killerUserId );
-  
+
   if ( killerStats.getPlayable() != killer || victimStats.getPlayable() != victim )
   {
Index: trunk/src/util/network_game_rules.cc
===================================================================
--- trunk/src/util/network_game_rules.cc	(revision 9391)
+++ trunk/src/util/network_game_rules.cc	(revision 9406)
@@ -20,5 +20,5 @@
 #include "network_game_manager.h"
 
-using namespace std;
+
 
 
Index: trunk/src/util/network_stats_widget.cc
===================================================================
--- trunk/src/util/network_stats_widget.cc	(revision 9406)
+++ trunk/src/util/network_stats_widget.cc	(revision 9406)
@@ -0,0 +1,210 @@
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+*/
+
+//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
+
+#include "network_stats_widget.h"
+
+#include "multi_type.h"
+
+namespace OrxGui
+{
+  HostWidget::HostWidget(const std::string& name, const IP& ip)
+      : GLGuiBox(Horizontal)
+  {
+    this->setName(name);
+    this->setIP(ip);
+
+    this->pack(&this->_name);
+    this->pack(&this->_ip);
+  }
+
+  void HostWidget::showing()
+  {
+    this->_name.show();
+    this->_ip.show();
+  }
+
+  void HostWidget::hiding()
+  {
+    this->_name.hide();
+    this->_ip.hide();
+  }
+
+
+
+  //======================================================//
+
+
+  ProxyWidget::ProxyWidget(const std::string& proxyName, const IP& ip)
+  : _proxyWidget(proxyName, ip)
+  {
+    this->_clientNameWidth = 100.0f;
+    this->pack(&_proxyWidget);
+  }
+
+  void ProxyWidget::addClient(const std::string& name, const IP& ip)
+  {
+    HostWidget* newClient = new HostWidget(name, ip);
+    newClient->setNameWidth(this->_clientNameWidth);
+
+    this->pack(newClient);
+
+    if (this->isVisible())
+      newClient->show();
+  }
+
+  bool ProxyWidget::removeClient(const IP& ip)
+  {
+    std::vector<HostWidget*>::iterator rmIt;
+    for(rmIt = this->_clients.begin(); rmIt != this->_clients.end(); ++rmIt)
+    {
+      if (*(*rmIt) == ip)
+      {
+        delete (*rmIt);
+        this->_clients.erase(rmIt);
+        return true;
+      }
+    }
+    return false;
+  }
+
+  bool ProxyWidget::removeClient(const std::string& name)
+  {
+    std::vector<HostWidget*>::iterator rmIt;
+    for(rmIt = this->_clients.begin(); rmIt != this->_clients.end(); ++rmIt)
+    {
+      if (*(*rmIt) == name)
+      {
+        delete (*rmIt);
+        this->_clients.erase(rmIt);
+        return true;
+      }
+    }
+    return false;
+
+  }
+
+  bool ProxyWidget::removeClient(const std::string& name, const IP& ip)
+  {
+    std::vector<HostWidget*>::iterator rmIt;
+    for(rmIt = this->_clients.begin(); rmIt != this->_clients.end(); ++rmIt)
+    {
+      if (*(*rmIt) == ip && *(*rmIt) == name)
+      {
+        delete (*rmIt);
+        this->_clients.erase(rmIt);
+        return true;
+      }
+    }
+    return false;
+  }
+
+
+  void ProxyWidget::setClientNameWidths(float width)
+  {
+    this->_clientNameWidth = width;
+    for (unsigned int i = 0; i < this->_clients.size(); ++i)
+      this->_clients[i]->setNameWidth(width);
+  }
+
+  void ProxyWidget::hiding()
+  {
+    this->_proxyWidget.hide();
+    for (unsigned int i = 0; i < this->_clients.size(); ++i)
+      this->_clients[i]->hide();
+  }
+
+  void ProxyWidget::showing()
+  {
+    this->_proxyWidget.show();
+    for (unsigned int i = 0; i < this->_clients.size(); ++i)
+      this->_clients[i]->show();
+  }
+
+
+  //======================================================//
+
+
+
+  /**
+   * @brief standard constructor
+   */
+  NetworkStatsWidget::NetworkStatsWidget ()
+  : GLGuiBox(Vertical), _thisHost("myName", IP(127, 0, 0 , 0))
+  {
+    //   this->setClassID(CL_PROTO_ID, "NetworkStatsWidget");
+
+    this->_bar.setSize2D(100, 30);
+    this->pack(&this->_valueText);
+    this->_bar.setParent2D(&this->_valueText);
+
+    this->_valueText.setChangedTextColor(Color::white);
+
+    //this->setBackgroundTexture("maps/gui_element_background_2.png");
+    this->setBackgroundColor(Color(.5,.5,.5,1));
+
+    //this->_name.setBackgroundTexture(Texture());
+    //this->_valueText.setBackgroundTexture("maps/gui_element_background_2.png");
+    this->_bar.setBackgroundTexture(Texture());
+    this->_bar.setBackgroundColor(Color(0,0,0,0));
+    this->_bar.setForegroundTexture("maps/gui_element_background_faded.png");
+    this->_bar.setForegroundColor(Color(.5, .5, .5, 1));
+    this->_bar.setChangedValueColor(Color::black);
+  }
+
+
+  /**
+   * @brief standard deconstructor
+   */
+  NetworkStatsWidget::~NetworkStatsWidget ()
+  {}
+
+
+  void NetworkStatsWidget::setMaximum(float max)
+  {
+    this->_bar.setMaximum(max);
+  }
+
+  void NetworkStatsWidget::setValue(float value)
+  {
+    MultiType val(value);
+    val.setType(MT_INT);
+
+
+    this->_bar.setValue(value);
+    this->_bar.setForegroundColor(Color::slerpHSVColor(Color::red, Color::green, value/this->_bar.maximum()));
+    this->_bar.setFrontColor(Color(1,1,1,1), true);
+    this->_valueText.setText(val.getString());
+  }
+
+  void NetworkStatsWidget::resize()
+  {
+    GLGuiBox::resize();
+  }
+
+
+  void NetworkStatsWidget::showing()
+  {
+    this->_valueText.show();
+    this->_bar.show();
+  }
+
+  void NetworkStatsWidget::hiding()
+  {
+    this->_valueText.hide();
+    this->_bar.hide();
+  }
+}
Index: trunk/src/util/network_stats_widget.h
===================================================================
--- trunk/src/util/network_stats_widget.h	(revision 9406)
+++ trunk/src/util/network_stats_widget.h	(revision 9406)
@@ -0,0 +1,114 @@
+/*!
+ * @file network_stats_widget.h
+ * @brief Definition of an EnergyWidget, that displays a bar and a Text
+*/
+
+#ifndef _NETWORK_STATS_WIDGET_H
+#define _NETWORK_STATS_WIDGET_H
+
+#include "glgui_box.h"
+#include "glgui_bar.h"
+#include "glgui_text.h"
+
+#include "network/ip.h"
+
+
+namespace OrxGui
+{
+
+  class HostWidget : public GLGuiBox
+  {
+    public:
+      HostWidget(const std::string& name, const IP& ip);
+      ~HostWidget() {};
+
+      void setName(const std::string& name) { this->_name.setText(name); };
+      void setIP(const IP& ip) { this->_ip.setText(ip.ipString()); this->_storedIP = ip; };
+
+      void setNameWidth(float width) { this->_name.setLineWidth(width); };
+
+      bool operator==(const IP& ip) const { return (this->_storedIP == ip); };
+      bool operator==(const std::string& name) const { return (this->_name == name); };
+
+    protected:
+      virtual void showing();
+      virtual void hiding();
+
+    private:
+      GLGuiText        _name;           //!< The Name of the Proxy server to be displayed.
+      GLGuiText        _ip;             //!< The IP of the proxy server.
+      IP               _storedIP;       //!< The ip to compare.
+  };
+
+
+  class ProxyWidget : public GLGuiBox
+  {
+    public:
+      ProxyWidget(const std::string& proxyName, const IP& ip);
+
+      void addClient(const std::string& name, const IP& ip);
+
+      bool removeClient(const IP& ip);
+      bool removeClient(const std::string& name);
+      bool removeClient(const std::string& name, const IP& ip);
+
+      void setClientNameWidths(float width);
+
+
+    protected:
+      virtual void hiding();
+      virtual void showing();
+
+
+    private:
+      HostWidget       _proxyWidget;
+
+      std::vector<HostWidget*>  _clients;
+      float            _clientNameWidth;
+  };
+
+
+
+
+  //! A class to display network Statistics.
+  class NetworkStatsWidget : public GLGuiBox
+  {
+    public:
+      NetworkStatsWidget();
+      virtual ~NetworkStatsWidget();
+
+      void setUpstream(unsigned int upstream);
+      void setDownstream(unsigned int upstream);
+      void setIP(const IP& ip);
+
+
+
+      void addProxy(const std::string& name, const IP& proxy);
+
+
+      //void rebuildConnectedHosts(std::vector<hosts> hosts);
+
+      void setMaximum(float max);
+      void setValue(float value);
+
+    protected:
+      virtual void resize();
+      virtual void showing();
+      virtual void hiding();
+
+    private:
+      HostWidget             _thisHost;
+
+      GLGuiText              _upstreamText;
+      GLGuiText              _downstreamText;
+
+      std::vector<HostWidget*>_connectedProxies;
+
+      GLGuiText              _serverIP;
+
+
+      GLGuiText              _valueText;
+      GLGuiBar               _bar;
+  };
+}
+#endif /* _NETWORK_STATS_WIDGET_H */
Index: trunk/src/util/object_manager.cc
===================================================================
--- trunk/src/util/object_manager.cc	(revision 9391)
+++ trunk/src/util/object_manager.cc	(revision 9406)
@@ -26,5 +26,5 @@
 #include "debug.h"
 
-using namespace std;
+
 SHELL_COMMAND(debug, ObjectManager, debug)
     ->defaultValues("", 0);
@@ -117,5 +117,5 @@
   {
 
-    list<BaseObject*>::const_iterator node;
+    std::list<BaseObject*>::const_iterator node;
     for (node = objectList->begin(); node != objectList->end(); node++)
       if ((dynamic_cast<PNode*>(*node)->getAbsCoor() - center.getAbsCoor()).len() < radius)
@@ -140,5 +140,5 @@
       for (entity = this->objectLists[omList].begin(); entity != this->objectLists[omList].end(); entity++)
       {
-        PRINT(0)(" | %s::%s\n",(*entity)->getClassName(), (*entity)->getName());
+        PRINT(0)(" | %s::%s\n",(*entity)->getClassCName(), (*entity)->getCName());
       }
     }
Index: trunk/src/util/signal_handler.cc
===================================================================
--- trunk/src/util/signal_handler.cc	(revision 9391)
+++ trunk/src/util/signal_handler.cc	(revision 9406)
@@ -27,7 +27,16 @@
 }
 
-void SignalHandler::doCatch( std::string appName )
+/**
+ * register signal handlers for SIGSEGV and SIGABRT
+ * @param appName path to executable eg argv[0]
+ * @param fileName filename to append backtrace to
+ */
+void SignalHandler::doCatch( const std::string & appName, const std::string & fileName )
 {
   this->appName = appName;
+  this->fileName = fileName;
+  
+  // make sure doCatch is only called once without calling dontCatch
+  assert( sigRecList.size() == 0 );
 
   catchSignal( SIGSEGV );
@@ -35,4 +44,7 @@
 }
 
+/**
+ * restore previous signal handlers
+ */
 void SignalHandler::dontCatch()
 {
@@ -45,4 +57,8 @@
 }
 
+/**
+ * catch signal sig
+ * @param sig signal to catch
+ */
 void SignalHandler::catchSignal( int sig )
 {
@@ -58,4 +74,8 @@
 }
 
+/**
+ * sigHandler is called when receiving signals
+ * @param sig 
+ */
 void SignalHandler::sigHandler( int sig )
 {
@@ -167,4 +187,6 @@
         )
           charsFound++;
+    else
+      charsFound = 0;
 
     if ( charsFound == 6 )
@@ -183,5 +205,5 @@
   write( sigPipe[1], &someData, sizeof(someData) );
 
-  write( gdbIn[1], "bt\nq\n", 5 );
+  write( gdbIn[1], "bt\nk\nq\n", 7 );
 
   
@@ -202,4 +224,6 @@
         )
           charsFound++;
+    else
+      charsFound = 0;
 
     if ( charsFound == 6 )
@@ -210,5 +234,5 @@
     }
 
-    if ( promptFound == 2 )
+    if ( promptFound == 3 )
     {
       break;
@@ -240,9 +264,9 @@
   bt.insert(0, timeString);
   
-  FILE * f = fopen( GDB_BT_FILE, "a" );
+  FILE * f = fopen( getInstance()->fileName.c_str(), "a" );
 
   if ( !f )
   {
-    perror("could not append to " GDB_BT_FILE);
+    perror( ( std::string( "could not append to " ) + getInstance()->fileName ).c_str() );
     exit(EXIT_FAILURE);
   }
@@ -250,5 +274,5 @@
   if ( fwrite( bt.c_str(), 1, bt.length(), f ) != bt.length() )
   {
-    printf("could not write %d byte to " GDB_BT_FILE, bt.length());
+    printf( ( std::string("could not write %d byte to ") + getInstance()->fileName ).c_str(), bt.length());
     exit(EXIT_FAILURE);
   }
Index: trunk/src/util/signal_handler.h
===================================================================
--- trunk/src/util/signal_handler.h	(revision 9391)
+++ trunk/src/util/signal_handler.h	(revision 9406)
@@ -9,7 +9,4 @@
 #include <list>
 #include <string>
-
-
-#define GDB_BT_FILE "orxonox.backtrace"
 
 typedef int (*SignalCallback)( void * someData );
@@ -44,5 +41,5 @@
     void registerCallback( SignalCallback cb, void * someData );
 
-    void doCatch( std::string appName );
+    void doCatch( const std::string & appName, const std::string & fileName );
     void dontCatch();
 
@@ -58,4 +55,5 @@
 
     std::string appName;
+    std::string fileName;
 };
 
Index: trunk/src/util/singleplayer_shootemup.cc
===================================================================
--- trunk/src/util/singleplayer_shootemup.cc	(revision 9391)
+++ trunk/src/util/singleplayer_shootemup.cc	(revision 9406)
@@ -23,5 +23,5 @@
 
 
-using namespace std;
+
 
 
Index: trunk/src/util/state.cc
===================================================================
--- trunk/src/util/state.cc	(revision 9391)
+++ trunk/src/util/state.cc	(revision 9406)
@@ -25,5 +25,5 @@
 #endif
 
-using namespace std;
+
 
 
Index: trunk/src/util/track/track_manager.cc
===================================================================
--- trunk/src/util/track/track_manager.cc	(revision 9391)
+++ trunk/src/util/track/track_manager.cc	(revision 9406)
@@ -32,5 +32,5 @@
 #include <stdarg.h>
 
-using namespace std;
+
 
 /**
Index: trunk/src/util/track/track_node.cc
===================================================================
--- trunk/src/util/track/track_node.cc	(revision 9391)
+++ trunk/src/util/track/track_node.cc	(revision 9406)
@@ -21,5 +21,5 @@
 #include "track_manager.h"
 
-using namespace std;
+
 
 /**
Index: trunk/src/world_entities/bsp_entity.cc
===================================================================
--- trunk/src/world_entities/bsp_entity.cc	(revision 9391)
+++ trunk/src/world_entities/bsp_entity.cc	(revision 9406)
@@ -1,12 +1,12 @@
 /*
    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: Claudio Botta
@@ -53,7 +53,7 @@
 
   this->bspManager = NULL;
- 
+
   this->name_handle = registerVarId( new SynchronizeableString( &this->name, &this->name_write, "name" ) );
-  
+
   this->setSynchronized( true );
 }
@@ -63,5 +63,5 @@
 {
   PRINTF(0)("+++++++++++ LOADING NAME %s\n", name.c_str());
-  
+
   this->name = name;
 
Index: trunk/src/world_entities/camera.cc
===================================================================
--- trunk/src/world_entities/camera.cc	(revision 9391)
+++ trunk/src/world_entities/camera.cc	(revision 9406)
@@ -17,4 +17,5 @@
 #include "camera.h"
 #include "key_mapper.h"
+#include "glincl.h"
 
 /**
Index: trunk/src/world_entities/character_attributes.cc
===================================================================
--- trunk/src/world_entities/character_attributes.cc	(revision 9391)
+++ trunk/src/world_entities/character_attributes.cc	(revision 9406)
@@ -20,5 +20,5 @@
 #include "stdincl.h" 
 
-using namespace std;
+
 
 
Index: trunk/src/world_entities/creatures/fps_player.cc
===================================================================
--- trunk/src/world_entities/creatures/fps_player.cc	(revision 9391)
+++ trunk/src/world_entities/creatures/fps_player.cc	(revision 9406)
@@ -276,5 +276,5 @@
 //     if( target != NULL)
 //     {
-//       PRINTF(0)("hit hit hit, got: %s\n", target->getClassName());
+//       PRINTF(0)("hit hit hit, got: %s\n", target->getClassCName());
 //     }
 //     else
@@ -287,5 +287,5 @@
   //dealing damage
 
-  if ( State::isOnline() && SharedNetworkData::getInstance()->isGameServer() )
+  if ( State::isOnline() && (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer()))
   {
     this->damageTicker -= time;
@@ -299,5 +299,5 @@
       if ( victim )
       {
-        PRINTF(0)("FIRE: hit %s\n", victim->getClassName());
+        PRINTF(0)("FIRE: hit %s\n", victim->getClassCName());
         victim->hit( 20, this );
       }
Index: trunk/src/world_entities/effects/billboard.cc
===================================================================
--- trunk/src/world_entities/effects/billboard.cc	(revision 9391)
+++ trunk/src/world_entities/effects/billboard.cc	(revision 9406)
@@ -24,5 +24,5 @@
 
 
-using namespace std;
+
 
 
Index: trunk/src/world_entities/effects/explosion.cc
===================================================================
--- trunk/src/world_entities/effects/explosion.cc	(revision 9391)
+++ trunk/src/world_entities/effects/explosion.cc	(revision 9406)
@@ -27,5 +27,5 @@
 
 
-using namespace std;
+
 
 CREATE_FAST_FACTORY_STATIC(Explosion, CL_EXPLOSION);
Index: trunk/src/world_entities/effects/lightning_bolt.cc
===================================================================
--- trunk/src/world_entities/effects/lightning_bolt.cc	(revision 9391)
+++ trunk/src/world_entities/effects/lightning_bolt.cc	(revision 9406)
@@ -24,5 +24,5 @@
 
 
-using namespace std;
+
 
 CREATE_FACTORY(LightningBolt, CL_LIGHTNING_BOLT);
Index: trunk/src/world_entities/elements/glgui_energywidget.cc
===================================================================
--- trunk/src/world_entities/elements/glgui_energywidget.cc	(revision 9391)
+++ trunk/src/world_entities/elements/glgui_energywidget.cc	(revision 9406)
@@ -17,4 +17,6 @@
 
 #include "glgui_energywidget.h"
+
+#include "multi_type.h"
 
 namespace OrxGui
Index: trunk/src/world_entities/elements/image_entity.cc
===================================================================
--- trunk/src/world_entities/elements/image_entity.cc	(revision 9391)
+++ trunk/src/world_entities/elements/image_entity.cc	(revision 9406)
@@ -27,5 +27,5 @@
 
 
-using namespace std;
+
 
 
Index: trunk/src/world_entities/elements/text_element.cc
===================================================================
--- trunk/src/world_entities/elements/text_element.cc	(revision 9391)
+++ trunk/src/world_entities/elements/text_element.cc	(revision 9406)
@@ -25,5 +25,5 @@
 
 
-using namespace std;
+
 
 
Index: trunk/src/world_entities/environment.cc
===================================================================
--- trunk/src/world_entities/environment.cc	(revision 9391)
+++ trunk/src/world_entities/environment.cc	(revision 9406)
@@ -27,5 +27,5 @@
 #include "util/loading/factory.h"
 
-using namespace std;
+
 CREATE_FACTORY(Environment, CL_ENVIRONMENT);
 
Index: trunk/src/world_entities/environments/building.cc
===================================================================
--- trunk/src/world_entities/environments/building.cc	(revision 9391)
+++ trunk/src/world_entities/environments/building.cc	(revision 9406)
@@ -21,5 +21,5 @@
 #include "util/loading/factory.h"
 
-using namespace std;
+
 
 
Index: trunk/src/world_entities/environments/mapped_water.cc
===================================================================
--- trunk/src/world_entities/environments/mapped_water.cc	(revision 9391)
+++ trunk/src/world_entities/environments/mapped_water.cc	(revision 9406)
@@ -374,5 +374,5 @@
         waterColorR->setValue(this->waterColor.x);
         waterColorR->setStep(0.1f);
-        waterColorR->connect(SIGNAL(waterColorR, valueChanged), this, SLOT(MappedWater, resetWaterColorR));
+        waterColorR->valueChanged.connect(this, &MappedWater::resetWaterColorR);
         waterColorBox->pack(waterColorR);
 
@@ -381,5 +381,5 @@
         waterColorG->setStep(0.1f);
         waterColorG->setValue(this->waterColor.y);
-        waterColorG->connect(SIGNAL(waterColorG, valueChanged), this, SLOT(MappedWater, resetWaterColorG));
+        waterColorG->valueChanged.connect(this, &MappedWater::resetWaterColorG);
         waterColorBox->pack(waterColorG);
 
@@ -388,5 +388,5 @@
         waterColorB->setStep(0.1f);
         waterColorB->setValue(this->waterColor.z);
-        waterColorB->connect(SIGNAL(waterColorB, valueChanged), this, SLOT(MappedWater, resetWaterColorB));
+        waterColorB->valueChanged.connect(this, &MappedWater::resetWaterColorB);
         waterColorBox->pack(waterColorB);
       }
@@ -403,5 +403,5 @@
         waterUV->setValue(this->waterUV);
         waterUV->setStep(1);
-        waterUV->connect(SIGNAL(waterUV, valueChanged), this, SLOT(MappedWater, setWaterUV));
+        waterUV->valueChanged.connect(this, &MappedWater::setWaterUV);
         waterUVBox->pack(waterUV);
       }
@@ -418,5 +418,5 @@
         waterFlow->setValue(this->waterFlow);
         waterFlow->setStep(0.02f);
-        waterFlow->connect(SIGNAL(waterFlow, valueChanged), this, SLOT(MappedWater, setWaterFlow));
+        waterFlow->valueChanged.connect(this, &MappedWater::setWaterFlow);
         waterFlowBox->pack(waterFlow);
       }
@@ -433,5 +433,5 @@
         shineSize->setValue(this->shineSize);
         shineSize->setStep(1);
-        shineSize->connect(SIGNAL(shineSize, valueChanged), this, SLOT(MappedWater, resetShineSize));
+        shineSize->valueChanged.connect(this, &MappedWater::resetShineSize);
         shineSizeBox->pack(shineSize);
       }
@@ -448,5 +448,5 @@
         shineStrength->setValue(this->shineStrength);
         shineStrength->setStep(0.1f);
-        shineStrength->connect(SIGNAL(shineStrength, valueChanged), this, SLOT(MappedWater, resetShineStrength));
+        shineStrength->valueChanged.connect(this, &MappedWater::resetShineStrength);
         shineStrengthBox->pack(shineStrength);
       }
@@ -463,5 +463,5 @@
         reflStrength->setValue(this->reflStrength);
         reflStrength->setStep(0.1f);
-        reflStrength->connect(SIGNAL(reflStrength, valueChanged), this, SLOT(MappedWater, resetReflStrength));
+        reflStrength->valueChanged.connect(this, &MappedWater::resetReflStrength);
         reflStrengthBox->pack(reflStrength);
       }
@@ -478,5 +478,5 @@
         refraction->setValue(this->refraction);
         refraction->setStep(0.004f);
-        refraction->connect(SIGNAL(refraction, valueChanged), this, SLOT(MappedWater, resetRefraction));
+        refraction->valueChanged.connect(this, &MappedWater::resetRefraction);
         refractionBox->pack(refraction);
       }
@@ -493,5 +493,5 @@
         lightPosX->setValue(this->lightPos.x);
         lightPosX->setStep(15);
-        lightPosX->connect(SIGNAL(lightPosX, valueChanged), this, SLOT(MappedWater, resetLightPosX));
+        lightPosX->valueChanged.connect(this, &MappedWater::resetLightPosX);
         lightPosBox->pack(lightPosX);
 
@@ -500,5 +500,5 @@
         lightPosY->setStep(15);
         lightPosY->setValue(this->lightPos.y);
-        lightPosY->connect(SIGNAL(lightPosY, valueChanged), this, SLOT(MappedWater, resetLightPosY));
+        lightPosY->valueChanged.connect(this, &MappedWater::resetLightPosY);
         lightPosBox->pack(lightPosY);
 
@@ -507,5 +507,5 @@
         lightPosZ->setStep(15);
         lightPosZ->setValue(this->lightPos.z);
-        lightPosZ->connect(SIGNAL(lightPosZ, valueChanged), this, SLOT(MappedWater, resetLightPosZ));
+        lightPosZ->valueChanged.connect(this, &MappedWater::resetLightPosZ);
         lightPosBox->pack(lightPosZ);
       }
@@ -522,5 +522,5 @@
         waterHeight->setValue(this->waterHeight);
         waterHeight->setStep(4);
-        waterHeight->connect(SIGNAL(waterHeight, valueChanged), this, SLOT(MappedWater, setWaterHeight));
+        waterHeight->valueChanged.connect(this, &MappedWater::setWaterHeight);
         waterHeightBox->pack(waterHeight);
       }
Index: trunk/src/world_entities/environments/model_entity.cc
===================================================================
--- trunk/src/world_entities/environments/model_entity.cc	(revision 9391)
+++ trunk/src/world_entities/environments/model_entity.cc	(revision 9406)
@@ -21,5 +21,5 @@
 #include "util/loading/factory.h"
 
-using namespace std;
+
 
 
Index: trunk/src/world_entities/environments/water.cc
===================================================================
--- trunk/src/world_entities/environments/water.cc	(revision 9391)
+++ trunk/src/world_entities/environments/water.cc	(revision 9406)
@@ -32,5 +32,5 @@
 #include "network_game_manager.h"
 
-using namespace std;
+
 
 CREATE_FACTORY(Water, CL_WATER);
Index: trunk/src/world_entities/items/item_container.cc
===================================================================
--- trunk/src/world_entities/items/item_container.cc	(revision 9391)
+++ trunk/src/world_entities/items/item_container.cc	(revision 9406)
@@ -18,5 +18,5 @@
 #include "item_container.h"
 
-using namespace std;
+
 
 
Index: trunk/src/world_entities/movie_entity.cc
===================================================================
--- trunk/src/world_entities/movie_entity.cc	(revision 9391)
+++ trunk/src/world_entities/movie_entity.cc	(revision 9406)
@@ -20,5 +20,5 @@
 #include "util/loading/factory.h"
 
-using namespace std;
+
 
 CREATE_FACTORY(MovieEntity, CL_MOVIE_ENTITY);
Index: trunk/src/world_entities/npcs/door.cc
===================================================================
--- trunk/src/world_entities/npcs/door.cc	(revision 9391)
+++ trunk/src/world_entities/npcs/door.cc	(revision 9406)
@@ -28,5 +28,5 @@
 
 
-using namespace std;
+
 
 
Index: trunk/src/world_entities/npcs/gate.cc
===================================================================
--- trunk/src/world_entities/npcs/gate.cc	(revision 9391)
+++ trunk/src/world_entities/npcs/gate.cc	(revision 9406)
@@ -31,5 +31,5 @@
 
 
-using namespace std;
+
 
 
Index: trunk/src/world_entities/npcs/ground_turret.cc
===================================================================
--- trunk/src/world_entities/npcs/ground_turret.cc	(revision 9391)
+++ trunk/src/world_entities/npcs/ground_turret.cc	(revision 9406)
@@ -31,5 +31,5 @@
 CREATE_FACTORY(GroundTurret, CL_GROUND_TURRET);
 
-using namespace std;
+
 
 
Index: trunk/src/world_entities/npcs/repair_station.cc
===================================================================
--- trunk/src/world_entities/npcs/repair_station.cc	(revision 9391)
+++ trunk/src/world_entities/npcs/repair_station.cc	(revision 9406)
@@ -28,5 +28,5 @@
 
 
-using namespace std;
+
 
 
Index: trunk/src/world_entities/planet.cc
===================================================================
--- trunk/src/world_entities/planet.cc	(revision 9391)
+++ trunk/src/world_entities/planet.cc	(revision 9406)
@@ -30,5 +30,5 @@
 #include "primitive_model.h"
 
-using namespace std;
+
 
 
Index: trunk/src/world_entities/playable.cc
===================================================================
--- trunk/src/world_entities/playable.cc	(revision 9391)
+++ trunk/src/world_entities/playable.cc	(revision 9406)
@@ -148,5 +148,5 @@
     if (weapon != NULL)
       PRINTF(2)("Unable to add Weapon (%s::%s) to %s::%s\n",
-                weapon->getClassName(), weapon->getName(), this->getClassName(), this->getName());
+                weapon->getClassCName(), weapon->getCName(), this->getClassCName(), this->getCName());
     else
       PRINTF(2)("No weapon defined\n");
@@ -361,28 +361,4 @@
   }
 }
-/**
- * @brief helps us colliding Playables
- * @param entity the Entity to collide
- * @param location where the collision occured.
- */
-void Playable::collidesWith(WorldEntity* entity, const Vector& location)
-{
-  if (entity == collider)
-    return;
-  collider = entity;
-
-  if ( entity->isA(CL_PROJECTILE) && ( !State::isOnline() || SharedNetworkData::getInstance()->isGameServer() ) )
-  {
-    this->decreaseHealth(entity->getHealth() *(float)rand()/(float)RAND_MAX);
-    // EXTREME HACK
-    if (this->getHealth() <= 0.0f)
-    {
-//       this->destory();
-
-      if( State::getGameRules() != NULL)
-        State::getGameRules()->registerKill(Kill(entity, this));
-    }
-  }
-}
 
 
@@ -413,5 +389,5 @@
     }
     this->bDead = true;
-    
+
     if( State::getGameRules() != NULL)
       State::getGameRules()->registerKill(Kill(killer, this));
Index: trunk/src/world_entities/playable.h
===================================================================
--- trunk/src/world_entities/playable.h	(revision 9391)
+++ trunk/src/world_entities/playable.h	(revision 9406)
@@ -82,5 +82,4 @@
   virtual void destroy(WorldEntity* killer);
   virtual void respawn();
-  virtual void collidesWith(WorldEntity* entity, const Vector& location);
   virtual void process(const Event &event);
   virtual void tick(float dt);
@@ -90,5 +89,5 @@
   static const std::string& playmodeToString(Playable::Playmode playmode);
   static const std::string playmodeNames[];
-  
+
   inline bool beFire(){ return this->bFire; }
   inline void fire(bool bF){ this->bFire = bF;}
Index: trunk/src/world_entities/power_ups/laser_power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/laser_power_up.cc	(revision 9391)
+++ trunk/src/world_entities/power_ups/laser_power_up.cc	(revision 9406)
@@ -23,5 +23,5 @@
 #include "primitive_model.h"
 
-using namespace std;
+
 
 CREATE_FACTORY(LaserPowerUp, CL_LASER_POWER_UP);
@@ -78,5 +78,5 @@
 void LaserPowerUp::collidesWith(WorldEntity* entity, const Vector& location)
 {
- // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z);
+ // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassCName(), entity->getClassCName(), location.x, location.y, location.z);
  if (entity->isA(CL_PLAYABLE))
   this->toList(OM_DEAD);
Index: trunk/src/world_entities/power_ups/param_power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/param_power_up.cc	(revision 9391)
+++ trunk/src/world_entities/power_ups/param_power_up.cc	(revision 9406)
@@ -26,5 +26,5 @@
 #include "network_game_manager.h"
 
-using namespace std;
+
 
 CREATE_FACTORY(ParamPowerUp, CL_PARAM_POWER_UP);
Index: trunk/src/world_entities/power_ups/power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/power_up.cc	(revision 9391)
+++ trunk/src/world_entities/power_ups/power_up.cc	(revision 9406)
@@ -24,5 +24,5 @@
 #include "util/loading/load_param.h"
 
-using namespace std;
+
 
 PowerUp::PowerUp(float r, float g, float b)
@@ -85,9 +85,9 @@
     if (this->pickupBuffer != NULL)
     {
-      PRINTF(4)("Loaded sound %s to Pickup: %s.\n", pickupSound.c_str(), this->getName());
+      PRINTF(4)("Loaded sound %s to Pickup: %s.\n", pickupSound.c_str(), this->getCName());
     }
     else
     {
-      PRINTF(2)("Failed to load sound %s to pickup %s.\n.", pickupSound.c_str(), this->getName());
+      PRINTF(2)("Failed to load sound %s to pickup %s.\n.", pickupSound.c_str(), this->getCName());
     }
   }
@@ -106,9 +106,9 @@
     if (this->respawnBuffer != NULL)
     {
-      PRINTF(4)("Loaded sound %s to Pickup: %s.\n", respawnSound.c_str(), this->getName());
+      PRINTF(4)("Loaded sound %s to Pickup: %s.\n", respawnSound.c_str(), this->getCName());
     }
     else
     {
-      PRINTF(2)("Failed to load sound %s to respawn %s.\n.", respawnSound.c_str(), this->getName());
+      PRINTF(2)("Failed to load sound %s to respawn %s.\n.", respawnSound.c_str(), this->getCName());
     }
   }
Index: trunk/src/world_entities/power_ups/turret_power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/turret_power_up.cc	(revision 9391)
+++ trunk/src/world_entities/power_ups/turret_power_up.cc	(revision 9406)
@@ -23,5 +23,5 @@
 #include "primitive_model.h"
 
-using namespace std;
+
 
 CREATE_FACTORY(TurretPowerUp, CL_TURRET_POWER_UP);
@@ -74,5 +74,5 @@
 void TurretPowerUp::collidesWith(WorldEntity* entity, const Vector& location)
 {
- // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z);
+ // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassCName(), entity->getClassCName(), location.x, location.y, location.z);
  if (entity->isA(CL_PLAYABLE))
    this->toList(OM_DEAD);
Index: trunk/src/world_entities/power_ups/weapon_power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/weapon_power_up.cc	(revision 9391)
+++ trunk/src/world_entities/power_ups/weapon_power_up.cc	(revision 9406)
@@ -26,5 +26,5 @@
 #include "util/loading/load_param.h"
 
-using namespace std;
+
 
 CREATE_FACTORY(WeaponPowerUp, CL_WEAPON_POWER_UP);
Index: trunk/src/world_entities/projectiles/laser.cc
===================================================================
--- trunk/src/world_entities/projectiles/laser.cc	(revision 9391)
+++ trunk/src/world_entities/projectiles/laser.cc	(revision 9406)
@@ -28,5 +28,5 @@
 #include "debug.h"
 
-using namespace std;
+
 
 CREATE_FAST_FACTORY_STATIC(Laser, CL_LASER);
Index: trunk/src/world_entities/projectiles/projectile.cc
===================================================================
--- trunk/src/world_entities/projectiles/projectile.cc	(revision 9391)
+++ trunk/src/world_entities/projectiles/projectile.cc	(revision 9406)
@@ -75,9 +75,9 @@
     if (this->explosionBuffer != NULL)
     {
-      PRINTF(4)("Loaded sound %s to Pickup: %s.\n", explosionSound.c_str(), this->getName());
+      PRINTF(4)("Loaded sound %s to Pickup: %s.\n", explosionSound.c_str(), this->getCName());
     }
     else
     {
-      PRINTF(2)("Failed to load sound %s to explosion %s.\n.", explosionSound.c_str(), this->getName());
+      PRINTF(2)("Failed to load sound %s to explosion %s.\n.", explosionSound.c_str(), this->getCName());
     }
   }
@@ -97,9 +97,9 @@
     if (this->engineBuffer != NULL)
     {
-      PRINTF(4)("Loaded sound %s to Pickup: %s.\n", engineSound.c_str(), this->getName());
+      PRINTF(4)("Loaded sound %s to Pickup: %s.\n", engineSound.c_str(), this->getCName());
     }
     else
     {
-      PRINTF(2)("Failed to load sound %s to engine %s.\n.", engineSound.c_str(), this->getName());
+      PRINTF(2)("Failed to load sound %s to engine %s.\n.", engineSound.c_str(), this->getCName());
     }
   }
Index: trunk/src/world_entities/projectiles/rail_projectile.cc
===================================================================
--- trunk/src/world_entities/projectiles/rail_projectile.cc	(revision 9391)
+++ trunk/src/world_entities/projectiles/rail_projectile.cc	(revision 9406)
@@ -28,5 +28,5 @@
 #include "debug.h"
 
-using namespace std;
+
 
 CREATE_FAST_FACTORY_STATIC(RailProjectile, CL_RAIL_PROJECTILE);
Index: trunk/src/world_entities/recorder.cc
===================================================================
--- trunk/src/world_entities/recorder.cc	(revision 9391)
+++ trunk/src/world_entities/recorder.cc	(revision 9406)
@@ -21,5 +21,5 @@
 #include "state.h"
 
-using namespace std;
+
 
 CREATE_FACTORY(Recorder, CL_RECORDER);
Index: trunk/src/world_entities/satellite.cc
===================================================================
--- trunk/src/world_entities/satellite.cc	(revision 9391)
+++ trunk/src/world_entities/satellite.cc	(revision 9406)
@@ -24,5 +24,5 @@
 
 
-using namespace std;
+
 
 /**
Index: trunk/src/world_entities/script_trigger.cc
===================================================================
--- trunk/src/world_entities/script_trigger.cc	(revision 9391)
+++ trunk/src/world_entities/script_trigger.cc	(revision 9406)
@@ -63,22 +63,22 @@
   addToScript = false;
   this->activeOnCreation = false;
-  
+
   if(root != NULL)
   {
-    
+
     loadParams(root);
-  
+
     if(addToScript && scriptIsOk)
     {
       script->addObject( "ScriptTrigger", this->getName());
     }
-  
-  }
-  
+
+  }
+
 }
 
 /**
  * Deletes the ScriptTrigger.
- * 
+ *
  */
 ScriptTrigger::~ScriptTrigger()
@@ -147,5 +147,5 @@
   else
   {
-    PRINTF(2)("Target %s for %s::%s does not Exist\n", target.c_str(), this->getClassName(), this->getName());
+    PRINTF(2)("Target %s for %s::%s does not Exist\n", target.c_str(), this->getClassCName(), this->getCName());
   }
 }
@@ -153,5 +153,5 @@
 /**
  * Sets the parent of the trigger.
- * @param parent The parrent. 
+ * @param parent The parrent.
  */
 void ScriptTrigger::setTriggerParent(const std::string& parent)
@@ -166,5 +166,5 @@
   else
   {
-    PRINTF(2)("Parent %s for %s::%s does not Exist\n", parent.c_str(), this->getClassName(), this->getName());
+    PRINTF(2)("Parent %s for %s::%s does not Exist\n", parent.c_str(), this->getClassCName(), this->getCName());
   }
 }
@@ -179,5 +179,5 @@
      return;
    }
-   
+
   if(triggerRemains && scriptCalled)
   {
@@ -185,5 +185,5 @@
     return;
   }
-  
+
   if( !invert && this->distance(target) < radius)
   {
@@ -191,9 +191,9 @@
     scriptCalled = true;
     return;
-  
+
   }
   else if( invert && this->distance(target) > radius)
   {
-    executeAction(timestep); 
+    executeAction(timestep);
     scriptCalled = true;
     return;
@@ -207,5 +207,5 @@
 void ScriptTrigger::executeAction(float timestep)
 {
-  
+
   if(scriptIsOk)
   {
@@ -213,14 +213,14 @@
     if(!(script->selectFunction(this->functionName,returnCount)) )
       PRINT(1)("Error ScriptTrigger: Selection of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());
-     
+
     script->pushParam( timestep, this->functionName);
-     
+
     if( !(script->executeFunction()) )
       PRINT(1)("Error ScriptTrigger: Execution of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());
-     
+
     scriptFinished = script->getReturnedBool();
   }
-     
-     
+
+
 }
 
@@ -268,5 +268,5 @@
    float retf = script->getReturnedFloat();
    printf("main returned %f\n",retf);
-   
+
 
    printf("-------------------------- top of the stack:%i\n",lua_gettop(script->getLuaState()));
Index: trunk/src/world_entities/skybox.cc
===================================================================
--- trunk/src/world_entities/skybox.cc	(revision 9391)
+++ trunk/src/world_entities/skybox.cc	(revision 9406)
@@ -30,5 +30,5 @@
 
 
-using namespace std;
+
 
 CREATE_FACTORY(SkyBox, CL_SKYBOX);
Index: trunk/src/world_entities/skydome.cc
===================================================================
--- trunk/src/world_entities/skydome.cc	(revision 9391)
+++ trunk/src/world_entities/skydome.cc	(revision 9406)
@@ -28,5 +28,5 @@
 #define SQR(x) (x*x)
 
-using namespace std;
+
 
 
Index: trunk/src/world_entities/skysphere.cc
===================================================================
--- trunk/src/world_entities/skysphere.cc	(revision 9391)
+++ trunk/src/world_entities/skysphere.cc	(revision 9406)
@@ -33,5 +33,5 @@
 
 
-using namespace std;
+
 
 /**
Index: trunk/src/world_entities/space_ships/collision_probe.cc
===================================================================
--- trunk/src/world_entities/space_ships/collision_probe.cc	(revision 9391)
+++ trunk/src/world_entities/space_ships/collision_probe.cc	(revision 9406)
@@ -24,5 +24,5 @@
 
 
-using namespace std;
+
 
 CREATE_FACTORY(CollisionProbe, CL_COLLISION_PROBE);
Index: trunk/src/world_entities/space_ships/space_ship.cc
===================================================================
--- trunk/src/world_entities/space_ships/space_ship.cc	(revision 9391)
+++ trunk/src/world_entities/space_ships/space_ship.cc	(revision 9406)
@@ -52,5 +52,5 @@
 
 
-using namespace std;
+
 
 CREATE_FACTORY(SpaceShip, CL_SPACE_SHIP);
@@ -314,10 +314,10 @@
   if( entity->isA(CL_PROJECTILE) && entity != ref)
   {
-    if ( isServer() )
+    if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
     {
       //TODO handle this
     }
   }
-  PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z);
+  PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassCName(), entity->getClassCName(), location.x, location.y, location.z);
 }
 
Index: trunk/src/world_entities/space_ships/spacecraft_2d.cc
===================================================================
--- trunk/src/world_entities/space_ships/spacecraft_2d.cc	(revision 9391)
+++ trunk/src/world_entities/space_ships/spacecraft_2d.cc	(revision 9406)
@@ -324,5 +324,5 @@
 
     default:
-      PRINTF(2)("Playmode %s Not Implemented in %s\n", Playable::playmodeToString(this->getPlaymode()).c_str(), this->getClassName());
+      PRINTF(2)("Playmode %s Not Implemented in %s\n", Playable::playmodeToString(this->getPlaymode()).c_str(), this->getClassCName());
   }
 }
@@ -474,5 +474,5 @@
 
     default:
-      PRINTF(2)("Playmode %s Not Implemented in %s\n", Playable::playmodeToString(this->getPlaymode()).c_str(), this->getClassName());
+      PRINTF(2)("Playmode %s Not Implemented in %s\n", Playable::playmodeToString(this->getPlaymode()).c_str(), this->getClassCName());
   }
 }
Index: trunk/src/world_entities/spawning_point.cc
===================================================================
--- trunk/src/world_entities/spawning_point.cc	(revision 9391)
+++ trunk/src/world_entities/spawning_point.cc	(revision 9406)
@@ -31,4 +31,8 @@
 #include "shared_network_data.h"
 
+
+/// TODO REMOVE converter.h
+#include "converter.h"
+
 CREATE_FACTORY( SpawningPoint, CL_SPAWNING_POINT );
 
@@ -41,5 +45,5 @@
 
   this->init();
-  
+
   if (root != NULL)
     this->loadParams(root);
@@ -50,12 +54,12 @@
   this->setClassID(CL_SPAWNING_POINT, "SpawningPoint");
   PRINTF(0)("Created SpawningPoint\n");
-  
+
   this->teamId = -1;
   this->localTimer = 0.0f;
-  
+
   this->toList( OM_DEAD_TICK );
-  
+
   MessageManager::getInstance()->registerMessageHandler( MSGID_RESPAWN, respawnMessageHandler, NULL );
-  
+
   this->setSynchronized( true );
 }
@@ -94,5 +98,5 @@
   qe.entity = entity;
   qe.respawnTime = this->localTimer + delay;
-  
+
   queue.push_back( qe );
 }
@@ -105,10 +109,10 @@
 {
   const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
-  
+
   bool found = false;
-  
+
   if ( !list )
     return;
-    
+
   for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
   {
@@ -119,21 +123,21 @@
     }
   }
-  
+
   if ( !found )
     return;
 
-  PRINTF(0)("Spawningpoint spawns Entity (%s)\n", entity->getClassName());
+  PRINTF(0)("Spawningpoint spawns Entity (%s)\n", entity->getClassCName());
 
 
   entity->setAbsCoor( this->getAbsCoor() );
   entity->setAbsDir( this->getAbsDir() );
-  
+
   //TODO set camera (not smooth)
-  
+
   if ( State::getGameRules() )
   {
     (State::getGameRules())->registerSpawn( entity );
   }
-  
+
   entity->respawn();
 }
@@ -157,12 +161,12 @@
       //spawn the player
       this->spawn(it->entity);
-      
+
       const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
-  
+
       bool found = false;
-  
+
       if ( !list )
         return;
-    
+
       for ( std::list<BaseObject*>::const_iterator it2 = list->begin(); it2 != list->end(); it2++ )
       {
@@ -173,16 +177,16 @@
         }
       }
-  
-      if ( found && SharedNetworkData::getInstance()->isGameServer() )
+
+      if ( found && SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
         this->sendRespawnMessage( it->entity->getUniqueID() );
 
       std::list<QueueEntry>::iterator delit = it;
       it++;
-      
+
       queue.erase( delit );
-      
+
       continue;
     }
-    
+
     it++;
   }
@@ -203,9 +207,10 @@
 void SpawningPoint::sendRespawnMessage( int uniqueId )
 {
+#warning this byte array is not being deleted according to valginrd
   byte * buf = new byte[2*INTSIZE];
-  
+
   assert( Converter::intToByteArray( this->getUniqueID(), buf, INTSIZE ) == INTSIZE );
   assert( Converter::intToByteArray( uniqueId, buf + INTSIZE, INTSIZE ) == INTSIZE );
-  
+
   MessageManager::getInstance()->sendMessage( MSGID_RESPAWN, buf, 2*INTSIZE, RT_ALL_NOT_ME, 0, MP_HIGHBANDWIDTH );
 }
@@ -213,13 +218,13 @@
 bool SpawningPoint::respawnMessageHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId )
 {
-  if ( SharedNetworkData::getInstance()->isGameServer() )
+  if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
   {
     PRINTF(2)("server received spawn message!\n");
     return true;
   }
-    
+
   int spUniqueId;
   int uniqueId;
-  
+
   if ( dataLength != 2*INTSIZE )
   {
@@ -227,15 +232,15 @@
     return true;
   }
-  
+
   assert( Converter::byteArrayToInt( data, &spUniqueId ) == INTSIZE );
   assert( Converter::byteArrayToInt( data+INTSIZE, &uniqueId ) == INTSIZE );
-  
+
   PRINTF(0)("SPAWNMESSAGE %d\n", uniqueId);
-  
+
   SpawningPoint * sp = NULL;
   Playable      * playable = NULL;
-  
+
   const std::list<BaseObject*> * list = ClassList::getList( CL_SPAWNING_POINT );
-  
+
   if ( list )
   {
@@ -250,5 +255,5 @@
     }
   }
-  
+
   if ( !sp )
   {
@@ -256,7 +261,7 @@
     return false;
   }
-  
+
   list = ClassList::getList( CL_PLAYABLE );
-  
+
   if ( list )
   {
@@ -270,5 +275,5 @@
     }
   }
-  
+
   if ( !playable )
   {
@@ -276,7 +281,7 @@
     return false;
   }
-  
+
   sp->spawn( playable );
-  
+
   return true;
 }
Index: trunk/src/world_entities/spectator.cc
===================================================================
--- trunk/src/world_entities/spectator.cc	(revision 9391)
+++ trunk/src/world_entities/spectator.cc	(revision 9406)
@@ -25,5 +25,5 @@
 
 
-using namespace std;
+
 
 
Index: trunk/src/world_entities/terrain.cc
===================================================================
--- trunk/src/world_entities/terrain.cc	(revision 9391)
+++ trunk/src/world_entities/terrain.cc	(revision 9406)
@@ -33,5 +33,5 @@
 #include "state.h"
 
-using namespace std;
+
 
 CREATE_FACTORY(Terrain, CL_TERRAIN);
Index: trunk/src/world_entities/test_entity.cc
===================================================================
--- trunk/src/world_entities/test_entity.cc	(revision 9391)
+++ trunk/src/world_entities/test_entity.cc	(revision 9406)
@@ -33,5 +33,5 @@
 #include "state.h"
 
-using namespace std;
+
 
 
Index: trunk/src/world_entities/weapons/aim.cc
===================================================================
--- trunk/src/world_entities/weapons/aim.cc	(revision 9391)
+++ trunk/src/world_entities/weapons/aim.cc	(revision 9406)
@@ -27,5 +27,5 @@
 #include "world_entity.h"
 
-using namespace std;
+
 
 
Index: trunk/src/world_entities/weapons/aiming_system.cc
===================================================================
--- trunk/src/world_entities/weapons/aiming_system.cc	(revision 9391)
+++ trunk/src/world_entities/weapons/aiming_system.cc	(revision 9406)
@@ -28,5 +28,5 @@
 
 
-using namespace std;
+
 
 
@@ -91,5 +91,5 @@
 
 
-  for( int i = 0; i < this->selectionList.size(); i++)
+  for(unsigned int i = 0; i < this->selectionList.size(); i++)
   {
     distance = fabs((this->getAbsCoor() - this->selectionList[i]->getAbsCoor()).len());
@@ -101,5 +101,5 @@
   }
 
-  PRINTF(0)("entity: %s\n", nearestEntity->getClassName());
+  PRINTF(0)("entity: %s\n", nearestEntity->getClassCName());
     return nearestEntity;
 }
@@ -115,5 +115,5 @@
   if( this->owner != killer)
   {
-    //PRINTF(0)("real hit: %s\n", killer->getClassName());
+    //PRINTF(0)("real hit: %s\n", killer->getClassCName());
     this->selectionList.push_back(killer);
   }
Index: trunk/src/world_entities/weapons/aiming_turret.cc
===================================================================
--- trunk/src/world_entities/weapons/aiming_turret.cc	(revision 9391)
+++ trunk/src/world_entities/weapons/aiming_turret.cc	(revision 9406)
@@ -29,5 +29,5 @@
 CREATE_FACTORY(AimingTurret, CL_AIMING_TURRET);
 
-using namespace std;
+
 
 
Index: trunk/src/world_entities/weapons/ammo_container.cc
===================================================================
--- trunk/src/world_entities/weapons/ammo_container.cc	(revision 9391)
+++ trunk/src/world_entities/weapons/ammo_container.cc	(revision 9406)
@@ -22,5 +22,5 @@
 #include <assert.h>
 
-using namespace std;
+
 
 /**
Index: trunk/src/world_entities/weapons/cannon.cc
===================================================================
--- trunk/src/world_entities/weapons/cannon.cc	(revision 9391)
+++ trunk/src/world_entities/weapons/cannon.cc	(revision 9406)
@@ -35,5 +35,5 @@
 
 
-using namespace std;
+
 
 CREATE_FACTORY(Cannon, CL_CANNON);
Index: trunk/src/world_entities/weapons/crosshair.cc
===================================================================
--- trunk/src/world_entities/weapons/crosshair.cc	(revision 9391)
+++ trunk/src/world_entities/weapons/crosshair.cc	(revision 9406)
@@ -24,5 +24,5 @@
 #include "material.h"
 
-using namespace std;
+
 
 
Index: trunk/src/world_entities/weapons/fps_sniper_rifle.cc
===================================================================
--- trunk/src/world_entities/weapons/fps_sniper_rifle.cc	(revision 9391)
+++ trunk/src/world_entities/weapons/fps_sniper_rifle.cc	(revision 9406)
@@ -36,5 +36,5 @@
 #include "effects/explosion.h"
 
-using namespace std;
+
 
 
Index: trunk/src/world_entities/weapons/hyperblaster.cc
===================================================================
--- trunk/src/world_entities/weapons/hyperblaster.cc	(revision 9391)
+++ trunk/src/world_entities/weapons/hyperblaster.cc	(revision 9406)
@@ -34,5 +34,5 @@
 
 
-using namespace std;
+
 
 CREATE_FACTORY(Hyperblaster, CL_HYPERBLASTER);
Index: trunk/src/world_entities/weapons/targeting_turret.cc
===================================================================
--- trunk/src/world_entities/weapons/targeting_turret.cc	(revision 9391)
+++ trunk/src/world_entities/weapons/targeting_turret.cc	(revision 9406)
@@ -29,5 +29,5 @@
 CREATE_FACTORY(TargetingTurret, CL_TARGETING_TURRET);
 
-using namespace std;
+
 
 
Index: trunk/src/world_entities/weapons/turret.cc
===================================================================
--- trunk/src/world_entities/weapons/turret.cc	(revision 9391)
+++ trunk/src/world_entities/weapons/turret.cc	(revision 9406)
@@ -29,5 +29,5 @@
 CREATE_FACTORY(Turret, CL_TURRET);
 
-using namespace std;
+
 
 /**
Index: trunk/src/world_entities/weapons/weapon.cc
===================================================================
--- trunk/src/world_entities/weapons/weapon.cc	(revision 9391)
+++ trunk/src/world_entities/weapons/weapon.cc	(revision 9406)
@@ -36,5 +36,5 @@
 #include "elements/glgui_energywidget.h"
 
-using namespace std;
+
 
 ////////////////////
@@ -199,5 +199,5 @@
   else
   {
-    PRINTF(1)("Projectile %s does not exist for weapon %s\n", projectile.c_str(), this->getName());
+    PRINTF(1)("Projectile %s does not exist for weapon %s\n", projectile.c_str(), this->getCName());
   }
 }
@@ -213,5 +213,5 @@
     projectileFactory->prepare(count);
   else
-    PRINTF(2)("unable to create %d projectile for Weapon %s (%s)\n", count, this->getName(), this->getClassName());
+    PRINTF(2)("unable to create %d projectile for Weapon %s::%s\n", count, this->getClassCName(), this->getCName());
 }
 
@@ -234,5 +234,5 @@
   else
   {
-    PRINTF(2)("No projectile defined for Weapon %s(%s) can't return any\n", this->getName(), this->getClassName());
+    PRINTF(2)("No projectile defined for Weapon %s(%s) can't return any\n", this->getCName(), this->getClassCName());
     return NULL;
   }
@@ -313,5 +313,5 @@
   {
     this->energyWidget = new OrxGui::GLGuiEnergyWidget();
-    this->energyWidget->setDisplayedName(this->getClassName());
+    this->energyWidget->setDisplayedName(this->getClassCName());
     this->energyWidget->setSize2D( 20, 100);
     this->energyWidget->setMaximum(this->getEnergyMax());
@@ -442,5 +442,5 @@
     this->updateWidgets();
     // activate
-    PRINTF(4)("Activating the Weapon %s\n", this->getName());
+    PRINTF(4)("Activating the Weapon %s\n", this->getCName());
     this->activate();
     // setting up for next action
@@ -458,5 +458,5 @@
   //  if (this->currentState != WS_INACTIVE)
   {
-    PRINTF(4)("Deactivating the Weapon %s\n", this->getName());
+    PRINTF(4)("Deactivating the Weapon %s\n", this->getCName());
     // play Sound
     if (this->soundBuffers[WA_DEACTIVATE] != NULL)
@@ -527,5 +527,5 @@
 bool Weapon::reloadW()
 {
-  PRINTF(4)("Reloading Weapon %s\n", this->getName());
+  PRINTF(4)("Reloading Weapon %s\n", this->getCName());
   if (this->ammoContainer.get() != NULL &&
       unlikely(this->energy + this->ammoContainer->getStoredEnergy() < this->minCharge))
@@ -632,5 +632,5 @@
 void Weapon::debug() const
 {
-  PRINT(0)("Weapon-Debug %s, state: %s (duration: %fs), nextAction: %s\n", this->getName(), Weapon::stateToChar(this->currentState), this->stateDuration, Weapon::actionToChar(requestedAction));
+  PRINT(0)("Weapon-Debug %s, state: %s (duration: %fs), nextAction: %s\n", this->getCName(), Weapon::stateToChar(this->currentState), this->stateDuration, Weapon::actionToChar(requestedAction));
   PRINT(0)("Energy: max: %f; current: %f; chargeMin: %f, chargeMax %f\n",
            this->energyMax, this->energy, this->minCharge, this->maxCharge);
Index: trunk/src/world_entities/weapons/weapon_manager.cc
===================================================================
--- trunk/src/world_entities/weapons/weapon_manager.cc	(revision 9391)
+++ trunk/src/world_entities/weapons/weapon_manager.cc	(revision 9406)
@@ -83,8 +83,8 @@
     // NAMING
     char* tmpName;
-    if (this->getName())
-    {
-      tmpName = new char[strlen(this->getName()) + 10];
-      sprintf(tmpName, "%s_slot%d", this->getName(), i);
+    if (!this->getName().empty())
+    {
+      tmpName = new char[this->getName().size() + 10];
+      sprintf(tmpName, "%s_slot%d", this->getCName(), i);
     }
     else
@@ -265,5 +265,5 @@
   if (configID > 0 && slotID > 0 && this->configs[configID][slotID] != NULL)
   {
-    PRINTF(3)("Weapon-slot %d/%d of %s already poulated, remove weapon (%s::%s) first\n", configID, slotID, this->getName(), weapon->getClassName(), weapon->getName());
+    PRINTF(3)("Weapon-slot %d/%d of %s already poulated, remove weapon (%s::%s) first\n", configID, slotID, this->getCName(), weapon->getClassCName(), weapon->getCName());
     return false;
   }
@@ -302,5 +302,5 @@
     weapon->setDefaultTarget(this->crosshair);
   }
-  PRINTF(3)("Added a new Weapon (%s::%s) to the WeaponManager: config %i/ slot %i\n", weapon->getClassName(), weapon->getName(), configID, slotID);
+  PRINTF(3)("Added a new Weapon (%s::%s) to the WeaponManager: config %i/ slot %i\n", weapon->getClassCName(), weapon->getCName(), configID, slotID);
   return true;
 }
@@ -555,6 +555,6 @@
     {
       if (this->configs[i][j] != NULL)
-        PRINT(3)("Slot %d loaded a %s\n", j, this->configs[i][j]->getClassName());
-    }
-  }
-}
+        PRINT(3)("Slot %d loaded a %s\n", j, this->configs[i][j]->getClassCName());
+    }
+  }
+}
Index: trunk/src/world_entities/world_entity.cc
===================================================================
--- trunk/src/world_entities/world_entity.cc	(revision 9391)
+++ trunk/src/world_entities/world_entity.cc	(revision 9406)
@@ -414,5 +414,5 @@
 bool WorldEntity::registerCollision(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB)
 {
-  PRINTF(5)("registering collision of type: %s vs %s\n", entityA->getClassName(), entityB->getClassName());
+  PRINTF(5)("registering collision of type: %s vs %s\n", entityA->getClassCName(), entityB->getClassCName());
   // is there any handler listening?
   if( !this->bReactive)
@@ -506,5 +506,5 @@
    * You can always define a default Action.... don't be affraid just test it :)
    */
-  //  PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z);
+  //  PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassCName(), entity->getClassCName(), location.x, location.y, location.z);
 }
 
@@ -518,5 +518,5 @@
 void WorldEntity::collidesWithGround(const Vector& location)
 {
-  PRINTF(0)("BSP_GROUND: %s collides \n", this->getClassName() );
+  PRINTF(0)("BSP_GROUND: %s collides \n", this->getClassCName() );
 }
 
@@ -524,5 +524,5 @@
 {
 
-  // PRINTF(0)("BSP_GROUND: Player collides \n", this->getClassName() );
+  // PRINTF(0)("BSP_GROUND: Player collides \n", this->getClassCName() );
 
   Vector v = this->getAbsDirX();
@@ -594,5 +594,5 @@
 void WorldEntity::draw() const
 {
-  //PRINTF(0)("(%s::%s)\n", this->getClassName(), this->getName());
+  //PRINTF(0)("(%s::%s)\n", this->getClassCName(), this->getName());
   //  assert(!unlikely(this->models.empty()));
   {
@@ -676,5 +676,5 @@
   if (this->health > this->healthMax)
   {
-    PRINTF(3)("new maxHealth is bigger as the old health. Did you really intend to do this for (%s::%s)\n", this->getClassName(), this->getName());
+    PRINTF(3)("new maxHealth is bigger as the old health. Did you really intend to do this for (%s::%s)\n", this->getClassCName(), this->getCName());
     this->health = this->healthMax;
   }
@@ -699,5 +699,5 @@
   }
   else
-    PRINTF(3)("Allready created the HealthWidget for %s::%s\n", this->getClassName(), this->getName());
+    PRINTF(3)("Allready created the HealthWidget for %s::%s\n", this->getClassCName(), this->getCName());
 }
 
@@ -745,5 +745,5 @@
   this->decreaseHealth(damage);
 
-  PRINTF(5)("Hit me: %s now only %f/%f health\n", this->getClassName(), this->getHealth(), this->getHealthMax());
+  PRINTF(5)("Hit me: %s::%s now only %f/%f health\n", this->getClassCName(), this->getCName(), this->getHealth(), this->getHealthMax());
 
   if( this->getHealth() > 0)
@@ -811,5 +811,5 @@
 void WorldEntity::debugEntity() const
 {
-  PRINT(0)("WorldEntity %s::%s  (DEBUG)\n", this->getClassName(), this->getName());
+  PRINT(0)("WorldEntity %s::%s  (DEBUG)\n", this->getClassCName(), this->getCName());
   this->debugNode();
   PRINT(0)("List: %s ; ModelCount %d - ", ObjectManager::OMListToString(this->objectListNumber) , this->models.size());
@@ -817,5 +817,5 @@
   {
     if (models[i] != NULL)
-      PRINT(0)(" : %d:%s", i, this->models[i]->getName());
+      PRINT(0)(" : %d:%s", i, this->models[i]->getCName());
   }
   PRINT(0)("\n");
