Index: /orxonox/trunk/src/track_manager.cc
===================================================================
--- /orxonox/trunk/src/track_manager.cc	(revision 3836)
+++ /orxonox/trunk/src/track_manager.cc	(revision 3837)
@@ -452,4 +452,7 @@
   if (childCount == 1)
     trackElem->getChild(0)->setName(trackElem->getName());
+
+  // select the first Child to work on.
+  this->currentTrackElem = trackElem->getChild(0);
 }
 
@@ -558,28 +561,30 @@
   trackElem->curve->addNode(newPoint);
   trackElem->nodeCount++;
-  this->initChildren(1);
-  this->currentTrackElem = this->currentTrackElem->getChild(0);
+  this->initChildren(1, trackElem);
 }
 
 /**
    \brief 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.
 */
-int TrackManager::setSavePoint(void)
-{
+int TrackManager::setSavePoint(TrackElement* trackElem)
+{
+  if (!trackElem)
+    trackElem = this->currentTrackElem;
+
   PRINTF(4)("setting up a SavePoint.\n");
-  if (this->currentTrackElem->isFork || this->currentTrackElem->isSavePoint)
-    {
-      PRINTF(2)("%d is already finished \n", currentTrackElem->ID);
-      return this->currentTrackElem->getChild(0)->ID;
-    }
-  this->currentTrackElem->isSavePoint = true;
-  this->currentTrackElem->isHotPoint = true;
-
-  this->initChildren(1);
-  this->currentTrackElem = this->currentTrackElem->getChild(0);
+  if (trackElem->isFork || trackElem->isSavePoint)
+    {
+      PRINTF(2)("%d is already finished \n", trackElem->ID);
+      return trackElem->getChild(0)->ID;
+    }
+  trackElem->isSavePoint = true;
+  trackElem->isHotPoint = true;
+
+  this->initChildren(1, trackElem);
 }
 
@@ -609,19 +614,30 @@
    \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).
-
-   \see void TrackManager::fork(int count, ...)
-
-   \todo initialisation is wrong!! also in setSavePoint.
-*/
-void TrackManager::forkV(unsigned int count, int* trackIDs)
-{
+   \param trackElem The TrackElement to appy this to. (if NULL chose this->currentTrackElement)
+*/
+void TrackManager::forkV(unsigned int count, int* trackIDs, TrackElement* trackElem)
+{
+  if (!trackElem)
+    trackElem = this->currentTrackElem;
+
   PRINTF(4)("Forking with %d children\n", count);
-  if (this->currentTrackElem->isSavePoint)
+  if (trackElem->isSavePoint)
     return;
-  this->currentTrackElem->isFork = true;
-  this->currentTrackElem->isHotPoint = true;
+  trackElem->isFork = true;
+  trackElem->isHotPoint = true;
   for(int i = 0; i < count; i++)
     trackIDs[i]=this->trackElemCount+1+i;
-  this->initChildren(count);
+  this->initChildren(count, trackElem);
+}
+
+/**
+   \brief 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));
 }
 
@@ -630,21 +646,14 @@
    \param cond the CONDITION of the decision
    \param subject the Subject that will be decided upon with CONDITION cond.
-*/
-void TrackManager::condition(CONDITION cond, void* subject)
-{
-  this->condition(this->currentTrackElem->ID, cond, subject);
-}
-/**
-   \brief decides under what condition a certain Path will be chosen.
-   \param groupID the ID on which to choose the preceding move
-   \param cond the CONDITION of the decision
-   \param subject the Subject that will be decided upon with CONDITION cond.
-*/
-void TrackManager::condition(unsigned int groupID, CONDITION cond, void* subject)
-{
-  TrackElement* tmpElem = this->firstTrackElem->findByID(groupID);
-  if (!tmpElem->isFork)
-    {
-      PRINTF(2)("%d is not a Fork, and no condition can be set in this case\n", tmpElem->ID);
+   \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;
     }
@@ -654,22 +663,22 @@
 	{
 	case LOWEST:
-	  tmpElem->condFunc = &TrackElement::lowest;
+	  trackElem->condFunc = &TrackElement::lowest;
 	  break;
 	case HIGHEST:
-	  tmpElem->condFunc = &TrackElement::highest;
+	  trackElem->condFunc = &TrackElement::highest;
 	  break;
 	case RANDOM: 
-	  tmpElem->condFunc = &TrackElement::random;
+	  trackElem->condFunc = &TrackElement::random;
 	  break;
 	case LEFTRIGHT:
-	  tmpElem->condFunc = &TrackElement::leftRight;
+	  trackElem->condFunc = &TrackElement::leftRight;
 	  break;
 	case NEAREST:
-	  tmpElem->condFunc = &TrackElement::nearest;
+	  trackElem->condFunc = &TrackElement::nearest;
 	  break;
 	case ENEMYKILLED:
 	  break;
 	}
-      tmpElem->subject=subject;
+      trackElem->subject=subject;
     }
 }
Index: /orxonox/trunk/src/track_manager.h
===================================================================
--- /orxonox/trunk/src/track_manager.h	(revision 3836)
+++ /orxonox/trunk/src/track_manager.h	(revision 3837)
@@ -156,9 +156,9 @@
   bool addPoint(Vector newPoint, TrackElement* trackElem = NULL);
   int addHotPoint(Vector newPoint, TrackElement* trackElem = NULL);
-  int setSavePoint(void);
+  int setSavePoint(TrackElement* trackElem = NULL);
   void fork(unsigned int count, ...);
-  void forkV(unsigned int count, int* trackIDs);
-  void condition(CONDITION cond, void* subject);
-  void condition(unsigned int groupID, CONDITION cond, void* subject);
+  void forkV(unsigned int count, int* trackIDs, 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 joinV(unsigned int count, int* trackIDs);
