Index: branches/cleanup/src/lib/math/curve.h
===================================================================
--- branches/cleanup/src/lib/math/curve.h	(revision 10586)
+++ branches/cleanup/src/lib/math/curve.h	(revision 10588)
@@ -72,5 +72,4 @@
 
   std::list<PathNode>   nodeList;        //!< A list of all the Nodes of a Curve.
-  std::list<PathNode>::iterator   nodeIterator;    //!< An iterator that should point to the current Node
   PathNode*             firstNode;       //!< First node of the curve.
   PathNode*             currentNode;     //!< The node we are working with (the Last node).
Index: branches/cleanup/src/util/Makefile.am
===================================================================
--- branches/cleanup/src/util/Makefile.am	(revision 10586)
+++ branches/cleanup/src/util/Makefile.am	(revision 10588)
@@ -24,5 +24,7 @@
 			animation/animation3d.cc \
 			animation/animation.cc \
-			animation/animation_player.cc
+			animation/animation_player.cc \
+			\
+			track/track.cc
 
 noinst_HEADERS =        \
@@ -45,3 +47,5 @@
 			animation/animation.h \
 			animation/animation_player.h \
-			animation/t_animation.h
+			animation/t_animation.h \
+			\
+			track/track.h
Index: branches/cleanup/src/util/track/track_manager.cc
===================================================================
--- branches/cleanup/src/util/track/track_manager.cc	(revision 10586)
+++ 	(revision )
@@ -1,1205 +1,0 @@
-/*
-   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: Benjamin Grauer
-   co-programmer: ...
-*/
-
-#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_TRACK_MANAGER
-
-#include "track_manager.h"
-
-#include "base_object.h"
-#include "util/loading/load_param.h"
-#include "p_node.h"
-#include "track_node.h"
-#include "text.h"
-#include "t_animation.h"
-
-#include <string.h>
-
-
-#include "parser/tinyxml/tinyxml.h"
-#include "substring.h"
-
-#include <stdarg.h>
-
-ObjectListDefinition(TrackElement);
-
-
-/**
- *  initializes a TrackElement (sets the default values)
-*/
-TrackElement::TrackElement()
-{
-  this->registerObject(this, TrackElement::_objectList);
-
-
-  this->isFresh = true;
-  this->isHotPoint = false;
-  this->isSavePoint = false;
-  this->isFork = false;
-  this->isJoined = false;
-  this->mainJoin = false;
-  this->ID = -1;
-  this->startingTime = 0;
-  this->duration = TMAN_DEFAULT_DURATION;
-  this->endTime = 1;
-  this->jumpTime = 0;
-  this->width = TMAN_DEFAULT_WIDTH;
-  this->nodeCount = 0;
-  this->curve = NULL;
-  this->childCount = 0;
-  this->children = NULL;
-
-  this->history = NULL;
-
-  this->subject = NULL;
-  this->condFunc = &TrackElement::random;
-}
-
-/**
-  *  destroys all alocated memory)
-    @todo eventually when deleting a TrackElement you would not like to delete all its preceding TrackElements
-*/
-TrackElement::~TrackElement()
-{
-  // deleting the Curve
-  delete this->curve;
-
-  // deleting all the Children of this TrackNode.
-  if ((!this->isJoined &&this->childCount > 0)
-      || (this->isJoined && this->mainJoin)) // only if this is the MainJoin.
-    {
-      tIterator<TrackElement>* iterator = this->children->getIterator();
-      TrackElement* enumElem = iterator->firstElement();
-      while (enumElem)
-        {
-          delete enumElem;
-          enumElem = iterator->nextElement();
-        }
-      delete iterator;
-      delete this->children;
-    }
-}
-
-/**
- * Searches through all the TrackElements for trackID.
- * @param trackID The ID to search for.
- * @returns The TrackElement if Found, NULL otherwise.
-*/
-TrackElement* TrackElement::findByID(unsigned int trackID)
-{
-  // return if Found.
-  if (this->ID == trackID)
-    return this;
-  // search all children
-  if (this->childCount > 0)
-    {
-      tIterator<TrackElement>* iterator = this->children->getIterator();
-      TrackElement* enumElem = iterator->firstElement();
-      TrackElement* tmpElem = NULL;
-      while (enumElem)
-        {
-          if ((tmpElem = enumElem->findByID(trackID)) != NULL)
-            return tmpElem;
-          enumElem = iterator->nextElement();
-        }
-      delete iterator;
-    }
-  // if not found
-  return NULL;
-}
-
-
-/**
- *  Searches through all the TrackElements for a trackName
- * @param trackName The name to search for.
- * @returns The TrackElement if Found, NULL otherwise.
-*/
-TrackElement* TrackElement::findByName(const std::string& trackName)
-{
-  // return if Found.
-//   if (this->getName() && !strcmp(this->getName(), trackName))
-//     return this;
-  // search all children
-  if (this->childCount > 0)
-    {
-      tIterator<TrackElement>* iterator = this->children->getIterator();
-      TrackElement* enumElem = iterator->firstElement();
-      TrackElement* tmpElem;
-      while (enumElem)
-        {
-          if ((tmpElem = enumElem->findByName(trackName)))
-            return tmpElem;
-          enumElem = iterator->nextElement();
-        }
-      delete iterator;
-    }
-  // if not found
-  return NULL;
-}
-
-/**
- *  checks if there are any BackLoops in the Track
- * @returns true if NO loop was found, false Otherwise
-   You actually have to act on false!!
-*/
-bool TrackElement::backLoopCheck() const
-{
-  tList<const TrackElement>* trackList = new tList<const TrackElement>;
-
-  this->backLoopCheckAtomic(trackList);
-
-  delete trackList;
-  // only returns if everything worked out
-  return true;
-}
-
-/**
- *  checks if there are any BackLoops in the Track.
- * @param trackList A list of stored tracks, to search in.
- * @returns true if NO loop was found, false Otherwise
-   You actually have to act on false!!
-*/
-bool TrackElement::backLoopCheckAtomic(tList<const TrackElement>* trackList) const
-{
-  if (trackList->inList(this))
-    return false;
-
-  trackList->add(this);
-
-  if (this->children)
-    {
-      tIterator<TrackElement>* iterator = this->children->getIterator();
-      TrackElement* enumElem = iterator->firstElement();
-      while (enumElem)
-        {
-          if (!enumElem->backLoopCheckAtomic(trackList))
-            return false;
-        }
-      delete iterator;
-    }
-  return true;
-}
-
-
-/**
- * @param childCount which child to return
- * @returns the n-the children (starting at 0).
-   Be aware, that when the trackElement has no Children, NULL will be returned
-*/
-TrackElement* TrackElement::getChild(unsigned int childCount) const
-{
-  // if the the trackElement has no children return NULL.
-  if (this->childCount == 0)
-    return NULL;
-  // we cannot return the childCount+m's Child, so we return the last.
-  if (childCount > this->childCount)
-    childCount = this->childCount;
-
-  tIterator<TrackElement>* iterator = this->children->getIterator();
-  TrackElement* enumElem = iterator->firstElement();
-  for (unsigned int i = 0; i < childCount; i++)
-    enumElem = iterator->nextElement();
-  delete iterator;
-  return enumElem;
-}
-
-/**
- *  prints out debug information about this TrackElement
-*/
-void TrackElement::debug() const
-{
-//   PRINT(0)("--== TrackElement:%i ==--", this->ID);
-//   if(this->getName())
-//     PRINT(0)("--++Name: %s++--", this->getName());
-//   if(this->isFresh)
-//     PRINT(0)("  -- has not jet eddited in any way --\n");
-//   PRINT(0)("\n   TimeTable: startingTime=%f; endTime=%f; duration=%f; jumpTime=%f\n", this->startingTime, this->endTime, this->duration, this->jumpTime);
-//   PRINT(0)("   consists of %d Points\n", this->nodeCount);
-//   if (this->childCount == 0)
-//     PRINT(0)("   has no child\n");
-//   else if (this->childCount == 1)
-//     PRINT(0)("   has 1 child: =%d=\n", this->getChild(0)->ID);
-//   else if (this->childCount > 1)
-//     {
-//       PRINT(0)("   has %d children: ", this->childCount);
-//       //TrackElement* enumElem = this->children->enumerate();
-//       tIterator<TrackElement>* iterator = this->children->getIterator();
-//       TrackElement* enumElem = iterator->firstElement();
-//       while (enumElem)
-//         {
-//           PRINT(0)("=%d= ", enumElem->ID);
-//           enumElem = iterator->nextElement();
-//         }
-//       delete iterator;
-//       PRINT(0)("\n");
-//     }
-//
-//   if(this->isHotPoint)
-//     PRINT(0)("   is a special Point:\n");
-//   if(this->isSavePoint)
-//     PRINT(0)("    is a SavePoint\n");
-//   if(this->isFork)
-//     {
-//       PRINT(0)("    is A Fork with with %d children.\n", this->childCount);
-//     }
-//   if(this->isJoined)
-//     PRINT(0)("   is Joined at the End\n");
-//
-//   if(!this->backLoopCheck()) /* this should not happen */
-//     PRINT(2)(" THERE IS A BACKLOOP TO THIS ELEMENT\n");
-}
-
-/**
- *  CONDITION that chooses the first child for the decision (static)
- * @param nothing Nothing in this function
- * @returns the chosen child
-*/
-int TrackElement::lowest(const void* nothing) const
-{
-  return 0;
-}
-
-/**
- *  CONDITION that chooses the last child for the decision (static)
- * @param nothing Nothing in this function
- * @returns the chosen child
-*/
-int TrackElement::highest(const void* nothing) const
-{
-  return this->childCount-1;
-}
-
-/**
- *  CONDITION that chooses a random child for the decision (static)
- * @param nothing Nothing in this function
- * @returns the chosen child
-*/
-int TrackElement::random(const void* nothing) const
-{
-  int i = (int)floor ((float)rand()/(float)RAND_MAX * (float)this->childCount);
-  if (i >= this->childCount)
-    return this->childCount-1;
-  else
-    return i;
-}
-
-/**
- *  CONDITION that chooses child 0, if the node(probably Player)
-   is left of its parent (z<0)) and 1/right otherwise.
- * @param node The node to act upon.
- * @returns the chosen child
-*/
-int TrackElement::leftRight(const void* node) const
-{
-  PNode* tmpNode = (PNode*)node;
-
-  if (tmpNode->getRelCoor().z < 0)
-    return 0;
-  else
-    return 1;
-}
-
-
-/**
- *  CONDITION that chooses the child, that has the nearest distance to the node (probably player).
- * @param node The node to act upon.
- * @returns the chosen child
-
-   This is rather dangerous, because one must carefully set the points on the curve.
-   The best Way is to set the nodes as wide away of each other as possible,
-   but take into consideration, that if the nodes are to far from a center node, the center will be chosen.
-   (play with this!!).
-*/
-int TrackElement::nearest(const void* node) const
-{
-  PNode* tmpNode = (PNode*)node;
-
-  Vector nodeRelCoord = tmpNode->getRelCoor();
-  float minDist = 100000000;
-  int childNumber = 0;
-  int i = 0;
-
-  //TrackElement* enumElem = this->children->enumerate();
-  tIterator<TrackElement>* iterator = this->children->getIterator();
-  TrackElement* enumElem = iterator->firstElement();
-  while (enumElem)
-    {
-      float dist = (nodeRelCoord - enumElem->curve->getNode(4)).len();
-      if (dist < minDist)
-        {
-          minDist = dist;
-          childNumber = i;
-        }
-      i++;
-      enumElem = iterator->nextElement();
-    }
-  delete iterator;
-
-  PRINTF(4)("PathDecision with nearest algorithm: %d\n", childNumber);
-  return childNumber;
-}
-
-
-////////////////////////
-///// TRACKMANAGER /////
-////////////////////////
-/**
- *  standard constructor
-
-*/
-TrackManager::TrackManager()
-{
-  TrackManager::singletonRef = this; // do this because otherwise the TrackNode cannot get The instance of the TrackManager
-
-  PRINTF(3)("Initializing the TrackManager\n");
-  // setting up the First TrackElement
-  this->firstTrackElem = new TrackElement();
-  this->firstTrackElem->ID = 1;
-  this->firstTrackElem->setName("root");
-
-  this->currentTrackElem = firstTrackElem;
-
-  this->curveType = CURVE_BEZIER;
-  this->localTime = 0;
-  this->maxTime = 0;
-  this->trackElemCount = 1;
-
-  this->trackNode = new TrackNode();
-  this->setBindSlave(this->trackNode);
-  // initializing the Text
-  this->trackText = new Text("fonts/final_frontier.ttf", 30);
-  this->trackText->setAlignment(E2D_ALIGN_SCREEN_CENTER);
-  // initializing the Animation for the Text.
-  this->textAnimation = new tAnimation<Text>(this->trackText, &Text::setBlending);
-  this->textAnimation->addKeyFrame(1.0, 3.0, ANIM_NEG_EXP);
-  this->textAnimation->addKeyFrame(0.0, .001);
-  this->textAnimation->setInfinity(ANIM_INF_CONSTANT);
-}
-
-
-/**
- *  loads a trackElement from a TiXmlElement
- * @param root the TiXmlElement to load the Data from
-*/
-void TrackManager::loadParams(const TiXmlElement* root)
-{
-//   double x, y, z, d;
-//
-//   LOAD_PARAM_START_CYCLE(root, element);
-//   {
-//
-//     LoadParam_CYCLE(element, "WorkOn", this, TrackManager, workOnS)
-//         .describe("Selects a TrackElement (by name) to work on");
-//
-//     LoadParam_CYCLE(element, "Point", this, TrackManager, addPoint)
-//         .describe("Adds a new Point to the currently selected TrackElement");
-//
-//     LoadParam_CYCLE(element, "Duration", this, TrackManager, setDuration)
-//         .describe("Sets the Duration of the currently selected TrackElement");
-//
-//     LoadParam_CYCLE(element, "HotPoint", this, TrackManager, addHotPoint)
-//         .describe("Sets a new Point that acts as a hot point. meaning, the curve will flow through this Point");
-//
-//     LoadParam_CYCLE(element, "SavePoint", this, TrackManager, setSavePointS)
-//         .describe("Sets the current selected Point to a Savepoint, meaning that the curve will be ended and a new one starts, and that one starts again from this point on");
-//
-//     LoadParam_CYCLE(element, "Fork", this, TrackManager, forkS)
-//         .describe("Forks the Path into multiple forked Path names seperated by ','");
-//
-//     LoadParam_CYCLE(element, "Join", this, TrackManager, joinS)
-//         .describe("Joins multiple joining Path names seperated by ','");
-
-      /*
-    if( !strcmp( element->Value(), "Fork"))
-    {
-    container = element->FirstChild();
-    if( container->ToText())
-        {
-        assert( container->Value() != NULL);
-        PRINTF(4)("Loaded Fork: %s\n", container->Value());
-        forkS(container->Value());
-        }
-        }
-      */
-      /*
-        if( !strcmp( element->Value(), "Join"))
-        {
-        container = element->FirstChild();
-        if( container->ToText())
-        {
-        assert( container->Value() != NULL);
-        PRINTF0("Loaded Join: %s\n", container->Value());
-        joinS(container->Value());
-        }
-        }
-      */
-
-//   }
-//   LOAD_PARAM_END_CYCLE(element);
-}
-
-/**
- *  standard destructor
-*/
-TrackManager::~TrackManager()
-{
-  PRINTF(3)("Destruct TrackManager\n");
-
-  PRINTF(4)("Deleting all the TrackElements\n");
-  delete this->firstTrackElem;
-
-  delete this->trackText;
-  // the tracknode should be deleted here, but is deleted by pNode: -> null_parent
-
-  // we do not have a TrackManager anymore
-  TrackManager::singletonRef = NULL;
-}
-
-//! Singleton Reference to TrackManager
-TrackManager* TrackManager::singletonRef = NULL;
-
-// INITIALIZE //
-/**
- *  reserves Space for childCount children
- * @param childCount The Count of children to make space for.
- * @param trackElem The TrackElement to appy this to. (if NULL chose this->currentTrackElement)
-*/
-void TrackManager::initChildren(unsigned int childCount, TrackElement* trackElem)
-{
-//   if (!trackElem)
-//     trackElem = this->currentTrackElem;
-//
-//   trackElem->childCount = childCount;
-//   trackElem->mainJoin = true;  // this tells join, that this one is the Main Join, if it tries to join multiple Tracks
-//   trackElem->children =  new tList<TrackElement>();
-//   for (int i = 0; i < childCount; i++)
-//     {
-//       // create a new Element
-//       TrackElement* newElem = new TrackElement();
-//       // setting up the new ID
-//       newElem->ID = ++trackElemCount;
-//       // setting up the Time
-//       newElem->startingTime = trackElem->endTime + trackElem->jumpTime;
-//       // adds the conection Point
-//       this->addPointV(trackElem->curve->getNode(trackElem->curve->getNodeCount()),
-//                      newElem);
-//       // add the new child to the childList.
-//       trackElem->children->add(newElem);
-//     }
-//
-//   // setting the Name of the new TrackElement to the name of the last one + _childI
-//
-//   if (trackElem->getName())
-//     {
-//       for (int i = 0; i < trackElem->childCount; i++)
-//       {
-//         char* childName = new char[strlen(trackElem->getName())+10];
-//         sprintf(childName, "%s_child%d", trackElem->getName(), i);
-//         trackElem->getChild(i)->setName(childName);
-//       }
-//     }
-//   // select the first Child to work on.
-//   this->currentTrackElem = trackElem->getChild(0);
-}
-
-
-/**
- *  Sets the trackID we are working on.
- * @param trackID the trackID we are working on
-*/
-void TrackManager::workOn(unsigned int trackID)
-{
-  TrackElement* tmpElem = this->firstTrackElem->findByID(trackID);
-  if (tmpElem)
-    this->currentTrackElem = tmpElem;
-  else
-    PRINTF(2)("TrackElement %d not Found, leaving unchanged\n", trackID);
-  PRINTF(4)("now Working on %d\n", this->currentTrackElem->ID);
-}
-
-/**
- *  Sets the TrackElement to work on
- * @param trackName the Name of the Track to work on
-*/
-void TrackManager::workOnS(const std::string& trackName)
-{
-  TrackElement* tmpElem = this->firstTrackElem->findByName(trackName);
-  if (tmpElem)
-    this->currentTrackElem = tmpElem;
-  else
-    PRINTF(2)("TrackElement %s not Found, leaving unchanged\n", trackName);
-  PRINTF(4)("now Working on %d\n", this->currentTrackElem->ID);
-}
-
-/**
- *  Sets the Type of the Curve
- * @param curveType The Type to set
- * @param trackElem the TrackElement that should get a new Curve.
-
- *  this will possibly get obsolete during the process.
-*/
-void TrackManager::setCurveType(CurveType curveType, TrackElement* trackElem)
-{
-  if (!trackElem->isFresh)
-    {
-      PRINTF(2)("It is not possible to change the type of a Curve after you have have appended some points to it\n");
-      return;
-    }
-  this->curveType = curveType;
-  switch (curveType)
-    {
-    case CURVE_BEZIER:
-      trackElem->curve = new BezierCurve();
-      break;
-    }
-}
-
-/**
- * @param duration the duration of the TrackElement
-   \see void TrackManager::setDuration(float duration, TrackElement* trackElem)
-*/
-void TrackManager::setDuration(float duration)
-{
-  this->setDuration(duration, NULL);
-}
-
-/**
- *  Sets the duration of the current path in seconds.
- * @param duration The duration in seconds.
- * @param trackElem The TrackElement to apply this to.
-*/
-void TrackManager::setDuration(float duration, TrackElement* trackElem)
-{
-  if (!trackElem)
-    trackElem = this->currentTrackElem;
-
-  trackElem->duration = duration;
-  trackElem->endTime = trackElem->startingTime + duration;
-}
-
-/**
- *  adds a point to trackElem
- * @param x x coord
- * @param y y coord
- * @param z z coord
- * @param trackElem The TrackElement to add the Point to
-*/
-void TrackManager::addPoint(float x, float y, float z)
-{
-  this->addPointV(Vector(x,y,z));
-}
-
-/**
- *  adds a point to trackElem
- * @param newPoint The point to add.
- * @param trackElem The TrackElement to add the Point to
-*/
-void TrackManager::addPointV(Vector newPoint, TrackElement* trackElem)
-{
-  if (!trackElem)
-    trackElem = this->currentTrackElem;
-
-  if (trackElem->isFresh)
-    {
-      this->setCurveType(TMAN_DEFAULT_CURVETYPE, trackElem);
-      trackElem->isFresh = false;
-    }
-  trackElem->curve->addNode(newPoint);
-  trackElem->nodeCount++;
-}
-
-/**
- *  adds a new Hot Point
- * @param x: the x coordinate of the hotpoint
- * @param y: the y coordinate of the hotpoint
- * @param z: the z coordinate of the hotpoint
-   \see int TrackManager::addHotPointV(Vector newPoint, TrackElement* trackElem)
-*/
-void TrackManager::addHotPoint(float x, float y, float z)
-{
-  this->addHotPointV(Vector(x, y, z));
-}
-
-/**
- *  adds save/splitpoint.
- * @param newPoint The point to add.
- * @param trackElem if supplied it will add a hotpoint on this TrackElement
- * @returns A Pointer to a newly appended Curve
-*/
-int TrackManager::addHotPointV(Vector newPoint, TrackElement* trackElem)
-{
-  if (!trackElem)
-    trackElem = this->currentTrackElem;
-
-  PRINTF(4)("setting up a HotPoint\n");
-  if (trackElem->isFresh)
-    {
-      trackElem->isFresh = false;
-    }
-
-  // @todo HotPoint Handling.
-  trackElem->curve->addNode(newPoint);
-  trackElem->nodeCount++;
-  this->initChildren(1, trackElem);
-}
-
-/**
-   @todo this must be better
-*/
-void TrackManager::setSavePointS(const std::string& nextElementName)
-{
-//   this->setSavePoint(NULL);
-//   if (strcmp(nextElementName, ""))
-//     this->firstTrackElem->findByID(this->trackElemCount)->setName(nextElementName);
-}
-
-/**
- *  Sets the last HotPoint into a savePoint.
- * @param trackElem The TrackElement to appy this to. (if NULL chose this->currentTrackElement)
- * @returns A Pointer to a newly appended Curve
-
-   If no HotPoint was defined the last added Point will be rendered into a savePoint. \n
-   If the HotPoint was defined as a fork the Point will \b not be set into a savePoint.
-*/
-void TrackManager::setSavePoint(TrackElement* trackElem)
-{
-  if (!trackElem)
-    trackElem = this->currentTrackElem;
-
-  PRINTF(4)("setting up a SavePoint.\n");
-  if (trackElem->isFork || trackElem->isSavePoint)
-    {
-      PRINTF(2)("%d is already finished \n", trackElem->ID);
-      return;
-    }
-  trackElem->isSavePoint = true;
-  trackElem->isHotPoint = true;
-
-  this->initChildren(1, trackElem);
-}
-
-/**
- *  adds some interessting non-linear movments through the level.
- * @param count The Count of children the fork will produce
-
-   If no HotPoint was defined the last added Point will be rendered into a fork. \n
-   If the HotPoint was defined as a savePoint the Point will \b not be set into a fork.
-*/
-void TrackManager::fork(unsigned int count, ...)
-{
-  int* trackIDs = new int[count];
-  this->forkV(count, trackIDs, NULL);
-  va_list ID;
-  va_start (ID, count);
-  for(int i = 0; i < count; i++)
-    {
-      *va_arg (ID, int*) = trackIDs[i];
-    }
-  va_end(ID);
-  delete []trackIDs;
-}
-
-/**
- * @param count how many children to produce
- * @param ... the information on the children (these are the Stings of their names
-   \see TrackManager::fork(unsigned int count, ...)
-
-   does the same as fork, but has an array of strings as an input.
-*/
-void TrackManager::forkS(unsigned int count, ...)
-{
-  int* trackIDs = new int[count];
-  this->forkV(count, trackIDs, NULL);
-  va_list name;
-  va_start (name, count);
-  for(int i = 0; i < count; i++)
-    {
-      this->firstTrackElem->findByID(trackIDs[i])->setName(va_arg(name, const std::string&));
-    }
-  va_end(name);
-  delete []trackIDs;
-}
-
-/**
-   \see TrackManager::fork(unsigned int count, ...)
-*/
-void TrackManager::forkS(const std::string& forkString)
-{
-//   SubString strings(forkString, ',');
-//
-//   int* trackIDs = new int[strings.getCount()];
-//   this->forkV(strings.getCount(), trackIDs, NULL);
-//
-//   for(int i = 0; i < strings.getCount(); i++)
-//     {
-//       this->firstTrackElem->findByID(trackIDs[i])->setName(strings.getString(i));
-//     }
-//   delete []trackIDs;
-}
-
-/**
- *  adds some interessting non-linear movments through the level.
- * @param count The Count of childrens the current HotPoint will have.
- * @param trackIDs A Pointer to an Array of ints which will hold the trackID's (the user will have to reserve space for this).
- * @param trackNames the names for the tracks as a char-arrey-array
- * @param trackElem The TrackElement to appy this to. (if NULL choose this->currentTrackElement)
-   \see TrackManager::fork(unsigned int count, ...)
-*/
-void TrackManager::forkV(unsigned int count, int* trackIDs, char** trackNames, TrackElement* trackElem)
-{
-  if (!trackElem)
-    trackElem = this->currentTrackElem;
-
-  PRINTF(4)("Forking with %d children\n", count);
-  if (trackElem->isSavePoint)
-    return;
-  trackElem->isFork = true;
-  trackElem->isHotPoint = true;
-  for(int i = 0; i < count; i++)
-    trackIDs[i]=this->trackElemCount+1+i;
-  this->initChildren(count, trackElem);
-}
-
-/**
- *  decides under what condition a certain Path will be chosen.
- * @param trackID the trackID to apply this to.
- * @param cond the CONDITION of the decision
- * @param subject the Subject that will be decided upon with CONDITION cond.
-*/
-void TrackManager::condition(unsigned int trackID, CONDITION cond, void* subject)
-{
-  this->condition(cond, subject, this->firstTrackElem->findByID(trackID));
-}
-
-/**
- *  decides under what condition a certain Path will be chosen.
- * @param cond the CONDITION of the decision
- * @param subject the Subject that will be decided upon with CONDITION cond.
- * @param trackElem The TrackElement to appy this to. (if NULL chose this->currentTrackElement)
-*/
-void TrackManager::condition(CONDITION cond, void* subject, TrackElement* trackElem)
-{
-  if (!trackElem)
-    trackElem = this->currentTrackElem;
-
-  if (!trackElem->isFork)
-    {
-      PRINTF(2)("%d is not a Fork, and no condition can be set in this case\n", trackElem->ID);
-      return;
-    }
-  else
-    {
-      switch (cond)
-        {
-        case LOWEST:
-          trackElem->condFunc = &TrackElement::lowest;
-          break;
-        case HIGHEST:
-          trackElem->condFunc = &TrackElement::highest;
-          break;
-        case RANDOM:
-          trackElem->condFunc = &TrackElement::random;
-          break;
-        case LEFTRIGHT:
-          trackElem->condFunc = &TrackElement::leftRight;
-          break;
-        case NEAREST:
-          trackElem->condFunc = &TrackElement::nearest;
-          break;
-        case ENEMYKILLED:
-          break;
-        }
-      trackElem->subject=subject;
-    }
-}
-
-/**
- *  joins some tracks together again.
- * @param count The count of Paths to join.
-
-   Join will set the localTime to the longest time a Path has to get to this Point. \n
-   Join will join all curves to the first curve, meaning that all the tangents will be matched.
-*/
-void TrackManager::join(unsigned int count, ...)
-{
-  int* trackIDs = new int [count];
-  va_list ID;
-  va_start (ID, count);
-  for(int i = 0; i < count; i++)
-    {
-      trackIDs[i] = va_arg (ID, int);
-    }
-  va_end(ID);
-  this->joinV(count, trackIDs);
-  delete []trackIDs;
-}
-
-/**
- *  Joins some Tracks together again.
- * @param count The count of trackElements to join
-   \see void TrackManager::join(unsigned int count, ...)
-
-   The difference to void TrackManager::join(unsigned int count, ...) is, that this function takes
-   the Names of the TrackElements as inputs and not their ID
-*/
-void TrackManager::joinS(unsigned int count, ...)
-{
-  int* trackIDs = new int [count];
-  va_list NAME;
-  va_start (NAME, count);
-  for(int i = 0; i < count; i++)
-    {
-      const std::string& name = va_arg (NAME, char*);
-      TrackElement* tmpElem = this->firstTrackElem->findByName(name);
-      if (tmpElem)
-        trackIDs[i] = tmpElem->ID;
-      else
-        PRINTF(1)("Trying to join a Track, of which the name does not exist: %s\n", name);
-    }
-  va_end(NAME);
-  this->joinV(count, trackIDs);
-  delete []trackIDs;
-}
-
-/**
-   \see void TrackManager::join(unsigned int count, ...)
-*/
-void TrackManager::joinS(const std::string& joinString)
-{
-//   SubString strings(joinString, ',');
-//
-//   int* trackIDs = new int[strings.getCount()];
-//   this->joinV(strings.getCount(), trackIDs);
-//
-//   for(unsigned int i = 0; i < strings.getCount(); i++)
-//     {
-//       TrackElement* tmpElem = this->firstTrackElem->findByName(strings.getString(i).c_str());
-//       if (tmpElem != NULL)
-//         trackIDs[i] = tmpElem->ID;
-//       else
-//       {
-//         PRINTF(1)("Trying to join a Track, of which the name does not exist: %s\n", strings.getString(i).c_str());
-//         trackIDs[i] = -1;
-//       }
-//     }
-//   this->joinV(strings.getCount(), trackIDs);
-//   delete []trackIDs;
-}
-
-/**
- *  joins some tracks together again.
- * @param count The count of Paths to join.
- * @param trackIDs an Array with the trackID's to join
- *
- * @see void TrackManager::join(unsigned int count, ...)
-*/
-void TrackManager::joinV(unsigned int count, int* trackIDs)
-{
-  TrackElement* tmpTrackElem;
-  TrackElement* tmpJoinElem;
-  for (unsigned int i = 0; i < count; i++)
-    if (!this->firstTrackElem->findByID(trackIDs[i]))
-      {
-        PRINTF(1)("Trying to Connect Paths that do not exist yet: %d\n Not Joining Anything\n", trackIDs[i]);
-        return;
-      }
-
-
-  PRINTF(3)("Joining %d tracks and merging to Track %d\n", count, trackIDs[0]);
-
-  // checking if there is a back-loop-connection and ERROR if it is.
-  tmpTrackElem = this->firstTrackElem->findByID(trackIDs[0]);
-  if (!tmpTrackElem->backLoopCheck())
-    {
-      PRINTF(2)("Backloop connection detected at joining trackElements\n -> TRACK WILL NOT BE JOINED\n");
-      return;
-    }
-
-  TrackElement* firstJoint =   this->firstTrackElem->findByID(trackIDs[0]);
-  float tmpLatestTime = firstJoint->endTime;
-
-  Vector tmpEndPoint = firstJoint->curve->getNode(firstJoint->curve->getNodeCount());
-  Vector tmpTangentPoint = firstJoint->curve->getNode(firstJoint->curve->getNodeCount()-1);
-  Vector tmpc2Point = firstJoint->curve->getNode(firstJoint->curve->getNodeCount()-2);
-  firstJoint->isJoined = true;
-  //  firstJoint->mainJoin = true;
-  if(!firstJoint->isHotPoint)
-    this->setSavePoint(firstJoint);
-  // Timing:
-  for (unsigned int i = 0; i < count; i++)
-    {
-      if(tmpJoinElem = this->firstTrackElem->findByID(trackIDs[i]))
-        {
-          if (tmpJoinElem->childCount == 0
-              && tmpJoinElem->endTime > tmpLatestTime)
-            tmpLatestTime = tmpJoinElem->endTime;
-        }
-    }
-  // time the main Join.
-  firstJoint->jumpTime = tmpLatestTime - firstJoint->endTime;
-
-  // Joining:
-  for (int i = 1; i < count; i++)
-    {
-      if( tmpJoinElem = this->firstTrackElem->findByID(trackIDs[i]))
-        {
-          if (tmpJoinElem->childCount > 0)
-            printf("!!This Curve has children, and as such will not be joined!!\n You can try joining other childless TrackElements to this one!");
-          else
-            {
-              this->addPointV(tmpc2Point, tmpJoinElem);
-              this->addPointV(tmpTangentPoint, tmpJoinElem);
-              this->addPointV(tmpEndPoint, tmpJoinElem);
-              // time all other Joins
-              tmpJoinElem->jumpTime = tmpLatestTime - tmpJoinElem->endTime;
-
-              //Copying Joint-Info
-              tmpJoinElem->children = firstJoint->children;
-              tmpJoinElem->childCount = firstJoint->childCount;
-              tmpJoinElem->isSavePoint = firstJoint->isSavePoint;
-              tmpJoinElem->isFork = firstJoint->isFork;
-
-              tmpJoinElem->isJoined = true;
-            }
-        }
-    }
-  if(firstJoint->children)
-    {
-      //TrackElement* enumElem = firstJoint->children->enumerate();
-      tIterator<TrackElement>* iterator = firstJoint->children->getIterator();
-      TrackElement* enumElem = iterator->firstElement();
-      while (enumElem)
-        {
-          PRINTF(5)("Setting startingTime of %d to %f.\n", enumElem->ID, tmpLatestTime);
-          enumElem->startingTime = tmpLatestTime;
-          enumElem->endTime = tmpLatestTime + enumElem->duration;
-
-          enumElem = iterator->nextElement();
-        }
-      delete iterator;
-    }
-}
-
-/**
- *  finalizes the TrackSystem. after this it will not be editable anymore
-
-   @todo check for any inconsistencies, output errors
-*/
-void TrackManager::finalize()
-{
-  for (int i = 1; i<= trackElemCount ;i++)
-    {
-      TrackElement* tmpElem = this->firstTrackElem->findByID(i);
-      if( tmpElem->childCount > 0 && tmpElem->mainJoin)
-        {
-          tIterator<TrackElement>* iterator = tmpElem->children->getIterator();
-          TrackElement* enumElem = iterator->firstElement();
-          //TrackElement* enumElem = tmpElem->children->enumerate();
-          while (enumElem)
-            {
-
-              // c1-continuity
-              enumElem->curve->addNode(enumElem->curve->getNode(0) +
-                                                   ((enumElem->curve->getNode(0) -
-                                                    tmpElem->curve->getNode(tmpElem->curve->getNodeCount()-1))
-                                                    ),2);
-              enumElem->nodeCount++;
-              // c2-continuity
-              enumElem->curve->addNode((tmpElem->curve->getNode(tmpElem->curve->getNodeCount())-
-                                                    tmpElem->curve->getNode(tmpElem->curve->getNodeCount()-1)) * 4 +
-                                                   tmpElem->curve->getNode(tmpElem->curve->getNodeCount()-2), 3);
-              enumElem->nodeCount++;
-              PRINTF(5)("accelerations: %d-in: count: %d, %f, %f, %f\n                  %d-out: count: %d %f, %f, %f\n",
-                     tmpElem->ID, tmpElem->nodeCount,
-                     tmpElem->curve->calcAcc(0.999).x, tmpElem->curve->calcAcc(0.999).y, tmpElem->curve->calcAcc(0.999).z,
-                     enumElem->ID, enumElem->nodeCount,
-                     enumElem->curve->calcAcc(0).x, enumElem->curve->calcAcc(0).y, enumElem->curve->calcAcc(0).z);
-
-              enumElem = iterator->nextElement();
-            }
-          delete iterator;
-        }
-    }
-  for (int i = 1; i <= trackElemCount;i++)
-    if (this->firstTrackElem->findByID(i)->endTime > this->maxTime)
-      this->maxTime = this->firstTrackElem->findByID(i)->endTime; // very bad implemented :/
-}
-
-
-// RUNTIME //
-
-/**
- *  calculates the Position for the localTime of the Track.
- * @returns the calculated Position
-*/
-Vector TrackManager::calcPos() const
-{
-  return this->currentTrackElem->curve->calcPos((this->localTime-this->currentTrackElem->startingTime)/this->currentTrackElem->duration);
-}
-
-/**
- *  calculates the Rotation for the localTime of the Track.
- * @returns the calculated Rotation
-*/
-Vector TrackManager::calcDir() const
-{
-  return this->currentTrackElem->curve->calcDir((this->localTime - this->currentTrackElem->startingTime)/this->currentTrackElem->duration);
-}
-
-/**
- * @returns the current Width of the track
-*/
-float TrackManager::getWidth() const
-{
-  return this->currentTrackElem->width;
-}
-
-/**
- *  Advances the local-time of the Track around dt
- * @param dt The time about which to advance.
-
-   This function also checks, if the TrackElement has to be changed.
-*/
-void TrackManager::tick(float dt)
-{
-//   PRINTF(4)("CurrentTrackID: %d, LocalTime is: %f, timestep is: %f\n", this->currentTrackElem->ID, this->localTime, dt);
-//   if (this->localTime <= this->firstTrackElem->duration)
-//     this->jumpTo(this->localTime);
-//   if (this->localTime <= this->maxTime)
-//     this->localTime += dt;
-//   if (this->localTime > this->currentTrackElem->endTime
-//       && this->currentTrackElem->children)
-//     {
-//       if (this->currentTrackElem->jumpTime != 0.0)
-//         this->jumpTo(this->localTime + this->currentTrackElem->jumpTime);
-//       // jump to the next TrackElement and also set the history of the new Element to the old one.
-//       TrackElement* tmpHistoryElem = this->currentTrackElem;
-//       this->currentTrackElem = this->currentTrackElem->getChild(this->choosePath(this->currentTrackElem));
-//       this->currentTrackElem->history = tmpHistoryElem;
-//       if (this->currentTrackElem->getName())
-//         {
-//           this->trackText->setText(this->currentTrackElem->getName());
-//           this->textAnimation->replay();
-//         }
-//     }
-//   if (this->bindSlave)
-//     {
-//       Vector tmp = this->calcPos();
-//       Quaternion quat = Quaternion(this->calcDir(), Vector(this->currentTrackElem->curve->calcAcc((localTime-this->currentTrackElem->startingTime)/this->currentTrackElem->duration).x,1,this->currentTrackElem->curve->calcAcc((localTime-this->currentTrackElem->startingTime)/this->currentTrackElem->duration).z));
-//
-//       Vector v(0.0, 1.0, 0.0);
-//       Quaternion q(-PI/2, v);
-//       quat = quat * q;
-//
-//       this->bindSlave->setAbsCoor(tmp);
-//       this->bindSlave->setAbsDir(quat);
-//     }
-}
-
-/**
- *  Jumps to a certain point on the Track.
- * @param time The time on the Track to jump to.
-
-   This should be used to Jump backwards on a Track, because moving forward means to change between the Path. (it then tries to choose the default.)
-   Max is trackLengthMax.
-*/
-void TrackManager::jumpTo(float time)
-{
-//   if (time == 0)
-//     {
-//       this->currentTrackElem = this->firstTrackElem;
-//       if (this->currentTrackElem->getName())
-//         {
-//           this->trackText->setText(this->currentTrackElem->getName());
-//           this->textAnimation->play();
-//         }
-//     }
-//   this->localTime = time;
-}
-
-/**
- *  a Function that decides which Path we should follow.
- * @param trackElem The Path to choose.
-
-*/
-int TrackManager::choosePath(TrackElement* trackElem)
-{
-  return (trackElem->*(trackElem->condFunc))(trackElem->subject);
-}
-
-/**
- *  Sets the PNode, that should be moved along the Tack
- * @param bindSlave the PNode to set
-*/
-void TrackManager::setBindSlave(PNode* bindSlave)
-{
-  this->bindSlave = bindSlave;
-}
-
-/**
- * @returns the main TrackNode
-*/
-PNode* TrackManager::getTrackNode()
-{
-  return this->trackNode;
-}
-
-// DEBUG //
-
-/**
- *  Imports a model of the Graph into the OpenGL-environment.
- * @param dt The Iterator used in seconds for Painting the Graph.
-
-   This is for testing facility only. Do this if you want to see the Path inside the Level.
-   eventually this will all be packed into a gl-list.
-*/
-void TrackManager::drawGraph(float dt) const
-{
-  for (int i = 1; i <= trackElemCount; i++)
-    {
-      glBegin(GL_LINE_STRIP);
-      TrackElement* tmpElem = this->firstTrackElem->findByID(i);
-      if (tmpElem->curve)
-        for(float f = 0.0; f < 1.0; f+=dt)
-          {
-            //      printf("%f, %f, %f\n",trackManager->calcPos().x, trackManager->calcPos().y, trackManager->calcPos().z);
-            Vector tmpVector = tmpElem->curve->calcPos(f);
-            glVertex3f(tmpVector.x, tmpVector.y, tmpVector.z);
-          }
-      glEnd();
-    }
-}
-
-/**
- *  outputs debug information about the trackManager
- * @param level how much debug
-*/
-void TrackManager::debug(unsigned int level) const
-{
-  PRINT(0)("=========================================\n");
-  PRINT(0)("= CLASS TRACKMANAGER::debug information =\n");
-  PRINT(0)("=========================================\n");
-  //  PRINT(0)("Status is: %
-  PRINT(0)(" Consists of %d elements\n", this->trackElemCount);
-  PRINT(0)(" localTime is: %f\n", this->localTime);
-  if (level >= 2)
-    {
-      for (int i = 1; i <= trackElemCount; i++)
-        {
-          TrackElement* tmpElem = this->firstTrackElem->findByID(i);
-          tmpElem->debug();
-        }
-    }
-  PRINT(0)("-----------------------------------------\n");
-}
Index: branches/cleanup/src/util/track/track_manager.h
===================================================================
--- branches/cleanup/src/util/track/track_manager.h	(revision 10586)
+++ 	(revision )
@@ -1,207 +1,0 @@
-/*!
- * @file track_manager.h
- *  manages all tracks defined in the world and the path the player takes
- *
- * it is a container for all tracks and all track-nodes. it manages the movement of
- * the track helper-parent (that drives the player). it is responsable for calculating
- * smooth curves etc.
-*/
-
-
-#ifndef _TRACK_MANAGER_H
-#define _TRACK_MANAGER_H
-
-#include "curve.h"
-#include "base_object.h"
-
-#ifndef NULL
-#define NULL   0  //!< NULL
-#endif
-
-// Forward Definition
-class PNode;
-class Text;
-class TiXmlElement;
-template<class T> class tAnimation;
-
-// Static Definitions
-
-//! The default Curve-Type to set for the whole path (if not chosen otherwise).
-#define     TMAN_DEFAULT_CURVETYPE    CURVE_BEZIER
-//! A default value for the duration for each TrackElement
-#define     TMAN_DEFAULT_DURATION     10
-//! A default width for the width of a TrackElement
-#define     TMAN_DEFAULT_WIDTH        10
-
-//! A Graph-Element, that holds the curve-structure of a Level.
-/**
-   A TrackElement is used, to define the structure of the Track itself.
-   It is a graph and not a tree, because paths can fork and join again.
-*/
-class TrackElement : public BaseObject
-{
-  ObjectListDeclaration(TrackElement);
-
- public:
-  TrackElement();
-  virtual ~TrackElement();
-
-  TrackElement* findByID(unsigned int trackID);
-  TrackElement* findByName(const std::string& trackName);
-  bool backLoopCheck() const;
-
-  TrackElement* getChild(unsigned int childNumber) const;
-
- private:
-  bool backLoopCheckAtomic(tList<const TrackElement>* trackList) const;
-
- public:
-  // atributes
-  bool                  isFresh;              //!< If no Points where added until now
-  bool                  isHotPoint;           //!< If the first node is a specialPoint;
-  bool                  isSavePoint;          //!< If the first node is a savePoint
-  bool                  isFork;               //!< If the first node is a Fork
-  bool                  isJoined;             //!< If the End of the Curve is joined.
-  bool                  mainJoin;             //!< If the End of the Curve is joined, and this is the one Curve the others join to.
-  int                   ID;                   //!< The ID of this TrackElement
-  float                 startingTime;         //!< The time at which this Track begins.
-  float                 duration;             //!< The time used to cross this TrackElement (curve).
-  float                 endTime;              //!< The time at which this Track ends.
-  float                 jumpTime;             //!< The Time this Track has to jump to its preceding Track (only >0 if Track isJoined==true)
-  float                 width;                //!< Th width of the Path. This tells the Player(s), how far he(they) can go to the left/right.
-  int                   nodeCount;            //!< The count of points this TrackElement has.
-  Curve*                curve;                //!< The Curve of this TrackElement
-  int                   childCount;           //!< The number of Children This TrackElement has.
-  tList<TrackElement>*  children;             //!< A TrackElement can have a Tree of following TrackElements.
-
-
-  // runtime
-  TrackElement* history;     //!< a pointer to the last TrackElement we were on. This is if you want to walk the path backwards again.
-
-  void debug() const;
-
-  // CONDITION FUNCTIONS and STUFF
-  void* subject;             //!< The Subject the Condition should act upon.
-  int (TrackElement::*condFunc)(const void*) const; //!< Pointer to the condition function
-
-  int lowest(const void* nothing) const;
-  int highest(const void* nothing) const;
-  int random(const void* nothing) const;
-
-  int leftRight(const void* node) const;
-  int nearest(const void* node) const;
-  // todo  int enemyKilled(void* entity);
-
-};
-
-//! the Condition to choose between the different ways of the game.
-enum CONDITION {LOWEST, HIGHEST, RANDOM, LEFTRIGHT, NEAREST, ENEMYKILLED};
-
-//! The TrackManager handles the flow of the Players through the game.
-/**
-
-   <b>The TrackManager works as followed:</b> \n
-     \n
-   <b>1. Initialize it, by setting up the Graph. You can do this by using the following Commands.</b>
-    \li workOn(): changes the ID that will be altered through the changes.
-    \li setCurveType(): lets you set the CurveType of the Curve we are Working on. (default is BezierCurve, set this as early as possible, for this uses resources).
-    \li setDuration(): sets the length of the current path in seconds.
-    \li addPoint(): adds a point to the Curve.
-    \li addHotPoint(): adds save/splitpoint.\n
-    \li fork(): adds some interessting non-linear movments through the level (fork will force addHotPoint if not done then).
-    \li condition(): decides under what condition a certain Path will be chosen.
-    \li join(): joins some tracks together again. Join will set the localTime to the longest time a Path has to get to this Point)
-    \li setSavePoint(): Sets a HotPoint into a savePoint. A Savepoint can be used as a rollbackpoint if a Player gets shot.
-
-    HotPoints and Joins are at the beginning of a TrackElement. \n
-    SavePoints and Forks are at the end of a TrackElement \n
-    look out: <b>SAVEPOINTS CAN NOT BE FORKS</b> (but joins), because the condition is really hard to guess if you do not give some impuls. \n
-\n
-   <b> 2. Runtime knows the following: </b>
-    \li calcPos(): returns the current position on the track
-    \li calcDir(): returns the current Direction the track is flying on.
-    \li tick(): makes a Step on the Path. increases localTime by dt.
-    \li choosePath(): a Function that decides which Path we should follow.
-
-   TrackManager can be handled as a StateMachine.
-   \n\n
-    Names:
-    \li TrackManager: handles Tracks
-    \li Track:        The Track that the ship can follow
-    \li Path:         one way through the Level, that is dependent on conditionals.
-    \li Conditional:  A decition making device, that chooses betwen different TrackElements for the Path.
-    \li TrackElement: A Part of A whole Track
-*/
-class TrackManager
-{
- public:
-  virtual ~TrackManager();
-  /** @returns a Pointer to the only object of this Class */
-  inline static TrackManager* getInstance() { if (!singletonRef) singletonRef = new TrackManager();  return singletonRef; };
-
-  virtual void loadParams(const TiXmlElement* root);
-
-  // Methods to change the Path (initialisation)
-  void workOn(unsigned int trackID);
-  void workOnS(const std::string& trackName);
-
-  /** \see setCurveType(CurveType curveType, TrackElement* trackElem); @param curveType the type of the Curve */
-  inline void setCurveType(CurveType curveType) { this->setCurveType (curveType, this->currentTrackElem);};
-  void setCurveType(CurveType curveType, TrackElement* trackElem);
-  void setDuration(float duration);
-  void setDuration(float duration, TrackElement* trackElem);
-  void addPoint(float x, float y, float z);
-  void addPointV(Vector newPoint, TrackElement* trackElem = NULL);
-  void addHotPoint(float x, float y, float z);
-  int addHotPointV(Vector newPoint, TrackElement* trackElem = NULL);
-  void setSavePointS(const std::string& nextElementName);
-  void setSavePoint(TrackElement* trackElem = NULL);
-  void fork(unsigned int count, ...);
-  void forkS(unsigned int count, ...);
-  void forkS(const std::string& forkString);
-  void forkV(unsigned int count, int* trackIDs, char** trackNames, TrackElement* trackElem = NULL);
-  void condition(unsigned int trackID, CONDITION cond, void* subject);
-  void condition(CONDITION cond, void* subject, TrackElement* trackElem = NULL);
-  void join(unsigned int count, ...);
-  void joinS(const std::string& joinString);
-  void joinS(unsigned int cound, ...);
-  void joinV(unsigned int count, int* trackIDs);
-  void finalize();
-
-  // Methods to calculate the position on the Path (runtime)
-  inline Vector calcPos() const;
-  inline Vector calcDir() const;
-  float getWidth() const;
-  void tick(float dt);
-  void jumpTo(float time);
-  inline int choosePath(TrackElement* trackElem);
-
-  void setBindSlave(PNode* bindSlave);
-  PNode* getTrackNode();
-
-  // DEBUG //
-  void drawGraph(float dt) const;
-  void debug(unsigned int level) const;
-
- private:
-  TrackManager();
-  void initChildren(unsigned int childCount, TrackElement* trackElem = NULL);
-
- private:
-  static TrackManager* singletonRef;           //!< There may only be one TrackManager.
-
-  TrackElement*        firstTrackElem;         //!< The first TrackElement that exists.
-  TrackElement*        currentTrackElem;       //!< The TrackElement we are working on.
-  CurveType            curveType;              //!< The CurveType the entire TrackSystem will have.
-  float                localTime;              //!< The time that has been passed since the traveling the Track.
-  float                maxTime;                //!< The maximal time the track has.
-  int                  trackElemCount;         //!< The count of TrackElements that exist.
-
-  // external
-  PNode*               bindSlave;              //!< The node that is slave to the TrackManager. This node will be moved while update the TrackManager, and must NOT move itself.
-  PNode*               trackNode;              //!< The main TrackNode of this Track.
-  Text*                trackText;              //!< The text to display when switching between Worlds.
-  tAnimation<Text>*    textAnimation;          //!< An Animation for the Text. (for fading it out on trackName-change)
-};
-
-#endif /* _TRACK_MANAGER_H */
Index: branches/cleanup/src/util/track/track_node.cc
===================================================================
--- branches/cleanup/src/util/track/track_node.cc	(revision 10586)
+++ 	(revision )
@@ -1,44 +1,0 @@
-
-
-/*
-   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: Benjamin Grauer
-   co-programmer: ...
-*/
-
-
-#include "track/track_node.h"
-
-#include "track/track_manager.h"
-
-
-ObjectListDefinition(TrackNode);
-
-/**
- *  standard constructor
-*/
-TrackNode::TrackNode ()
-{
-  this->registerObject(this, TrackNode::_objectList);
-
-  PNode::getNullParent()->addChild(this);
-  this->trackManager = TrackManager::getInstance();
-  this->setParentMode(PNODE_ALL);
-}
-
-/**
- *  standard deconstructor
-*/
-TrackNode::~TrackNode ()
-{
-
-}
Index: branches/cleanup/src/util/track/track_node.h
===================================================================
--- branches/cleanup/src/util/track/track_node.h	(revision 10586)
+++ 	(revision )
@@ -1,33 +1,0 @@
-/*!
- * @file track_node.h
-  *  Definition of the TrackNode are located here
-
-    the TrackNode is the node, that follows the Track (and the TrackManager)
-    through the level.
-    Under normal confitions the Plyaer(s) are
-*/
-
-
-#ifndef _TRACK_NODE_H
-#define _TRACK_NODE_H
-
-#include "p_node.h"
-
-
-/* FORWARD DECLARATION */
-class TrackManager;
-
-//! A node that follows the track.
-class TrackNode : public PNode
-{
-  ObjectListDeclaration(TrackNode);
- public:
-  TrackNode ();
-  virtual ~TrackNode ();
-
- private:
-  TrackManager* trackManager;         //!< reference to the TrackManager
-
-};
-
-#endif /* _TRACK_NODE_H */
Index: branches/cleanup/src/world_entities/camera.cc
===================================================================
--- branches/cleanup/src/world_entities/camera.cc	(revision 10586)
+++ branches/cleanup/src/world_entities/camera.cc	(revision 10588)
@@ -102,9 +102,9 @@
 
   //add to track
