Index: /branches/network/src/defs/class_id.h
===================================================================
--- /branches/network/src/defs/class_id.h	(revision 6677)
+++ /branches/network/src/defs/class_id.h	(revision 6678)
@@ -147,4 +147,5 @@
   CL_GLGUI_MAIN_WIDGET          =    0x00000f41,
   CL_NETWORK_MANAGER            =    0x00000f50,
+  CL_SHARED_NETWORK_DATA        =    0x00000f51,
 
 
Index: /branches/network/src/lib/coord/p_node.cc
===================================================================
--- /branches/network/src/lib/coord/p_node.cc	(revision 6677)
+++ /branches/network/src/lib/coord/p_node.cc	(revision 6678)
@@ -1084,19 +1084,19 @@
   this->setRelDir( Quaternion( Vector(f2, f3, f4), f1 ) );
 
-  int n;
-  char * childName;
-
-  PRINTF(0)("JKLO %d %d %d %d\n", data[__synchelp_read_i], data[__synchelp_read_i+1], data[__synchelp_read_i+2], data[__synchelp_read_i+3]);
-  SYNCHELP_READ_INT( n );
-  PRINTF(0)("read %s:n=%d\n", this->getName(), n);
-
-  for (int i = 0; i<n; i++)
-  {
-    SYNCHELP_READ_STRINGM( childName );
-    PRINTF(0)("RCVD CHILD = %s\n", childName);
-    addChild( childName );
-    delete childName;
-    childName = NULL;
-  }
+//   int n;
+//   char * childName;
+//
+//   PRINTF(0)("JKLO %d %d %d %d\n", data[__synchelp_read_i], data[__synchelp_read_i+1], data[__synchelp_read_i+2], data[__synchelp_read_i+3]);
+//   SYNCHELP_READ_INT( n );
+//   PRINTF(0)("read %s:n=%d\n", this->getName(), n);
+//
+//   for (int i = 0; i<n; i++)
+//   {
+//     SYNCHELP_READ_STRINGM( childName );
+//     PRINTF(0)("RCVD CHILD = %s\n", childName);
+//     addChild( childName );
+//     delete childName;
+//     childName = NULL;
+//   }
 
   return SYNCHELP_READ_N;
@@ -1135,25 +1135,25 @@
   SYNCHELP_WRITE_FLOAT( this->relDirection.v.z );
 
-  int n = children.size();
-
-  //check if camera is in children
-  for (std::list<PNode*>::const_iterator it = children.begin(); it!=children.end(); it++)
-  {
-    if ( (*it)->isA(CL_CAMERA) )
-      n--;
-  }
-  PRINTF(0)("write %s:n=%d\n", this->getName(), n);
-  SYNCHELP_WRITE_INT( n );
-  PRINTF(0)("ASDF %d %d %d %d\n", data[__synchelp_write_i-4], data[__synchelp_write_i-3], data[__synchelp_write_i-2], data[__synchelp_write_i-1]);
-
-  for (std::list<PNode*>::const_iterator it = children.begin(); it!=children.end(); it++)
-  {
-    //dont add camera because there is only one camera attached to local player
-    if ( !(*it)->isA(CL_CAMERA) )
-    {
-      PRINTF(0)("SENDING CHILD: %s\n", (*it)->getName());
-      SYNCHELP_WRITE_STRING( (*it)->getName() );
-    }
-  }
+//   int n = children.size();
+//   //check if camera is in children
+//   for (std::list<PNode*>::const_iterator it = children.begin(); it!=children.end(); it++)
+//   {
+//     if ( (*it)->isA(CL_CAMERA) )
+//       n--;
+//   }
+//   PRINTF(0)("write %s:n=%d\n", this->getName(), n);
+//   SYNCHELP_WRITE_INT( n );
+//   PRINTF(0)("ASDF %d %d %d %d\n", data[__synchelp_write_i-4], data[__synchelp_write_i-3], data[__synchelp_write_i-2], data[__synchelp_write_i-1]);
+//
+//
+//   for (std::list<PNode*>::const_iterator it = children.begin(); it!=children.end(); it++)
+//   {
+//     //dont add camera because there is only one camera attached to local player
+//     if ( !(*it)->isA(CL_CAMERA) )
+//     {
+//       PRINTF(0)("SENDING CHILD: %s\n", (*it)->getName());
+//       SYNCHELP_WRITE_STRING( (*it)->getName() );
+//     }
+//   }
 
   return SYNCHELP_WRITE_N;
