Index: branches/network/src/orxonox.cc
===================================================================
--- branches/network/src/orxonox.cc	(revision 6347)
+++ branches/network/src/orxonox.cc	(revision 6351)
@@ -29,32 +29,32 @@
 
 #include "globals.h"
+#include "class_list.h"
 
 #include "gui.h"
 
-#include "world.h"
 #include "parser/ini_parser/ini_parser.h"
-#include "game_loader.h"
-
-//ENGINES
+
+
+// load the core engines
 #include "graphics_engine.h"
 #include "sound_engine.h"
 #include "resource_manager.h"
 #include "cd_engine.h"
-#include "text_engine.h"
 #include "event_handler.h"
+#include "network_manager.h"
+#include "game_loader.h"
+
 
 #include "factory.h"
 #include "fast_factory.h"
 
-#include "benchmark.h"
-
-#include "class_list.h"
+// #include "benchmark.h"
+
+
 #include "shell_command_class.h"
 #include "shell_command.h"
 #include "shell_buffer.h"
-
 #include "load_param_description.h"
 
-#include "network_manager.h"
 
 #include <string.h>
@@ -64,5 +64,5 @@
 using namespace std;
 
-SHELL_COMMAND(restart, Orxonox, restart);
+
 
 /**
@@ -138,25 +138,4 @@
 Orxonox* Orxonox::singletonRef = NULL;
 
-// DANGEROUS
-void Orxonox::restart()
-{
-  //   int argc = this->argc;
-  //   char** argv = this->argv;
-  //
-  //   Orxonox *orx = Orxonox::getInstance();
-  //
-  //   delete orx;
-  //
-  //   orx = Orxonox::getInstance();
-  //
-  //   if((*orx).init(argc, argv) == -1)
-  //   {
-  //     PRINTF(1)("! Orxonox initialization failed\n");
-  //     return;
-  //   }
-  //
-  //   printf("finished inizialisation\n");
-  //   orx->start();
-}
 
 /**
@@ -188,4 +167,5 @@
   this->argv = argv;
 
+
   this->serverName = name;
   this->port = port;
@@ -202,15 +182,15 @@
   // initialize everything
   SDL_Init(0);
-  if( initResources () == -1)
-    return -1;
-  if( initVideo() == -1)
-    return -1;
-  if( initSound() == -1)
-    return -1;
-  if( initInput() == -1)
-    return -1;
-  if( initNetworking () == -1)
-    return -1;
-  if( initMisc () == -1)
+  if( initResources (argc, argv) == -1)
+    return -1;
+  if( initVideo(argc, argv) == -1)
+    return -1;
+  if( initSound(argc, argv) == -1)
+    return -1;
+  if( initInput(argc, argv) == -1)
+    return -1;
+  if( initNetworking (argc, argv) == -1)
+    return -1;
+  if( initMisc (argc, argv) == -1)
     return -1;
 
@@ -222,7 +202,12 @@
  * initializes SDL and OpenGL
  */
-int Orxonox::initVideo()
+int Orxonox::initVideo(int argc, char** argv)
 {
   PRINTF(3)("> Initializing video\n");
+
+  for( int i = 0; i < argc; i++)
+    if( !strcmp( "--dedicated-server", argv[i]) || !strcmp("-ds", argv[i]))
+      this->dedicatedServer = 1;
+
 
   GraphicsEngine::getInstance();
@@ -236,4 +221,10 @@
     delete[] iconName;
   }
+
+  /* if this orxonox program is a dedicated server - don't draw anything */
+  if( this->dedicatedServer == 1)
+  {
+
+  }
   return 0;
 }
@@ -243,5 +234,5 @@
  * initializes the sound engine
  */
