Index: trunk/src/util/loading/load_param.cc
===================================================================
--- trunk/src/util/loading/load_param.cc	(revision 5111)
+++ trunk/src/util/loading/load_param.cc	(revision 5113)
@@ -17,5 +17,4 @@
 
 #include "list.h"
-#include "array.h"
 #include "base_object.h"
 
@@ -386,11 +385,11 @@
  * searches for classes, which beginn with classNameBegin
  * @param classNameBegin the beginning string of a Class
- * @return a NEW char-array with ClassNames. The ARRAY should be deleted afterwards,
+ * @return a NEW char-array with ClassNames. The LIST should be deleted afterwards,
  * !! The strings MUST NOT be deleted !!
  */
-Array<char*>* LoadClassDescription::searchClassWithShort(const char* classNameBegin)
+tList<const char>* LoadClassDescription::searchClassWithShort(const char* classNameBegin)
 {
   unsigned int searchLength = strlen(classNameBegin);
-  Array<char*>* retVal = new Array<char*>;
+  tList<const char>* retVal = new tList<const char>;
 
   tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator();
@@ -401,5 +400,5 @@
         !strncasecmp(enumClassDesc->className, classNameBegin, searchLength))
     {
-      retVal->addEntry(enumClassDesc->className);
+      retVal->add(enumClassDesc->className);
     }
     enumClassDesc = iterator->nextElement();
@@ -407,5 +406,4 @@
   delete iterator;
 
-  retVal->finalizeArray();
   return retVal;
 }
Index: trunk/src/util/loading/load_param.h
===================================================================
--- trunk/src/util/loading/load_param.h	(revision 5111)
+++ trunk/src/util/loading/load_param.h	(revision 5113)
@@ -31,5 +31,4 @@
 // Forward Declaration //
 template<class T> class tList;
-template<class T> class Array;
 
 //! macro that makes it even more easy to load a Parameter
@@ -312,5 +311,5 @@
 
   static void printAll(const char* fileName = NULL);
-  static Array<char*>* searchClassWithShort(const char* classNameBegin);
+  static tList<const char>* searchClassWithShort(const char* classNameBegin);
 //  static const LoadParamDescription* getClass(const char* className);
 
Index: trunk/src/util/resource_manager.cc
===================================================================
--- trunk/src/util/resource_manager.cc	(revision 5111)
+++ trunk/src/util/resource_manager.cc	(revision 5113)
@@ -99,11 +99,11 @@
       this->dataDir = new char[strlen(realDir)+1];
       strcpy(this->dataDir, realDir);
-      delete realDir;
+      delete[] realDir;
       return true;
     }
   else
     {
-      PRINTF(1)("%s is not a Directory, and can not be the Data Directory, leaving as %s \n", dataDir, this->dataDir);
-      delete realDir;
+      PRINTF(1)("%s is not a Directory, and can not be the Data Directory, leaving as %s \n", realDir, this->dataDir);
+      delete[] realDir;
       return false;
     }
@@ -631,5 +631,6 @@
 
   // checking for the termination of the string given. If there is a "/" at the end cut it away
-  if (directoryName[strlen(directoryName)-1] == '/')
+  if (directoryName[strlen(directoryName)-1] == '/' ||
+      directoryName[strlen(directoryName)-1] == '\\')
     {
       tmpDirName = new char[strlen(directoryName)+1];
@@ -651,5 +652,5 @@
                             ))
         {
-          delete tmpDirName;
+          delete[] tmpDirName;
           return true;
         }
Index: trunk/src/util/shell.cc
===================================================================
--- trunk/src/util/shell.cc	(revision 5111)
+++ trunk/src/util/shell.cc	(revision 5113)
@@ -20,9 +20,11 @@
 #include "text_engine.h"
 #include "list.h"
-#include "array.h"
 #include "graphics_engine.h"
 #include "event_handler.h"
 
 #include "load_param.h"
+#include "class_list.h"
+
+#include "key_names.h"
 #include "debug.h"
 #include <stdarg.h>
@@ -40,25 +42,29 @@
   this->setName("Shell");
 
+  this->shellHeight = 400;
+  this->bActive = false;
   this->buffer = new tList<char>;
 
-  this->textSize = 10;
+  this->textSize = 15;
+  this->lineSpacing = 5;
 
   //this->bufferSize = 0;
   this->bufferText = NULL;
   this->setBufferSize(100);
+  this->bufferDisplaySize = 10;
   this->setBufferDisplaySize(10);