Index: /branches/network/src/lib/network/Makefile.am
===================================================================
--- /branches/network/src/lib/network/Makefile.am	(revision 6677)
+++ /branches/network/src/lib/network/Makefile.am	(revision 6678)
@@ -6,4 +6,5 @@
 libORXnet_a_SOURCES = synchronizeable.cc \
 		      network_manager.cc \
+		      shared_network_data.cc \
 		      network_socket.cc \
 		      connection_monitor.cc \
@@ -21,4 +22,5 @@
 noinst_HEADERS = synchronizeable.h \
                  network_manager.h \
+                 shared_network_data.h \
                  network_socket.h \
                  connection_monitor.h \
Index: /branches/network/src/lib/network/netdefs.h
===================================================================
--- /branches/network/src/lib/network/netdefs.h	(revision 6677)
+++ /branches/network/src/lib/network/netdefs.h	(revision 6678)
@@ -17,4 +17,7 @@
 
 
+#define MAX_CONNECTIONS 1000
+
+
 typedef unsigned char byte;
 
Index: /branches/network/src/lib/network/network_game_manager.cc
===================================================================
--- /branches/network/src/lib/network/network_game_manager.cc	(revision 6677)
+++ /branches/network/src/lib/network/network_game_manager.cc	(revision 6678)
@@ -213,10 +213,10 @@
   if ( this->isServer())
   {
-    if ( NetworkManager::getInstance()->getNewUniqueID() < 0 )
+    if ( SharedNetworkData::getInstance()->getNewUniqueID() < 0 )
     {
       PRINTF(1)("Cannot create entity! There are no more uniqueIDs left!\n");
       return -1;
     }
-    return this->executeCreateEntity( classID, NetworkManager::getInstance()->getNewUniqueID(), owner );
+    return this->executeCreateEntity( classID, SharedNetworkData::getInstance()->getNewUniqueID(), owner );
   }
   else
@@ -237,5 +237,5 @@
   if ( this->isServer() )
   {
-    if ( NetworkManager::getInstance()->getNewUniqueID() < 0 )
+    if ( SharedNetworkData::getInstance()->getNewUniqueID() < 0 )
     {
       PRINTF(1)("Cannot create entity! There are no more uniqueIDs left!\n");
@@ -255,5 +255,5 @@
     {
       Synchronizeable * s = dynamic_cast<Synchronizeable*>(b);
-      s->setUniqueID( NetworkManager::getInstance()->getNewUniqueID() );
+      s->setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() );
       s->setOwner( 0 );
       // all entities created via this function are added automaticaly to the synchronizeable list
Index: /branches/network/src/lib/network/network_manager.cc
===================================================================
--- /branches/network/src/lib/network/network_manager.cc	(revision 6677)
+++ /branches/network/src/lib/network/network_manager.cc	(revision 6678)
@@ -20,8 +20,5 @@
 #define DEBUG_MODULE_NETWORK
 
-
-#include "network_stream.h"
 #include "class_list.h"
-
 #include "debug.h"
 #include "shell_command.h"
@@ -29,4 +26,6 @@
 /* include your own header */
 #include "network_manager.h"
+#include "shared_network_data.h"
+#include "network_stream.h"
 
 
@@ -52,8 +51,5 @@
   this->syncList = NULL;
   this->defaultSyncStream = NULL;
-
-  this->hostID = -1;
-  this->newUniqueID = MAX_CONNECTIONS + 2;
-  this->bGameServer = false;
+  this->sharedNetworkData = SharedNetworkData::getInstance();
 
   PRINTF(0)("NetworkManager created\n");
@@ -102,4 +98,5 @@
 
   this->defaultSyncStream = new NetworkStream(ipAddress);
+  this->sharedNetworkData->setDefaultSyncStream(this->defaultSyncStream);
   this->defaultSyncStream->startHandshake();
   return 1;
@@ -113,34 +110,12 @@
 int NetworkManager::createServer(unsigned int port)
 {
-  this->hostID = 0;
-  this->bGameServer = true;
+  this->sharedNetworkData->setHostID(0);
+  this->sharedNetworkData->setGameServer(true);
   this->defaultSyncStream = new NetworkStream(port);
+  this->sharedNetworkData->setDefaultSyncStream(this->defaultSyncStream);
   this->defaultSyncStream->createNetworkGameManager();
   PRINTF(0)("CREATE SERVER\n");
-  this->bGameServer = true;
   SDL_Delay(20);
   return 1;
-}
-
-
-/**
- *  creates a connection from one object to a host
- * @param address: the address of the destination host
- * @param synchronizeable: reference to the sync object
- */
-NetworkStream& NetworkManager::establishConnection(IPaddress& address, Synchronizeable& sync)
-{
-  /* creating a new network stream, it will register itself automaticaly to the class list */
-  this->defaultSyncStream = new NetworkStream(address);
-  this->defaultSyncStream->connectSynchronizeable(sync);
-}
-
-
-/**
- *  teardown a connection
- */
-void NetworkManager::shutdownConnection()
-{
-  PRINTF(0)("Shutdown connection\n");
 }
 
@@ -167,13 +142,4 @@
 }
 
-/**
- * Sets the hostID to a specific number
- * @param id: The new ID
- */
-void NetworkManager::setHostID(int id)
-{
-    this->hostID = id;
-}
-
 
 
Index: /branches/network/src/lib/network/network_manager.h
===================================================================
--- /branches/network/src/lib/network/network_manager.h	(revision 6677)
+++ /branches/network/src/lib/network/network_manager.h	(revision 6678)
@@ -6,9 +6,10 @@
 /* you will want to add such a a line at your header file also, since it will
    prevent c++ from including your code twice*/
-#ifndef _NETWORK_MANGER
+#ifndef _NETWORK_MANAGER
 #define _NETWORK_MANAGER
 
 /* include this file, it contains some default definitions */
 #include "netdefs.h"
+#include "shared_network_data.h"
 
 /* include base_object.h since all classes are derived from this one */
@@ -38,21 +39,11 @@
     int createServer(unsigned int port);
 
-    NetworkStream& establishConnection(IPaddress& address, Synchronizeable& sync);
-    void shutdownConnection();
-
-
-    void setHostID(int id);
     /** Returns the hostID @return The hostID of the object */
-    inline int getHostID() { return this->hostID; }
-    inline bool isGameServer() { return this->bGameServer; }
+    inline int getHostID() { return this->sharedNetworkData->getHostID(); }
+    inline bool isGameServer() { return this->sharedNetworkData->isGameServer(); }
 
 
     void connectSynchronizeable(Synchronizeable& sync);
     void synchronize();
-
-    inline NetworkStream* getDefaultSyncStream() { return this->defaultSyncStream; }
-
-    /** @returns the next uniqueID free for an object */
-    inline int getNewUniqueID() { return ( this->bGameServer)?this->newUniqueID++:-1; }
 
     void debug();
@@ -68,8 +59,6 @@
     static NetworkManager*           singletonRef;            //!< Pointer to the only instance of this Class
     NetworkStream*                   defaultSyncStream;       //!< FIXME: this is only for testing purposes
-    int                              hostID;                  //!< The Host-ID of the Manager
-    bool                             bGameServer;             //!< true if it is a server
-    int                              newUniqueID;
 
+    SharedNetworkData*               sharedNetworkData;       //!< reference to the shared data
 };
 