-/*  if(this->entityTrack)
+  if(this->entityTrack)
    {
     this->setParent(this->entityTrack->getTrackNode());
     //this->setRelCoor(0,0,0);
-   }*/
+   }
 }
 
@@ -227,5 +227,5 @@
   {
     //PRINTF(0)("tickytackytucky\n");
-/*    this->entityTrack->tick(dt);*/
+    this->entityTrack->tick(dt);
     //this->setAbsCoor(this->entityTrack->getTrackNode()->getAbsCoor());
   } 
@@ -240,6 +240,6 @@
 void Camera::draw() const
 {
-/*  if( this->entityTrack != NULL && this->isDrawTrack())
-    this->entityTrack->drawGraph();*/
+  if( this->entityTrack != NULL && this->isDrawTrack())
+    this->entityTrack->drawGraph();
 }
 
Index: branches/cleanup/src/world_entities/npcs/npc.cc
===================================================================
--- branches/cleanup/src/world_entities/npcs/npc.cc	(revision 10586)
+++ branches/cleanup/src/world_entities/npcs/npc.cc	(revision 10588)
@@ -152,5 +152,5 @@
   if( this->entityTrack)
   {
-/*      this->setParent(this->entityTrack->getTrackNode());*/
+      this->setParent(this->entityTrack->getTrackNode());
       this->setRelCoor(0,0,0);
   }
