Index: trunk/src/lib/shell/Makefile.am
===================================================================
--- trunk/src/lib/shell/Makefile.am	(revision 5166)
+++ trunk/src/lib/shell/Makefile.am	(revision 5170)
@@ -5,7 +5,9 @@
 
 libORXshell_a_SOURCES = shell.cc \
-		        shell_command.cc
+		        shell_command.cc \
+			shell_completion.cc
 
 
 noinst_HEADERS= shell.h \
-                shell_command.h
+                shell_command.h \
+		shell_completion.h
Index: trunk/src/lib/shell/Makefile.in
===================================================================
--- trunk/src/lib/shell/Makefile.in	(revision 5166)
+++ trunk/src/lib/shell/Makefile.in	(revision 5170)
@@ -54,5 +54,6 @@
 libORXshell_a_AR = $(AR) $(ARFLAGS)
 libORXshell_a_LIBADD =
-am_libORXshell_a_OBJECTS = shell.$(OBJEXT) shell_command.$(OBJEXT)
+am_libORXshell_a_OBJECTS = shell.$(OBJEXT) shell_command.$(OBJEXT) \
+	shell_completion.$(OBJEXT)
 libORXshell_a_OBJECTS = $(am_libORXshell_a_OBJECTS)
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
@@ -60,5 +61,6 @@
 am__depfiles_maybe = depfiles
 @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/shell.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/shell_command.Po
+@AMDEP_TRUE@	./$(DEPDIR)/shell_command.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/shell_completion.Po
 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
@@ -183,8 +185,10 @@
 noinst_LIBRARIES = libORXshell.a
 libORXshell_a_SOURCES = shell.cc \
-		        shell_command.cc
+		        shell_command.cc \
+			shell_completion.cc
 
 noinst_HEADERS = shell.h \
-                shell_command.h
+                shell_command.h \
+		shell_completion.h
 
 all: all-am
@@ -237,4 +241,5 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shell.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shell_command.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shell_completion.Po@am__quote@
 
 .cc.o:
Index: trunk/src/lib/shell/shell_command.cc
===================================================================
--- trunk/src/lib/shell/shell_command.cc	(revision 5166)
+++ trunk/src/lib/shell/shell_command.cc	(revision 5170)
@@ -27,4 +27,85 @@
 
 using namespace std;
