Index: code/trunk/src/orxonox/gamestates/GSDedicated.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSDedicated.cc	(revision 3301)
+++ code/trunk/src/orxonox/gamestates/GSDedicated.cc	(revision 3304)
@@ -42,5 +42,5 @@
 #include <boost/bind.hpp>
 
-#ifndef ORXONOX_PLATFORM_WINDOWS
+#ifdef ORXONOX_PLATFORM_UNIX
 #include <termios.h>
 #endif
@@ -58,5 +58,4 @@
         : GameState(params)
         , server_(0)
-        , timeSinceLastUpdate_(0)
         , closeThread_(false)
         , cleanLine_(true)
@@ -65,6 +64,4 @@
         , cursorY_(0)
     {
-        this->commandLine_ = new unsigned char[MAX_COMMAND_LENGTH];
-//         memset( this->commandLine_, 0, MAX_COMMAND_LENGTH );
     }
 
@@ -96,5 +93,5 @@
         
         closeThread_ = true;
-#ifndef ORXONOX_PLATFORM_WINDOWS
+#ifdef ORXONOX_PLATFORM_UNIX
         std::cout << "\033[0G\033[K";
         std::cout.flush();
@@ -102,5 +99,7 @@
         delete this->originalTerminalSettings_;
 #endif
-        //inputThread_->join();
+        COUT(0) << "Press enter to end the game..." << std::endl;
+        inputThread_->join();
+        delete this->inputThread_;
 
         GameMode::setHasServer(false);
@@ -109,16 +108,5 @@
     void GSDedicated::update(const Clock& time)
     {
-        timeSinceLastUpdate_ += time.getDeltaTime();
-        if (timeSinceLastUpdate_ >= NETWORK_PERIOD)
-        {
-            timeSinceLastUpdate_ -= static_cast<unsigned int>(timeSinceLastUpdate_ / NETWORK_PERIOD) * NETWORK_PERIOD;
-            server_->update(time);
-        }
-        else
-        {
-            msleep(static_cast<unsigned int>((NETWORK_PERIOD - timeSinceLastUpdate_)*1000));
-            msleep(static_cast<unsigned int>(NETWORK_PERIOD*1000)); // NOTE: this is to throttle the non-network framerate
-//            COUT(0) << "sleeping for " << static_cast<int>((NETWORK_PERIOD - timeSinceLastUpdate_) * 1000 * 1000) << " usec" << endl;
-        }
+        server_->update(time);
         processQueue();
         printLine();
@@ -127,4 +115,6 @@
     void GSDedicated::inputThread()
     {
+        this->commandLine_ = new unsigned char[MAX_COMMAND_LENGTH];
+//         memset( this->commandLine_, 0, MAX_COMMAND_LENGTH );
         unsigned char c;
         unsigned int  escapeChar=0;
@@ -194,5 +184,6 @@
                             std::cout << endl << CommandExecutor::hint( std::string((const char*)this->commandLine_,inputIterator_) ) << endl;
                             strncpy(reinterpret_cast<char*>(this->commandLine_), CommandExecutor::complete( std::string(reinterpret_cast<char*>(this->commandLine_),inputIterator_) ).c_str(), MAX_COMMAND_LENGTH);
-                            inputIterator_ = strlen((const char*)this->commandLine_);
+                            this->inputIterator_ = strlen((const char*)this->commandLine_);
+                            this->cursorX_ = this->inputIterator_;
                             break;
                         }
@@ -207,9 +198,11 @@
             }
         }
+
+        delete[] this->commandLine_;
     }
     
     void GSDedicated::printLine()
     {
-#ifndef ORXONOX_PLATFORM_WINDOWS
+#ifdef ORXONOX_PLATFORM_UNIX
         // set cursor to the begining of the line and erase the line
         std::cout << "\033[0G\033[K";
@@ -251,5 +244,5 @@
     void GSDedicated::setTerminalMode()
     {
-#ifndef ORXONOX_PLATFORM_WINDOWS
+#ifdef ORXONOX_PLATFORM_UNIX
         termios new_settings;
      
@@ -268,5 +261,5 @@
     void GSDedicated::resetTerminalMode()
     {
-#ifndef ORXONOX_PLATFORM_WINDOWS
+#ifdef ORXONOX_PLATFORM_UNIX
         tcsetattr(0, TCSANOW, GSDedicated::originalTerminalSettings_);
 #endif
Index: code/trunk/src/orxonox/gamestates/GSDedicated.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSDedicated.h	(revision 3301)
+++ code/trunk/src/orxonox/gamestates/GSDedicated.h	(revision 3304)
@@ -66,5 +66,4 @@
         
         Server*                 server_;
-        float                   timeSinceLastUpdate_;
         
         boost::thread           *inputThread_;
Index: code/trunk/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSRoot.cc	(revision 3301)
+++ code/trunk/src/orxonox/gamestates/GSRoot.cc	(revision 3304)
@@ -34,4 +34,5 @@
 #include "core/Game.h"
 #include "core/GameMode.h"
+#include "network/NetworkFunction.h"
 #include "tools/Timer.h"
 #include "interfaces/TimeFactorListener.h"
@@ -61,4 +62,5 @@
     GSRoot::~GSRoot()
     {
+        NetworkFunctionBase::destroyAllNetworkFunctions();
     }
 