@@ -426,6 +426,6 @@
   this->bFire = false;
 
-//  if(this->entityTrack)
-//     this->entityTrack->tick(dt);
+ if(this->entityTrack)
+    this->entityTrack->tick(dt);
 
 }
@@ -433,6 +433,6 @@
 void NPC::draw() const
 {
-//  if( this->entityTrack != NULL && this->isDrawTrack())
-//   this->entityTrack->drawGraph();
+ if( this->entityTrack != NULL && this->isDrawTrack())
+  this->entityTrack->drawGraph();
 
  WorldEntity::draw();
Index: branches/cleanup/src/world_entities/space_ships/space_ship.cc
===================================================================
--- branches/cleanup/src/world_entities/space_ships/space_ship.cc	(revision 10586)
+++ branches/cleanup/src/world_entities/space_ships/space_ship.cc	(revision 10588)
@@ -493,6 +493,6 @@
 void SpaceShip::draw () const
 {
-//   if( this->entityTrack != NULL && this->isDrawTrack())
-//     this->entityTrack->drawGraph();
+  if( this->entityTrack != NULL && this->isDrawTrack())
+    this->entityTrack->drawGraph();
 
   WorldEntity::draw();
@@ -550,6 +550,6 @@
 
   // Tracktick
-//   if(this->entityTrack)
-//     this->entityTrack->tick(time);
+  if(this->entityTrack)
+    this->entityTrack->tick(time);
 
 
@@ -867,6 +867,6 @@
         this->isTravelDistanceInit = false;
 
-//         if(this->entityTrack)
-//            this->travelNode->setParent(this->entityTrack->getTrackNode());
+        if(this->entityTrack)
+           this->travelNode->setParent(this->entityTrack->getTrackNode());
 
         this->setParent(this->travelNode);
Index: branches/cleanup/src/world_entities/test_entity.cc
===================================================================
--- branches/cleanup/src/world_entities/test_entity.cc	(revision 10586)
+++ branches/cleanup/src/world_entities/test_entity.cc	(revision 10588)
@@ -86,6 +86,6 @@
 
  //add to track
-//   if(this->entityTrack)
-//     this->setParent(this->entityTrack->getTrackNode());
+  if(this->entityTrack)
+    this->setParent(this->entityTrack->getTrackNode());
 
 }
@@ -138,6 +138,6 @@
 
 
-// if( this->entityTrack != NULL)
-//     this->entityTrack->drawGraph();
+if( this->entityTrack != NULL)
+    this->entityTrack->drawGraph();
 
 }