-  this->setAbsCoor2D(3, GraphicsEngine::getInstance()->getResolutionY());
+  this->setAbsCoor2D(3, -400);
   this->delayed = 0;
   this->setRepeatDelay(.3, .05);
   this->pressedKey = SDLK_FIRST;
 
-  this->inputLineText = TextEngine::getInstance()->createText("fonts/earth.ttf", 10, TEXT_DYNAMIC, 255, 0, 0);
-  this->inputLineText->setAlignment(TEXT_ALIGN_LEFT);
-  this->inputLineText->setText(NULL);
+  this->inputLineText = NULL;
   this->inputLine = new char[1];
   this->inputLine[0] = '\0';
-  this->inputLineText->setParent2D(this);
-
-
+
+  this->rebuildText();
+  this->completionList = NULL;
+
+  // EVENT-Handler subscription of '`' to all States, and all other keyboard commands to ES_SEHLL
   EventHandler* evh = EventHandler::getInstance();
   evh->subscribe(this, ES_ALL, SDLK_BACKQUOTE);
@@ -77,5 +83,5 @@
   for (int i = 0; i < this->bufferDisplaySize; i++)
     delete this->bufferText[i];
-  delete this->bufferText;
+  delete[] this->bufferText;
 
   // delete the inputLine
@@ -93,6 +99,53 @@
   delete charIterator;
 
+//  if (this->completionList != NULL)
+    //delete this->completionList;
+
   Shell::singletonRef = NULL;
 }
+
+
+void Shell::activate()
+{
+  if (this->bActive == true)
+    PRINTF(3)("The shell is already active\n");
+  this->bActive = true;
+
+  EventHandler::getInstance()->setState(ES_SHELL);
+  this->setRelCoorSoft2D(0, 0, 1, 5);
+}
+
+void Shell::deactivate()
+{
+  if (this->bActive == false)
+    PRINTF(3)("The shell is already inactive\n");
+  this->bActive = false;
+
+  EventHandler::getInstance()->setState(ES_GAME);
+  this->setRelCoorSoft2D(0, -400, 1, 5);
+}
+
+void Shell::setTextSize(unsigned int textSize, unsigned int lineSpacing)
+{
+  this->textSize = textSize;
+  this->lineSpacing = lineSpacing;
+
+  this->rebuildText();
+}
+
+void Shell::rebuildText()
+{
+  if (this->inputLineText == NULL)
+    delete this->inputLineText;
+  this->inputLineText = TextEngine::getInstance()->createText("fonts/Aniron_Bold.ttf", this->textSize, TEXT_DYNAMIC, 255, 0, 0);
+  this->inputLineText->setAlignment(TEXT_ALIGN_LEFT);
+  this->inputLineText->setText(NULL);
+  this->inputLineText->setParent2D(this);
+  this->inputLineText->setRelCoor2D(5, (this->textSize + this->lineSpacing)*this->bufferDisplaySize);
+
+  this->setBufferDisplaySize(this->bufferDisplaySize);
+}
+
+
 
 /**
@@ -106,5 +159,5 @@
     for (unsigned int i = 0; i < this->bufferDisplaySize; i++)
       delete this->bufferText[i];
-    delete this->bufferText;
+    delete[] this->bufferText;
   }
 
@@ -112,13 +165,13 @@
   for (unsigned int i = 0; i < bufferDisplaySize; i++)
   {
-    this->bufferText[i] = TextEngine::getInstance()->createText("fonts/earth.ttf", this->textSize, TEXT_DYNAMIC, 255, 0, 0);
+    this->bufferText[i] = TextEngine::getInstance()->createText("fonts/Aniron_Bold.ttf", this->textSize, TEXT_DYNAMIC, 255, 0, 0);
     this->bufferText[i]->setAlignment(TEXT_ALIGN_LEFT);
-    this->bufferText[i]->setRelCoor2D(5, 12+12*i);
+    this->bufferText[i]->setRelCoor2D(5, (this->textSize + this->lineSpacing)*(bufferDisplaySize - i -1));
     this->bufferText[i]->setText(NULL);
     this->bufferText[i]->setParent2D(this);
   }
-
-
   this->bufferDisplaySize = bufferDisplaySize;
+
+  this->shellHeight = (this->textSize + this->lineSpacing) * (bufferDisplaySize+1);
 }
 
@@ -153,6 +206,4 @@
  * @param line the Line as in the first argument in printf
  * @param args the arguments as a va_list
- *
- * @todo optimize
  */
 bool Shell::addBufferLineStatic(const char* line, ...)