+
+/**
+ * creates a new ShellCommandClass
+ * @param className the Name of the command-class to create
+ */
+ShellCommandClass::ShellCommandClass(const char* className)
+{
+  this->className = className;
+  this->classID = CL_NULL;
+  this->commandList = new tList<ShellCommandBase>;
+
+  ShellCommandClass::commandClassList->add(this);
+}
+
+/**
+ * destructs the shellCommandClass again
+ */
+ShellCommandClass::~ShellCommandClass()
+{
+  tIterator<ShellCommandBase>* iterator = this->commandList->getIterator();
+  ShellCommandBase* elem = iterator->firstElement();
+  while(elem != NULL)
+  {
+    delete elem;
+    elem = iterator->nextElement();
+  }
+  delete iterator;
+  delete this->commandList;
+}
+
+const ShellCommandClass* ShellCommandClass::isRegistered(const char* className)
+{
+  if (ShellCommandClass::commandClassList == NULL)
+    initCommandClassList();
+
+  tIterator<ShellCommandClass>* iterator = ShellCommandClass::commandClassList->getIterator();
+  ShellCommandClass* elem = iterator->firstElement();
+  while(elem != NULL)
+  {
+    if (!strcmp(className, elem->className))
+    {
+      delete iterator;
+      return elem;
+    }
+    elem = iterator->nextElement();
+  }
+  delete iterator;
+  return NULL;
+}
+
+ShellCommandClass* ShellCommandClass::getCommandClass(const char* className)
+{
+  if (ShellCommandClass::commandClassList == NULL)
+    initCommandClassList();
+
+  tIterator<ShellCommandClass>* iterator = ShellCommandClass::commandClassList->getIterator();
+  ShellCommandClass* elem = iterator->firstElement();
+  while(elem != NULL)
+  {
+    if (!strcmp(className, elem->className))
+    {
+      delete iterator;
+      return elem;
+    }
+    elem = iterator->nextElement();
+  }
+  delete iterator;
+  return new ShellCommandClass(className);
+}
+
+
+void ShellCommandClass::initCommandClassList()
+{
+  if (ShellCommandClass::commandClassList == NULL)
+  {
+    ShellCommandClass::commandClassList = new tList<ShellCommandClass>;
+    ShellCommand<ShellCommandBase>::registerCommand("debug", "ShellCommand", &ShellCommandBase::debugDyn);
+  }
+}
+
+tList<ShellCommandClass>* ShellCommandClass::commandClassList = NULL;
 
 /**
@@ -42,5 +123,5 @@
 
 //  this->classID = classID;
-  this->className = className; //ClassList::IDToString(classID);
+  ShellCommandClass::getCommandClass(className)->commandList->add(this); //ClassList::IDToString(classID);
 
   // handling parameters, and storing them:
@@ -85,7 +166,4 @@
     }
   }
-
-  // adding this ShellCommand to the list of known Commands
-  ShellCommandBase::commandList->add(this);
 }
 
@@ -104,16 +182,16 @@
 void ShellCommandBase::unregisterAllCommands()
 {
-  tIterator<ShellCommandBase>* iterator = ShellCommandBase::commandList->getIterator();
-  ShellCommandBase* elem = iterator->firstElement();
-  while(elem != NULL)
-  {
-    delete elem;
-
-    elem = iterator->nextElement();
-  }
-  delete iterator;
-
-  delete ShellCommandBase::commandList;
-  ShellCommandBase::commandList = NULL;
+//   tIterator<ShellCommandBase>* iterator = ShellCommandBase::commandList->getIterator();
+//   ShellCommandBase* elem = iterator->firstElement();
+//   while(elem != NULL)
+//   {
+//     delete elem;
+//
+//     elem = iterator->nextElement();
+//   }
+//   delete iterator;
+//
+//   delete ShellCommandBase::commandList;
+//   ShellCommandBase::commandList = NULL;
 }
 
@@ -130,5 +208,4 @@
 }
 
-tList<ShellCommandBase>* ShellCommandBase::commandList = NULL;
 
 
@@ -145,28 +222,30 @@
 bool ShellCommandBase::isRegistered(const char* commandName, const char* className, unsigned int paramCount, ...)
 {
-  va_list parameterList;
-  va_start(parameterList, paramCount);
-
-  if (ShellCommandBase::commandList == NULL)
-  {
-    ShellCommandBase::commandList = new tList<ShellCommandBase>;
-    ShellCommand<ShellCommandBase>::registerCommand("debug", "ShellCommand", &ShellCommandBase::debugDyn);
+  if (ShellCommandClass::commandClassList == NULL)
+  {
+    ShellCommandClass::initCommandClassList();
     return false;
   }
 
-  tIterator<ShellCommandBase>* iterator = ShellCommandBase::commandList->getIterator();
-  ShellCommandBase* elem = iterator->firstElement();
-  while(elem != NULL)
-  {
-    if (!strcmp(className, elem->className) && !strcmp(commandName, elem->getName()))
-    {
-      PRINTF(2)("Command already registered\n");
-      delete iterator;
-      return true;
-    }
-    elem = iterator->nextElement();
-  }
-  delete iterator;
-  return false;
+  const ShellCommandClass* checkClass = ShellCommandClass::isRegistered(className);
+  if (checkClass != NULL)
+  {
+    tIterator<ShellCommandBase>* iterator = checkClass->commandList->getIterator();
+    ShellCommandBase* elem = iterator->firstElement();
+    while(elem != NULL)
+   {
+     if (!strcmp(commandName, elem->getName()))
+     {
+       PRINTF(2)("Command already registered\n");
+       delete iterator;
+       return true;
+      }
+     elem = iterator->nextElement();
+   }
+   delete iterator;
+   return false;
+  }
+  else
+    return false;
 }
 
@@ -180,91 +259,91 @@
 bool ShellCommandBase::execute(const char* executionString)
 {
-  if (ShellCommandBase::commandList == NULL)
-    return false;
-
-  tIterator<ShellCommandBase>* iterator = ShellCommandBase::commandList->getIterator();
-  ShellCommandBase* elem = iterator->firstElement();
-  while(elem != NULL)
-  {
-    printf("%s::%s\n", elem->className, elem->getName());
-    if (!strncasecmp (executionString, elem->className, strlen(elem->className)) &&
-         (*(executionString+strlen(elem->className)) == ' ' ||
-          *(executionString+strlen(elem->className)) == ':' ))
-    {
-      const char* commandBegin = executionString + strlen(elem->className);
-
-      PRINTF(4)("Class %s matches\n", elem->className);
-      BaseObject* objectPointer = NULL;
-      if (ClassList::StringToID(elem->className) & CL_MASK_SINGLETON == CL_MASK_SINGLETON)
-      {
-        while(*commandBegin == ' ')
-          commandBegin++;
-        if (strncmp (commandBegin, elem->getName(), strlen(elem->getName())) ||
-            *(commandBegin + strlen(elem->getName())) != ' ' &&
-            *(commandBegin + strlen(elem->getName())) != '\0')
-        {
-          elem = iterator->nextElement();
-          continue;
-        }
-        PRINTF(4)("Command %s matches\n", elem->getName());
-        // getting singleton-reference
-        tList<BaseObject>* list =  ClassList::getList(elem->className);
-        if (list != NULL)
-          objectPointer = list->firstElement();
-      }
-      else
-      {
-        // checking for the Object
-        while(*commandBegin == ' ')
-          commandBegin++;
-        tList<BaseObject>* list = ClassList::getList(elem->className);
-        if (list == NULL)
-          break;
-        tIterator<BaseObject>* iterBO = list->getIterator();
-        BaseObject* enumBO = iterBO->firstElement();
-        while(enumBO != NULL)
-        {
-          if(!strncmp(commandBegin, enumBO->getName(), strlen(enumBO->getName())))
-          {
-            PRINTF(4)("Object %s matches\n", enumBO->getName());
-            objectPointer = enumBO;
-            break;
-          }
-          enumBO = iterBO->nextElement();
-        }
-        delete iterBO;
-
-        // break on no object Found. We cannot operate on Classes, but on Objects
-        if (objectPointer == NULL)
-          break;
-        commandBegin = commandBegin + strlen(objectPointer->getName());
-        while(*commandBegin == ' ')
-          commandBegin++;
-        // checking for the requested function.
-        if (strncmp (commandBegin, elem->getName(), strlen(elem->getName())))
-        {
-          elem = iterator->nextElement();
-          continue;
-        }
-        PRINTF(4)("Function '%s' found\n", commandBegin);
-      }
-      const char* paramBegin = strchr(commandBegin, ' ');
-      if (paramBegin == NULL)
-        paramBegin = commandBegin + strlen(elem->getName());
-      while (*paramBegin == ' ')
-        paramBegin++;
-
-      PRINTF(3)("Parameters to Pass: %s\n", paramBegin);
-      if (objectPointer != NULL && paramBegin != NULL)
-      {
-        elem->executeCommand(objectPointer, paramBegin);
-        delete iterator;
-        return true;
-      }
-    }
-    elem = iterator->nextElement();
-  }
-  delete iterator;
-  return true;
+//   if (ShellCommandBase::commandList == NULL)
+//     return false;
+//
+//   tIterator<ShellCommandBase>* iterator = ShellCommandBase::commandList->getIterator();
+//   ShellCommandBase* elem = iterator->firstElement();
+//   while(elem != NULL)
+//   {
+//     printf("%s::%s\n", elem->className, elem->getName());
+//     if (!strncasecmp (executionString, elem->className, strlen(elem->className)) &&
+//          (*(executionString+strlen(elem->className)) == ' ' ||
+//           *(executionString+strlen(elem->className)) == ':' ))
+//     {
+//       const char* commandBegin = executionString + strlen(elem->className);
+//
+//       PRINTF(4)("Class %s matches\n", elem->className);
+//       BaseObject* objectPointer = NULL;
+//       if (ClassList::StringToID(elem->className) & CL_MASK_SINGLETON == CL_MASK_SINGLETON)
+//       {
+//         while(*commandBegin == ' ')
+//           commandBegin++;
+//         if (strncmp (commandBegin, elem->getName(), strlen(elem->getName())) ||
+//             *(commandBegin + strlen(elem->getName())) != ' ' &&
+//             *(commandBegin + strlen(elem->getName())) != '\0')
+//         {
+//           elem = iterator->nextElement();
+//           continue;
+//         }
+//         PRINTF(4)("Command %s matches\n", elem->getName());
+//         // getting singleton-reference
+//         tList<BaseObject>* list =  ClassList::getList(elem->className);
+//         if (list != NULL)
+//           objectPointer = list->firstElement();
+//       }
+//       else
+//       {
+//         // checking for the Object
+//         while(*commandBegin == ' ')
+//           commandBegin++;
+//         tList<BaseObject>* list = ClassList::getList(elem->className);
+//         if (list == NULL)
+//           break;
+//         tIterator<BaseObject>* iterBO = list->getIterator();
+//         BaseObject* enumBO = iterBO->firstElement();
+//         while(enumBO != NULL)
+//         {
+//           if(!strncmp(commandBegin, enumBO->getName(), strlen(enumBO->getName())))
+//           {
+//             PRINTF(4)("Object %s matches\n", enumBO->getName());
+//             objectPointer = enumBO;
+//             break;
+//           }
+//           enumBO = iterBO->nextElement();
+//         }
+//         delete iterBO;
+//
+//         // break on no object Found. We cannot operate on Classes, but on Objects
+//         if (objectPointer == NULL)
+//           break;
+//         commandBegin = commandBegin + strlen(objectPointer->getName());
+//         while(*commandBegin == ' ')
+//           commandBegin++;
+//         // checking for the requested function.
+//         if (strncmp (commandBegin, elem->getName(), strlen(elem->getName())))
+//         {
+//           elem = iterator->nextElement();
+//           continue;
+//         }
+//         PRINTF(4)("Function '%s' found\n", commandBegin);
+//       }
+//       const char* paramBegin = strchr(commandBegin, ' ');
+//       if (paramBegin == NULL)
+//         paramBegin = commandBegin + strlen(elem->getName());
+//       while (*paramBegin == ' ')
+//         paramBegin++;
+//
+//       PRINTF(3)("Parameters to Pass: %s\n", paramBegin);
+//       if (objectPointer != NULL && paramBegin != NULL)
+//       {
+//         elem->executeCommand(objectPointer, paramBegin);
+//         delete iterator;
+//         return true;
+//       }
+//     }
+//     elem = iterator->nextElement();
+//   }
+//   delete iterator;
+//   return true;
 }
 
@@ -297,5 +376,5 @@
 void ShellCommandBase::debug()
 {
-  if (ShellCommandBase::commandList == NULL)
+  if (ShellCommandClass::commandClassList == NULL)
   {
     PRINT(0)("No Command registered so far\n");
@@ -303,18 +382,25 @@
   }
 
-  tIterator<ShellCommandBase>* iterator = ShellCommandBase::commandList->getIterator();
-  ShellCommandBase* elem = iterator->firstElement();
-  while(elem != NULL)
-  {
-    PRINT(0)("Class:'%s':command:'%s':params:%d: ", elem->className, elem->getName(), elem->paramCount);
-    for (unsigned int i = 0; i< elem->paramCount; i++)
-      printf("%s ", ShellCommandBase::paramToString(elem->parameters[i]));
-    if (elem->description != NULL)
-      printf("- %s", elem->description);
-    printf("\n");
-
-    elem = iterator->nextElement();
-  }
-  delete iterator;
+  tIterator<ShellCommandClass>* iteratorCL = ShellCommandClass::commandClassList->getIterator();
+  ShellCommandClass* elemCL = iteratorCL->firstElement();
+  while(elemCL != NULL)
+  {
+    tIterator<ShellCommandBase>* iterator = elemCL->commandList->getIterator();
+    const ShellCommandBase* elem = iterator->firstElement();
+    {
+      PRINT(0)("Class:'%s' registered: \n", elemCL->className);
+      PRINT(0)("  command:'%s':params:%d: ", elem->getName(), elem->paramCount);
+      for (unsigned int i = 0; i< elem->paramCount; i++)
+       printf("%s ", ShellCommandBase::paramToString(elem->parameters[i]));
+      if (elem->description != NULL)
+       printf("- %s", elem->description);
+      printf("\n");
+
+      elem = iterator->nextElement();
+    }
+    delete iterator;
+    elemCL = iteratorCL->nextElement();
+  }
+  delete iteratorCL;
 }
 
Index: trunk/src/lib/shell/shell_command.h
===================================================================
--- trunk/src/lib/shell/shell_command.h	(revision 5166)
+++ trunk/src/lib/shell/shell_command.h	(revision 5170)
@@ -35,7 +35,34 @@
 // BASE CLASS //
 ////////////////
+class ShellCommandBase;
+
+//! A class to hold all Classes that have (once) registered Commands.
+class ShellCommandClass : public BaseObject
+{
+  friend class ShellCommandBase;
+
+  public:
+    static const tList<ShellCommandClass>* getCommandClassList() { return ShellCommandClass::commandClassList; };
+    static ShellCommandClass* getCommandClass(const char* className);
+
+  private:
+    ShellCommandClass(const char* className);
+    ~ShellCommandClass();
+
+    static const ShellCommandClass* isRegistered(const char* className);
+    static void initCommandClassList();
+
+  private:
+  const char*                      className;
+  ClassID                          classID;
+  tList<ShellCommandBase>*         commandList;
+  static tList<ShellCommandClass>* commandClassList;                     //!< A list of Classes
+};
+
+
 //! a baseClass for all possible ShellCommands
 class ShellCommandBase : public BaseObject
 {
+  friend class ShellCommandClass;
   public:
     static bool execute (const char* executionString);
@@ -44,5 +71,4 @@
 
     /** @returns the CommandList of the Shell */