Index: /branches/network/src/lib/network/network_stream.cc
===================================================================
--- /branches/network/src/lib/network/network_stream.cc	(revision 6677)
+++ /branches/network/src/lib/network/network_stream.cc	(revision 6678)
@@ -194,5 +194,5 @@
           if ( type != NET_SERVER )
           {
-            NetworkManager::getInstance()->setHostID( handshakes[i]->getHostId() );
+            SharedNetworkData::getInstance()->setHostID( handshakes[i]->getHostId() );
             myHostId = NetworkManager::getInstance()->getHostID();
 
Index: /branches/network/src/lib/network/network_stream.h
===================================================================
--- /branches/network/src/lib/network/network_stream.h	(revision 6677)
+++ /branches/network/src/lib/network/network_stream.h	(revision 6678)
@@ -14,6 +14,4 @@
 #include "server_socket.h"
 #include "handshake.h"
-
-#define MAX_CONNECTIONS 1000
 
 class Synchronizeable;
Index: /branches/network/src/lib/network/shared_network_data.cc
===================================================================
--- /branches/network/src/lib/network/shared_network_data.cc	(revision 6678)
+++ /branches/network/src/lib/network/shared_network_data.cc	(revision 6678)
@@ -0,0 +1,46 @@
+/*
+   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 "shared_network_data.h"
+#include "netdefs.h"
+
+
+using namespace std;
+
+
+SharedNetworkData* SharedNetworkData::singletonRef = NULL;
+
+/**
+ * Standard constructor
+ */
+SharedNetworkData::SharedNetworkData()
+{
+  /* set the class id for the base object */
+  this->setClassID(CL_SHARED_NETWORK_DATA, "SharedNetworkData");
+
+  this->hostID = -1;
+  this->defaultSyncStream = NULL;
+  this->newUniqueID = MAX_CONNECTIONS + 2;
+  this->bGameServer = false;
+}
+
+
+/**
+ * Standard destructor
+ */
+SharedNetworkData::~SharedNetworkData()
+{}
Index: /branches/network/src/lib/network/shared_network_data.h
===================================================================
--- /branches/network/src/lib/network/shared_network_data.h	(revision 6678)
+++ /branches/network/src/lib/network/shared_network_data.h	(revision 6678)
@@ -0,0 +1,61 @@
+/*!
+ * @file shared_network_data.h
+ *  some shared data from the NetworkManager
+ */
+
+#ifndef _SHARED_NETWORK_DATA
+#define _SHARED_NETWORK_DATA
+
+#include "base_object.h"
+
+
+class NetworkStream;
+class Synchronizeable;
+template<typename>
+    class tList;
+
+/* and here is the class itsself*/
+class SharedNetworkData : public BaseObject
+{
+
+  public:
+    inline static SharedNetworkData* getInstance() { if (!SharedNetworkData::singletonRef) SharedNetworkData::singletonRef = new SharedNetworkData();
+      return SharedNetworkData::singletonRef; }
+    virtual ~SharedNetworkData();
+
+    /** @returns the next uniqueID free for an object */
+    inline int getNewUniqueID() { return ( this->bGameServer)?this->newUniqueID++:-1; }
+
+    /** @returns true is this node is a game server */
+    inline bool isGameServer() { return this->bGameServer; }
+    /** sets the game server flag @param bGameServer true if it is a game server */
+    inline void setGameServer(bool bGameServer) { this->bGameServer = bGameServer; }
+
+    /** @returns the hostID of the node */
+    inline int getHostID() { return this->hostID; }
+    /** sets the hostID of this node @param hostID of the node */
+    inline void setHostID(int hostID) { this->hostID = hostID; }
+
+    /** @returns the default synchronize stream */
+    inline NetworkStream* getDefaultSyncStream() { return this->defaultSyncStream; }
+    /** sets the default sync stream @param defaultSyncStream the default sync stream */
+    inline void setDefaultSyncStream(NetworkStream* defaultSyncStream) { this->defaultSyncStream = defaultSyncStream; }
+
+
+  private:
+    SharedNetworkData();
+
+
+  private:
+    int                             newUniqueID;             //!< next uniqueID
+    bool                            bGameServer;             //!< true if it is a server
+    int                             hostID;                  //!< The Host-ID of the Manager
+    NetworkStream*                  defaultSyncStream;       //!< default synchronize NetworkStream
+
+    static SharedNetworkData*       singletonRef;            //!< Pointer to the only instance of this Class
+
+};
+
+
+
+#endif /* _SHARED_NETWORK_DATA */
Index: /branches/network/src/lib/network/synchronizeable.cc
===================================================================
--- /branches/network/src/lib/network/synchronizeable.cc	(revision 6677)
+++ /branches/network/src/lib/network/synchronizeable.cc	(revision 6678)
@@ -17,11 +17,12 @@
 #define DEBUG_MODULE_NETWORK
 
-#include "synchronizeable.h"
-
-#include "network_manager.h"
+#include "shared_network_data.h"
 #include "network_stream.h"
 #include "netdefs.h"
 
 #include "assert.h"
+
+#include "synchronizeable.h"
+
 
 
@@ -34,5 +35,5 @@
   this->owner = 0;
   this->state = 0;
-  this->hostID = NetworkManager::getInstance()->getHostID();
+  this->hostID = SharedNetworkData::getInstance()->getHostID();
   this->setIsServer(this->hostID == 0);
   this->uniqueID = -1;
@@ -40,11 +41,10 @@
   this->setRequestedSync( false );
   this->setIsOutOfSync( !(this->isServer()) );
-
   this->bSynchronize = false;
 
-  NetworkStream* nd = NetworkManager::getInstance()->getDefaultSyncStream();
+  NetworkStream* nd = SharedNetworkData::getInstance()->getDefaultSyncStream();
   assert(nd != NULL);
   nd->connectSynchronizeable(*this);
-  this->setUniqueID(NetworkManager::getInstance()->getNewUniqueID());
+  this->setUniqueID(SharedNetworkData::getInstance()->getNewUniqueID());
 }
 
Index: /branches/network/src/world_entities/movie_entity.cc
===================================================================
--- /branches/network/src/world_entities/movie_entity.cc	(revision 6677)
+++ /branches/network/src/world_entities/movie_entity.cc	(revision 6678)
@@ -56,5 +56,6 @@
 MovieEntity::~MovieEntity ()
 {
-  delete this->media_container;
+  if( this->media_container)
+    delete this->media_container;
 }
 