@@ -174,5 +225,4 @@
   return true;
 }
-int curr = 0;
 
 /**
@@ -199,16 +249,25 @@
    }
 
-   if (likely(bufferText != NULL))
+   if (this->bActive && likely(bufferText != NULL))
    {
-     Text* moveText = this->bufferText[this->bufferDisplaySize-1];
-     for (int i = this->bufferDisplaySize-1; i > 0; i--)
+     Text* lastText = this->bufferText[this->bufferDisplaySize-1];
+     Vector firstCoord = this->bufferText[0]->getRelCoorSoft2D();
+
+     Text* swapText;
+     Text* moveText = this->bufferText[0];
+     this->bufferText[0]->setRelCoorSoft2D(this->bufferText[1]->getRelCoorSoft2D(), 5);
+     for (unsigned int i = 1; i < this->bufferDisplaySize; i++)
      {
-       this->bufferText[i] = this->bufferText[i-1];
+       if ( i < this->bufferDisplaySize-1)
+         this->bufferText[i]->setRelCoorSoft2D(this->bufferText[i+1]->getRelCoorSoft2D(),5);
+       swapText = this->bufferText[i];
+       this->bufferText[i] = moveText;
+       moveText = swapText;
      }
-     this->bufferText[0] = moveText;
+     lastText->setRelCoor2D(firstCoord);
+     this->bufferText[0] = lastText;
+
+     this->bufferText[0]->setText(newLine);
    }
-   this->bufferText[0]->setText(newLine);
-   // this->bufferText->
-//  this->inputLineText->setText(newLine);
 }
 
@@ -246,5 +305,4 @@
 }
 
-
 /**
  * deletes the InputLine
@@ -258,5 +316,4 @@
   this->inputLine = new char[1];
   *this->inputLine = '\0';
-
 }
 
@@ -316,5 +373,4 @@
 bool Shell::executeCommand()
 {
-
   this->addBufferLineStatic("Execute Command: %s\n", this->inputLine);
   delete this->inputLine;
@@ -337,6 +393,4 @@
 }
 
-
-#include "key_names.h"
 /**
  * listens for some event
@@ -352,12 +406,10 @@
       if (EventHandler::getInstance()->getState() == ES_GAME)
       {
-        EventHandler::getInstance()->setState(ES_SHELL);
-        this->setRelCoorSoft2D(0, GraphicsEngine::getInstance()->getResolutionY()-150, 1, 5);
+        this->activate();
       }
 
       else
       {
-        EventHandler::getInstance()->setState(ES_GAME);
-        this->setRelCoorSoft2D(0, GraphicsEngine::getInstance()->getResolutionY()+10, 1, 5);
+        this->deactivate();
       }
     }
@@ -382,6 +434,8 @@
   {
     if (this->pressedKey == event.type)
+    {
       this->pressedKey = SDLK_FIRST;
-    this->delayed = 0.0;
+      this->delayed = 0.0;
+    }
   }
 }
@@ -426,11 +480,11 @@
 
 //  glTexCoord2f(this->texCoord.maxU, this->texCoord.minV);
-  glVertex2f(this->getAbsCoor2D().x + 800, this->getAbsCoor2D().y  );
+  glVertex2f(GraphicsEngine::getInstance()->getResolutionX() - this->getAbsCoor2D().x, this->getAbsCoor2D().y  );
 
 //  glTexCoord2f(this->texCoord.maxU, this->texCoord.maxV);
-  glVertex2f(this->getAbsCoor2D().x + 800, this->getAbsCoor2D().y + 150);
+  glVertex2f(GraphicsEngine::getInstance()->getResolutionX() - this->getAbsCoor2D().x, this->getAbsCoor2D().y + this->shellHeight);
 
 //  glTexCoord2f(this->texCoord.minU, this->texCoord.maxV);
-  glVertex2f(this->getAbsCoor2D().x, this->getAbsCoor2D().y + 150);
+  glVertex2f(this->getAbsCoor2D().x, this->getAbsCoor2D().y + this->shellHeight);
 
   glEnd();
@@ -451,5 +505,5 @@
   strcpy(completionLine, this->inputLine);
 
-   char* commandBegin = strrchr(completionLine, ' ');
+  char* commandBegin = strrchr(completionLine, ' ');
   if (commandBegin == NULL)
     commandBegin = completionLine;
@@ -462,27 +516,189 @@
   }
 
-  printf("%s\n",commandBegin);
-   Array<char*>* classArray = LoadClassDescription::searchClassWithShort(commandBegin);
-   if (classArray->getCount() == 0)
-   {
-     delete[] completionLine;
-     delete classArray;
-     //PRINTF(0)("no completion found for %s\n", commandBegin);
-     return false;
-   }
-
-   for (unsigned int i = 0; i < classArray->getCount(); i++)
-   {
-     PRINTF(0)("%s\n", classArray->getEntry(i));
-   }
-   if (classArray->getCount() == 1)
-   {
-     this->removeCharacters(strlen(commandBegin));
-     this->addCharacters(classArray->getEntry(0));
-     this->addCharacter(' ');
-   }
-
-   delete[] completionLine;
-   delete classArray;
+  char* objectStart;
+  if (objectStart = strstr(commandBegin, "::"))
+  {
+    char* classIdentity = new char[objectStart - commandBegin +1];
+    strncpy(classIdentity, commandBegin, objectStart - commandBegin);
+    classIdentity[objectStart - commandBegin] = '\0';
+    this->objectComplete(objectStart+2, ClassList::StringToID(classIdentity));
+    delete[] classIdentity;
+  }
+  else
+    this->classComplete(commandBegin);
+
+  delete[] completionLine;
+}
+
+/**
+ * autocompletes a className
+ * @param classBegin the Beginning of a String to autoComplete
+ * @return true on success, false otherwise
+ */
+bool Shell::classComplete(const char* classBegin)
+{
+  if (unlikely(classBegin == NULL))
+    return false;
+  const tList<const char>* clList = ClassList::getClassList();
+  if (clList != NULL)
+  {
+    const tList<const char>* classList = this->createCompleteList(clList, classBegin);
+    if (classList != NULL)
+      this->generalComplete(classList, classBegin, "%s::", "::");
+    else
+      return false;
+  }
+  else
+    return false;
+  return true;
+}
+
+/**
+ * autocompletes an ObjectName
+ * @param objectBegin the beginning string of a Object
+ * @param classID the ID of the Class to search for.
+ * @return true on success, false otherwise
+ */
+bool Shell::objectComplete(const char* objectBegin, long classID)
+{
+  printf("%s\n", objectBegin);
+
+  if (unlikely(objectBegin == NULL))
+    return false;
+  tList<BaseObject>* boList = ClassList::getList(classID);
+  if (boList != NULL)
+  {
+    printf("\n", boList->firstElement()->getName());
+    const tList<const char>* objectList = this->createCompleteList(boList, objectBegin);
+    if (objectList != NULL)
+      this->generalComplete(objectList, objectBegin, "%s");
+    else
+      return false;
+  }
+  else
+    return false;
+  return true;
+}
+
+bool Shell::functionComplete(const char* functionBegin)
+{
+}
+
+/**
+ * completes the inputline on grounds of an inputList
+ * @param stringList the List to parse through
+ * @param begin the String to search in the inputList, and to extend with it.
+ * @param displayAs how to display the found value to the user, printf-style, !!with only one %s!! ex.: "::%s::"
+ * @param addBack what should be added at the end of the completion
+ * @param addFront what should be added to the front of one finished completion
+ * @return true if ok, false otherwise
+ */
+bool Shell::generalComplete(const tList<const char>* stringList, const char* begin, const char* displayAs, const char* addBack, const char* addFront)
+{
+  if (stringList->getSize() == 0)
+    return false;
+
+  const char* addString = stringList->firstElement();
+  unsigned int addLength = 0;
+  unsigned int inputLenght = strlen(begin);
+
+  if (addString != NULL)
+    addLength = strlen(addString);
+  tIterator<const char>* charIterator = stringList->getIterator();
+  const char* charElem = charIterator->nextElement();
+  while (charElem != NULL)
+  {
+    PRINTF(0)(displayAs, charElem);
+    for (unsigned int i = inputLenght; i < addLength; i++)
+      if (addString[i] != charElem[i])
+    {
+      addLength = i;
+      break;
+    }
+    charElem = charIterator->nextElement();
+  }
+  delete charIterator;
+
+  if (addLength >= inputLenght)
+  {
+    char* adder = new char[addLength+1];
+    strncpy(adder, addString, addLength);
+    adder[addLength] = '\0';
+    this->removeCharacters(inputLenght);
+    this->addCharacters(adder);
+    if (addBack != NULL && stringList->getSize() == 1)
+      this->addCharacters("::");
+    delete[] adder;
+  }
+  return true;
+}
+
+
+
+/**
+ * searches for classes, which beginn with classNameBegin
+ * @param inputList the List to parse through
+ * @param classNameBegin the beginning string
+ * @return a NEW char-array with ClassNames. The LIST should be deleted afterwards,
+ * !! The strings MUST NOT be deleted !!
+ */
+const tList<const char>* Shell::createCompleteList(const tList<const char>* inputList, const char* classNameBegin)
+{
+  if (inputList == NULL || classNameBegin == NULL)
+    return NULL;
+  unsigned int searchLength = strlen(classNameBegin);
+  if (this->completionList != NULL)
+    delete this->completionList;
+  this->completionList = new tList<const char>;
+
+//  tList<const char>* classList = ClassList::getClassList();
+
+  tIterator<const char>* iterator = inputList->getIterator();
+  const char* enumString = iterator->nextElement();
+  while (enumString != NULL)
+  {
+    if (strlen(enumString)>searchLength+1 &&
+        !strncasecmp(enumString, classNameBegin, searchLength))
+    {
+      this->completionList->add(enumString);
+    }
+    enumString = iterator->nextElement();
+  }
+  delete iterator;
+
+  return this->completionList;
+}
+
+/**
+ * searches for classes, which beginn with classNameBegin
+ * @param inputList the List to parse through
+ * @param classNameBegin the beginning string
+ * @return a NEW char-array with ClassNames. The LIST should be deleted afterwards,
+ * !! The strings MUST NOT be deleted !!
+ */
+const tList<const char>* Shell::createCompleteList(const tList<BaseObject>* inputList, const char* classNameBegin)
+{
+  if (inputList == NULL || classNameBegin == NULL)
+    return NULL;
+  unsigned int searchLength = strlen(classNameBegin);
+  if (this->completionList != NULL)
+    delete this->completionList;
+  this->completionList = new tList<const char>;
+
+  tIterator<BaseObject>* iterator = inputList->getIterator();
+  BaseObject* enumBO = iterator->nextElement();
+  while (enumBO != NULL)
+  {
+    if (enumBO->getName() != NULL &&
+        strlen(enumBO->getName())>searchLength+1 &&
+        !strncasecmp(enumBO->getName(), classNameBegin, searchLength))
+    {
+      this->completionList->add(enumBO->getName());
+    }
+    enumBO = iterator->nextElement();
+  }
+  delete iterator;
+
+  return this->completionList;
 }
 