-    static const tList<ShellCommandBase>* getCommandList() { return ShellCommandBase::commandList; };
 
     static void unregisterAllCommands();
@@ -74,11 +100,7 @@
 
   private:
-//    long                             classID;             //!< The ID of the Class associated to this Command
-    const char*                      className;                            //!< The Name of the Class associated to this Command
+    ShellCommandClass*               shellClass;                           //!< A Pointer to the Shell-Class this Command belongs to.
 
     const char*                      description;                          //!< A description for this commnand. (initially NULL). Assigned with (create)->describe("blablabla");
-
-    // STATIC MEMBERS
-    static tList<ShellCommandBase>*  commandList;                          //!< A list of availiable commands.
 };
 
Index: trunk/src/lib/shell/shell_completion.cc
===================================================================
--- trunk/src/lib/shell/shell_completion.cc	(revision 5170)
+++ trunk/src/lib/shell/shell_completion.cc	(revision 5170)
@@ -0,0 +1,50 @@
+/*
+   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: ...
+   co-programmer: ...
+*/
+
+//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
+
+#include "shell_completion.h"
+
+using namespace std;
+
+
+/**
+ * standard constructor
+ * @todo this constructor is not jet implemented - do it
+*/
+ShellCompletion::ShellCompletion ()
+{
+// this->setClassID(CL_PROTO_ID, "ProtoClass");
+
+   /* If you make a new class, what is most probably the case when you write this file
+      don't forget to:
+       1. Add the new file new_class.cc to the ./src/Makefile.am
+       2. Add the class identifier to ./src/class_id.h eg. CL_NEW_CLASS
+
+      Advanced Topics:
+      - if you want to let your object be managed via the ObjectManager make sure to read
+        the object_manager.h header comments. You will use this most certanly only if you
+        make many objects of your class, like a weapon bullet.
+   */
+}
+
+
+/**
+ * standard deconstructor
+*/
+ShellCompletion::~ShellCompletion ()
+{
+  // delete what has to be deleted here
+}
Index: trunk/src/lib/shell/shell_completion.h
===================================================================
--- trunk/src/lib/shell/shell_completion.h	(revision 5170)
+++ trunk/src/lib/shell/shell_completion.h	(revision 5170)
@@ -0,0 +1,24 @@
+/*!
+ * @file shell_completion.h
+ * @brief The Shell Completion Tasks
+*/
+
+#ifndef _SHELL_COMPLETION_H
+#define _SHELL_COMPLETION_H
+
+// FORWARD DECLARATION
+
+
+//! A class for ...
+class ShellCompletion {
+
+ public:
+  ShellCompletion();
+  virtual ~ShellCompletion();
+
+
+ private:
+
+};
+
+#endif /* _SHELL_COMPLETION_H */