@@ -148,6 +148,6 @@
 void TestEntity::tick (float time)
 {
-//  if(this->entityTrack)
-//     this->entityTrack->tick(time);
+ if(this->entityTrack)
+    this->entityTrack->tick(time);
 
 
Index: branches/cleanup/src/world_entities/world_entity.cc
===================================================================
--- branches/cleanup/src/world_entities/world_entity.cc	(revision 10586)
+++ branches/cleanup/src/world_entities/world_entity.cc	(revision 10588)
@@ -185,7 +185,7 @@
 {
   // The problem we have is most likely here. The track should be constructed WITH the XML-Code
-/*  this->entityTrack = new Track(root);
+  this->entityTrack = new Track(root);
   this->setParent(this->entityTrack->getTrackNode());
-  this->entityTrack->getTrackNode()->setParentMode(PNODE_ALL);*/
+  this->entityTrack->getTrackNode()->setParentMode(PNODE_ALL);
   /*LOAD_PARAM_START_CYCLE(root, element);
   {
@@ -200,6 +200,6 @@
 void WorldEntity::pauseTrack(bool stop)
 {
-/*     if(this->entityTrack)
-       this->entityTrack->pauseTrack(stop);*/ 
+     if(this->entityTrack)
+       this->entityTrack->pauseTrack(stop);
 }
 
