Index: orxonox/branches/parenting/src/track_manager.cc
===================================================================
--- orxonox/branches/parenting/src/track_manager.cc	(revision 3332)
+++ orxonox/branches/parenting/src/track_manager.cc	(revision 3333)
@@ -34,5 +34,6 @@
   this->cond; //!< todo think!!
   this->ID = -1;
-  this->length =0;
+  this->startingTime = 0; //!< \todo eventually set this to the max time of TrackManager.
+  this->duration =0;
   this->curveType = BEZIERCURVE;
   this->nodeCount = 0;
@@ -58,4 +59,18 @@
 	delete this->children[i];
     }
+  if (children)
+    delete children;
+}
+
+/**
+   \brief reserves Space for childCount children
+   \param childCount The Count of children to make space for.
+*/
+void TrackElement::initChildren(unsigned int childCount)
+{
+  this->childCount = childCount;
+  this->children = new TrackElement*[childCount];
+  for (int i=0; i<childCount; i++)
+    this->children[i] = new TrackElement();
 }
 
@@ -183,11 +198,11 @@
 
 /**
-   \brief Sets the length of the current path in seconds.
-   \param time The length in seconds.
-*/
-
-void TrackManager::setLength(float time)
-{
-  this->currentTrackElem->length = time;
+   \brief Sets the duration of the current path in seconds.
+   \param time The duration in seconds.
+*/
+
+void TrackManager::setDuration(float time)
+{
+  this->currentTrackElem->duration = time;
 }
 
@@ -196,5 +211,5 @@
    \param newPoint The point to add.
 */
-void TrackManager::addPoint(Vector newPoint)
+bool TrackManager::addPoint(Vector newPoint)
 {
   if (this->currentTrackElem->isFresh)
@@ -209,6 +224,7 @@
    \brief adds save/splitpoint.
    \param newPoint The point to add.
-*/
-void TrackManager::addHotPoint(Vector newPoint)
+   \returns A Pointer to a newly appended Curve
+*/
+int TrackManager::addHotPoint(Vector newPoint)
 {
   if (this->currentTrackElem->isFresh)
@@ -224,15 +240,16 @@
 /**
    \brief Sets the last HotPoint into a savePoint.
+   \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(void)
+int TrackManager::setSavePoint(void)
 {
   if (this->currentTrackElem->isFork || this->currentTrackElem->isSavePoint)
-    return;
+    return this->currentTrackElem->children[1]->ID;
   this->currentTrackElem->isSavePoint = true;
 
-  this->currentTrackElem->children = new TrackElement*[1];
+  this->currentTrackElem->initChildren(1);
 }
 
@@ -273,5 +290,5 @@
   this->currentTrackElem->isFork = true;
 
-  this->currentTrackElem->children = new TrackElement*[count];
+  this->currentTrackElem->initChildren(count);
 }
 
@@ -327,5 +344,5 @@
 Vector TrackManager::calcPos() const
 {
-  
+  return this->currentTrackElem->curve->calcPos(this->localTime);
 }
 
@@ -336,5 +353,5 @@
 Vector TrackManager::calcDir() const
 {
-
+  return this->currentTrackElem->curve->calcDir(this->localTime);
 }
 
@@ -342,4 +359,6 @@
    \brief 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)
Index: orxonox/branches/parenting/src/track_manager.h
===================================================================
--- orxonox/branches/parenting/src/track_manager.h	(revision 3332)
+++ orxonox/branches/parenting/src/track_manager.h	(revision 3333)
@@ -33,4 +33,6 @@
   ~TrackElement(void);
 
+  void initChildren(unsigned int childCount);
+
   TrackElement* findByID(unsigned int trackID);
 
@@ -41,5 +43,6 @@
   PathCondition cond;        //!< The Split Condition;
   int ID;                    //!< The ID of this TrackElement
-  float length;              //!< The time usedto cross this TrackElement (curve).
+  float startingTime;        //!< The time at which this Track begins.
+  float duration;            //!< The time used to cross this TrackElement (curve).
   CurveType curveType;       //!< The CurveType this will have.
   int nodeCount;             //!< The count of points this TrackElement has.
@@ -61,5 +64,5 @@
     \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 setLength(): sets the length of the current path in seconds.
+    \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
@@ -102,5 +105,4 @@
 
   TrackElement* findTrackElementByID(unsigned int trackID) const;
-  
 
  public:
@@ -111,8 +113,8 @@
   void workOn(unsigned int trackID);
   void setCurveType(CurveType curveType);
-  void setLength(float time);
-  void addPoint(Vector newPoint);
-  void addHotPoint(Vector newPoint);
-  void setSavePoint(void);
+  void setDuration(float time);
+  bool addPoint(Vector newPoint);
+  int addHotPoint(Vector newPoint);
+  int setSavePoint(void);
   void fork(unsigned int count, ...);
   void forkV(unsigned int count, int* trackIDs);