@@ -494,4 +710,3 @@
   if (this->pressedKey != SDLK_FIRST)
     printf("%s::%f %f\n", SDLKToKeyname(this->pressedKey), this->delayed, this->repeatDelay);
-
-}
+}
Index: trunk/src/util/shell.h
===================================================================
--- trunk/src/util/shell.h	(revision 5111)
+++ trunk/src/util/shell.h	(revision 5113)
@@ -36,9 +36,13 @@
 
 
-    void setBufferSize(unsigned int bufferSize) { this->bufferSize = bufferSize; };
+    void activate();
+    void deactivate();
 
-    void setBufferDisplaySize(unsigned int bufferDisplaySize);
+    void setTextSize(unsigned int textSize, unsigned int lineSpacing = 1);
+    void rebuildText();
 
     // BUFFER //
+    void setBufferSize(unsigned int bufferSize) { this->bufferSize = bufferSize; };
+    void setBufferDisplaySize(unsigned int bufferDisplaySize);
     void flushBuffers();
     static bool addBufferLineStatic(const char* line, ...);
@@ -67,4 +71,12 @@
   private:
     bool autoComplete();
+    bool classComplete(const char* classBegin);
+    bool objectComplete(const char* objectBegin, long classID);
+    bool functionComplete(const char* functionBegin);
+
+    bool generalComplete(const tList<const char>* stringList, const char* begin, const char* displayAs = "%s", const char* addBack = NULL, const char* addFront = NULL);
+
+    const tList<const char>* Shell::createCompleteList(const tList<const char>* inputList, const char* classNameBegin);
+    const tList<const char>* Shell::createCompleteList(const tList<BaseObject>* inputList, const char* classNameBegin);
 
 
@@ -88,6 +100,11 @@
     unsigned int           textSize;               //!< The size of the text.
     unsigned int           lineSpacing;            //!< The Spacing between lines.
+    unsigned int           shellHeight;            //!< The hight of the Shell in Pixels
+    bool                   bActive;                //!< if the shell is active;
 
     char                   bufferArray[10000];     //!< a BUFFER for fast writing
+
+    // completion
+    tList<const char>*    completionList;          //!< A list of completions, that are io.
 };
 