-int Orxonox::initSound()
+int Orxonox::initSound(int argc, char** argv)
 {
   PRINT(3)("> Initializing sound\n");
@@ -258,5 +249,5 @@
  * initializes input functions
  */
-int Orxonox::initInput()
+int Orxonox::initInput(int argc, char** argv)
 {
   PRINT(3)("> Initializing input\n");
@@ -272,7 +263,67 @@
  * initializes network system
  */
-int Orxonox::initNetworking()
+int Orxonox::initNetworking(int argc, char** argv)
 {
   PRINT(3)("> Initializing networking\n");
+
+  /* command line parsing
+     parsing following commands:
+       --client            or  -c
+       --server            or  -s
+       --dedicated-server  or  -ds
+  */
+  int i;
+  for( i = 0; i < argc; ++i )
+  {
+    if( !strcmp( "--client", argv[i]) || !strcmp("-c", argv[i]))
+    {
+      if( argc <= (i+2))
+      {
+        printf(" Wrong arguments try following notations:\n");
+        printf("   --client [server ip address] [port number]\n");
+        printf("   --client [dns name] [port number]\n");
+        return -1;
+      }
+
+      const char* name = argv[i+1];
+      int port = atoi(argv[i+2]);
+      printf("Starting Orxonox as client: connecting to %s, on port %i\n", name, port);
+
+      this->serverName = name;
+      this->port = port;
+    }
+    else if( !strcmp( "--server", argv[i]) || !strcmp("-s", argv[i]))
+    {
+      if( argc <= (i+1))
+      {
+        printf(" Wrong arguments try following notations:\n");
+        printf("   --server [port number]\n");
+        return -1;
+      }
+
+      int port = atoi(argv[i+1]);
+      printf("Starting Orxonox as server, listening on port %i\n", port);
+
+      this->serverName = NULL;
+      this->port = port;
+    }
+    else if( !strcmp( "--dedicated-server", argv[i]) || !strcmp("-ds", argv[i]))
+    {
+      if( argc <= (i+1))
+      {
+        printf(" Wrong arguments try following notations:\n");
+        printf("   --dedicated-server [port number]\n");
+        return -1;
+      }
+
+      int port = atoi(argv[i+1]);
+      printf("Starting Orxonox as dedicated-server, listening on port %i\n", port);
+
+      this->serverName = NULL;
+      this->port = port;
+      /*this->dedicatedServer = 1;  - this is already been done in the initVideo(...) function*/
+    }
+  }
+
 
   if( this->serverName != NULL) // we are a client
@@ -289,5 +340,5 @@
  * initializes and loads resource files
  */
-int Orxonox::initResources()
+int Orxonox::initResources(int argc, char** argv)
 {
   PRINTF(3)("> Initializing resources\n");
@@ -333,5 +384,5 @@
  * @return -1 on failure
  */
-int Orxonox::initMisc()
+int Orxonox::initMisc(int argc, char** argv)
 {
   ShellBuffer::getInstance();
@@ -405,8 +456,4 @@
     else if(!strcmp( "--gui", argv[i])      || !strcmp("-g", argv[i]))
       showGui = true;
-    else if(!strcmp( "--client", argv[i])   || !strcmp("-c", argv[i]))
-      return startNetworkOrxonox(argc, argv);
-    else if(!strcmp( "--server", argv[i])   || !strcmp("-s", argv[i]))
-      return startNetworkOrxonox(argc, argv);
     else if(!strcmp( "--license", argv[i])  || !strcmp("-s", argv[i]))
       return PRINT(0)(ORXONOX_LICENSE_SHORT);
@@ -444,52 +491,4 @@
 
 
-
-
-/**
- * starts orxonox in network mode
- * @param argc parameters count given to orxonox
- * @param argv parameters given to orxonox
- */
-int startNetworkOrxonox(int argc, char** argv)
-{
-
-  int i;
-  for(i = 0; i < argc; ++i )
-  {
-    if( !strcmp( "--client", argv[i]) || !strcmp("-c", argv[i]))
-    {
-      if( argc <= (i+2))
-      {
-        printf(" Wrong arguments try following notations:\n");
-        printf("   --client [server ip address] [port number]\n");
-        printf("   --client [dns name] [port number]\n");
-        return 0;
-      }
-
-      const char* name = argv[i+1];
-      int port = atoi(argv[i+2]);
-      printf("Starting Orxonox as client: connecting to %s, on port %i\n", name, port);
-
-      startOrxonox(argc, argv, name, port);
-    }
-    else if( !strcmp( "--server", argv[i]) || !strcmp("-s", argv[i]))
-    {
-      if( argc <= (i+1))
-      {
-        printf(" Wrong arguments try following notations:\n");
-        printf("   --server [port number]\n");
-        return 0;
-      }
-
-      int port = atoi(argv[i+1]);
-      printf("Starting Orxonox as server, listening on port %i\n", port);
-
-      startOrxonox(argc, argv, NULL, port);
-    }
-  }
-}
-
-
-
 /**
  * starts orxonox
Index: branches/network/src/orxonox.h
===================================================================
--- branches/network/src/orxonox.h	(revision 6347)
+++ branches/network/src/orxonox.h	(revision 6351)
@@ -9,5 +9,4 @@
 #include "base_object.h"
 
-class WorldEntity;
 class GameLoader;
 class IniParser;
@@ -18,4 +17,5 @@
 class Orxonox : public BaseObject {
 
+
  public:
   virtual ~Orxonox ();
@@ -24,22 +24,20 @@
 
   int init(int argc, char** argv, const char* name, int port);
+  void start();
 
-  void restart();
-
-  void start();
 
  private:
   Orxonox ();
 
+  int initResources (int argc, char** argv);
+  int initVideo (int argc, char** argv);
+  int initSound (int argc, char** argv);
+  int initInput (int argc, char** argv);
+  int initNetworking (int argc, char** argv);
+  int initMisc (int argc, char** argv);
+
   void parseIniFile(const char* fileName);
+  const char* getConfigFile ();
 
-  int initResources ();
-  int initVideo ();
-  int initSound ();
-  int initInput ();
-  int initNetworking ();
-  int initMisc ();
-
-  const char* getConfigFile ();
 
  private:
@@ -54,4 +52,5 @@
 
   const char*       serverName;              //!< Name of the Orxonox client if == NULL -> server
+  int               dedicatedServer;         //!< is 1 if the server is a dedicated server, 0 else
   int               port;                    //!< number of the network port of the server/client if == -1 no network
 };
@@ -63,5 +62,4 @@
 int showHelp(int argc, char** argv);
 int showLicense();
-int startNetworkOrxonox(int argc, char** argv);
 int startOrxonox(int argc, char** argv, const char* clientName, int port);
 
