Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 30, 2005, 9:02:23 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/textEngine: merged trunk here.
merged with command:
svn merge ../trunk textEngine -r 3467:HEAD
no conflicts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/textEngine/src/track_manager.cc

    r3433 r3681  
    1414*/
    1515
     16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_TRACK_MANAGER
    1617
    1718#include "track_manager.h"
     19
     20#include "base_object.h"
     21#include "p_node.h"
     22#include "track_node.h"
     23#include "stdincl.h"
     24#include "list.h"
     25
     26
     27
    1828#include <stdarg.h>
    19 #include "p_node.h"
    2029
    2130using namespace std;
     
    3241  this->isJoined = false;
    3342  this->mainJoin = false;
    34   this->cond; //!< todo think!!
    3543  this->ID = -1;
    36   this->startingTime = 0; //!< \todo eventually set this to the max time of TrackManager.
    37   this->duration = 1;
     44  this->startingTime = 0;
     45  this->duration = TMAN_DEFAULT_DURATION;
    3846  this->endTime = 1;
    3947  this->jumpTime = 0;
    40   this->curveType = BEZIERCURVE;
     48  this->width = TMAN_DEFAULT_WIDTH;
    4149  this->nodeCount = 0;
    4250  this->childCount = 0;
     
    4452  this->curve = NULL;
    4553  this->children = NULL;
     54
     55  this->history = NULL;
     56
     57  this->condFunc = &TrackElement::random;
    4658}
    4759
     
    5870  if ((!this->isJoined &&this->childCount > 0) || (this->isJoined && this->mainJoin))
    5971    {
    60       for (int i=0; i < this->childCount; i++)
    61         delete this->children[i];
     72      tIterator<TrackElement>* iterator = this->children->getIterator();
     73      TrackElement* enumElem = iterator->nextElement();
     74      while (enumElem)
     75        {
     76          delete enumElem;
     77          enumElem = iterator->nextElement();
     78        }
     79      delete iterator;
    6280      delete this->children;
    6381    }
     
    7896  // search on.
    7997  if (this->childCount > 0)
    80     for (int i=0; i < this->childCount; i++)
    81       {
    82         TrackElement* tmpElem;
    83         if ((tmpElem = this->children[i]->findByID(trackID)))
    84           return tmpElem;
    85       }
    86   else return NULL;
    87 }
    88 
    89 
    90 
    91 
    92 
    93 /////////////////////////////////////
    94 ///// TRACKMANAGER //////////////////
    95 /////////////////////////////////////
     98    {
     99      tIterator<TrackElement>* iterator = this->children->getIterator();
     100      TrackElement* enumElem = iterator->nextElement();
     101      TrackElement* tmpElem;
     102      while (enumElem)
     103        {
     104          if ((tmpElem = enumElem->findByID(trackID)))
     105            return tmpElem;
     106          enumElem = iterator->nextElement();
     107        }
     108      delete iterator;
     109    }
     110  else
     111    return NULL;
     112}
     113
     114
     115/**
     116   \brief checks if there are any BackLoops in the Track
     117   \param trackElem the trackElement to check about
     118   it simply does this by looking if the current trackElem is found again somewhere else in the Track
     119*/
     120bool TrackElement::backLoopCheck(TrackElement* trackElem)
     121{
     122  if (this->childCount == 0)
     123    return true;
     124  else
     125    {
     126      tIterator<TrackElement>* iterator = this->children->getIterator();
     127      TrackElement* enumElem = iterator->nextElement();
     128      while (enumElem)
     129        {
     130          if(!enumElem->backLoopCheck(trackElem))
     131            return false;
     132          enumElem = iterator->nextElement();
     133        }
     134      delete iterator;
     135     
     136      return true;
     137    }
     138}
     139
     140/**
     141   \param childNumber which child to return
     142   \returns the n-the children (starting at 0)
     143*/
     144TrackElement* TrackElement::getChild(int childCount)
     145{
     146  if (this->childCount == 0)
     147    return NULL;
     148  if (childCount > this->childCount)
     149    childCount = this->childCount;
     150 
     151  TrackElement* enumElem = this->children->enumerate();
     152  for (int i = 0; i < childCount; i++)
     153    enumElem = this->children->nextElement();
     154  return enumElem;
     155}
     156
     157/**
     158   \param name the Name to set.
     159*/
     160void TrackElement::setName(const char* name)
     161{
     162  //  delete the old name
     163  if (this->name)
     164    delete []this->name;
     165  // if a name was given already.
     166  if (name)
     167    {
     168      this->name = new char[strlen(name)+1];
     169      strcpy(this->name, name);
     170    }
     171  else
     172    this->name = NULL;
     173}
     174
     175/**
     176   \returns The name of this TrackElement
     177*/
     178char* TrackElement::getName(void) const
     179{
     180  return this->name;
     181}
     182
     183/**
     184   \brief prints out debug information about this TrackElement
     185*/
     186void TrackElement::debug(void)
     187{
     188  PRINT(0)("--== TrackElement:%i ==--", this->ID);
     189  if(this->getName())
     190    PRINT(0)("Name: %s::", this->getName());
     191  if(this->isFresh)
     192    PRINT(0)("  -- has not jet eddited in any way --\n");
     193  PRINT(0)("\n   TimeTable: startingTime=%f; endTime=%f; duration=%f; jumpTime=%f\n", this->startingTime, this->endTime, this->duration, this->jumpTime);
     194  PRINT(0)("   consists of %d Points\n", this->nodeCount);
     195  if (this->childCount == 0)
     196    PRINT(0)("   has no child\n");
     197  else if (this->childCount == 1)
     198    PRINT(0)("   has 1 child: =%d=\n", this->getChild(0)->ID);
     199  else if (this->childCount > 1)
     200    {
     201      PRINT(0)("   has %d children: ", this->childCount);
     202      TrackElement* enumElem = this->children->enumerate();
     203      while (enumElem)
     204        {
     205          PRINT(0)("=%d= ", enumElem->ID);
     206          enumElem = this->children->nextElement();
     207        }
     208      PRINT(0)("\n");
     209    }
     210 
     211  if(this->isHotPoint)
     212    PRINT(0)("   is a special Point:\n");
     213  if(this->isSavePoint)
     214    PRINT(0)("    is a SavePoint\n");
     215  if(this->isFork)
     216    {
     217      PRINT(0)("    is A Fork with with %d children.\n", this->childCount);
     218    }
     219  if(this->isJoined)
     220    PRINT(0)("   is Joined at the End\n");
     221 
     222  if(!this->backLoopCheck(this)) /* this should not happen */
     223    PRINT(2)(" THERE IS A BACKLOOP TO THIS ELEMENT\n");
     224}
     225
     226/**
     227   \brief CONDITION that chooses the first child for the decision (static)
     228   \param nothing Nothing in this function
     229   \returns the chosen child
     230*/
     231int TrackElement::lowest(void* nothing)
     232{
     233  return 0;
     234}
     235
     236/**
     237   \brief CONDITION that chooses the last child for the decision (static)
     238   \param nothing Nothing in this function
     239   \returns the chosen child
     240*/
     241int TrackElement::highest(void* nothing)
     242{
     243  return this->childCount-1;
     244}
     245
     246/**
     247   \brief CONDITION that chooses a random child for the decision (static)
     248   \param nothing Nothing in this function
     249   \returns the chosen child
     250*/
     251int TrackElement::random(void* nothing)
     252{
     253  int i = (int)floor ((float)rand()/(float)RAND_MAX * (float)this->childCount);
     254  if (i >= this->childCount)
     255    return this->childCount-1;
     256  else
     257    return i;
     258}
     259
     260/**
     261   \brief CONDITION that chooses child 0, if the node(probably Player)
     262   is left of its parent (z<0)) and 1/right otherwise.
     263   \param node The node to act upon.
     264   \returns the chosen child
     265*/
     266int TrackElement::leftRight(void* node)
     267{
     268  PNode* tmpNode = (PNode*)node;
     269
     270  if (tmpNode->getRelCoor()->z < 0)
     271    return 0;
     272  else
     273    return 1;
     274}
     275
     276
     277/**
     278   \brief CONDITION that chooses the child, that has the nearest distance to the node (probably player).
     279   \param node The node to act upon.
     280   \returns the chosen child
     281
     282   This is rather dangerous, because one must carefully set the points on the curve.
     283   The best Way is to set the nodes as wide away of each other as possible,
     284   but take into consideration, that if the nodes are to far from a center node, the center will be chosen.
     285   (play with this!!).
     286*/
     287int TrackElement::nearest(void* node)
     288{
     289  PNode* tmpNode = (PNode*)node;
     290
     291  Vector nodeRelCoord = *tmpNode->getRelCoor();
     292  float minDist = 100000000;
     293  int childNumber = 0;
     294  int i = 0;
     295
     296  TrackElement* enumElem = this->children->enumerate();
     297  while (enumElem)
     298    {
     299      float dist = (nodeRelCoord - enumElem->curve->getNode(4)).len();
     300      if (dist < minDist)
     301        {
     302          minDist = dist;
     303          childNumber = i;
     304        }
     305      i++;
     306      enumElem = this->children->nextElement();
     307    }
     308
     309  PRINTF(4)("PathDecision with nearest algorithm: %d\n", childNumber);
     310  return childNumber;
     311}
     312
     313
     314////////////////////////
     315///// TRACKMANAGER /////
     316////////////////////////
    96317/**
    97318   \brief standard constructor
     
    100321TrackManager::TrackManager(void)
    101322{
    102   this->setClassName ("TrackManager");
     323  this->setClassName("TrackManager");
     324 
     325  TrackManager::singletonRef = this;
    103326
    104327  PRINTF(3)("Initializing the TrackManager\n");
     
    109332  this->maxTime = 0;
    110333  this->trackElemCount = 1;
    111   this->bindSlave = NULL;
     334  this->setBindSlave(this->trackNode = new TrackNode());
    112335}
    113336
     
    115338/**
    116339   \brief standard destructor
    117 
    118340*/
    119341TrackManager::~TrackManager(void)
     
    121343  PRINTF(3)("Destruct TrackManager\n");
    122344
    123   PRINTF(3)("Deleting all the TrackElements\n");
     345  PRINTF(4)("Deleting all the TrackElements\n");
    124346  delete this->firstTrackElem;
    125347
    126348  // we do not have a TrackManager anymore
    127   singletonRef = NULL;
    128 }
    129 
     349  TrackManager::singletonRef = NULL;
     350}
     351
     352//! Singleton Reference to TrackManager
    130353TrackManager* TrackManager::singletonRef = NULL;
    131354
     
    137360TrackManager* TrackManager::getInstance(void)
    138361{
    139   if (singletonRef)
    140     return singletonRef;
    141   else
    142     return singletonRef = new TrackManager();
     362  if (!TrackManager::singletonRef)
     363    TrackManager::singletonRef = new TrackManager();
     364  return TrackManager::singletonRef;
    143365}
    144366
     
    151373  this->currentTrackElem->childCount = childCount;
    152374  this->currentTrackElem->mainJoin = true;
    153   this->currentTrackElem->children = new TrackElement*[childCount];
    154   for (int i=0; i<childCount; i++)
    155     {
    156       this->currentTrackElem->children[i] = new TrackElement();
    157       this->currentTrackElem->children[i]->ID = ++trackElemCount;
    158       this->currentTrackElem->children[i]->startingTime = this->currentTrackElem->endTime + this->currentTrackElem->jumpTime;
    159       this->addPoint(this->currentTrackElem->curve->getNode(this->currentTrackElem->curve->getNodeCount()), this->currentTrackElem->children[i]);
    160     }
     375  this->currentTrackElem->children =  new tList<TrackElement>();
     376  for (int i = 0; i < childCount; i++)
     377    {
     378      TrackElement* newElem = new TrackElement();
     379      this->currentTrackElem->children->add(newElem);
     380      newElem->ID = ++trackElemCount;
     381      newElem->startingTime = this->currentTrackElem->endTime + this->currentTrackElem->jumpTime;
     382      this->addPoint(this->currentTrackElem->curve->getNode(this->currentTrackElem->curve->getNodeCount()), this->currentTrackElem->getChild(i));
     383    }
     384  if (childCount == 1)
     385    this->currentTrackElem->getChild(0)->setName(this->currentTrackElem->getName());
    161386}
    162387
     
    183408    this->currentTrackElem = tmpElem;
    184409  else
    185     printf("TrackElement not Found, leaving unchanged\n");
    186   printf("now Working on %d\n", this->currentTrackElem->ID);
     410    PRINTF(2)("TrackElement not Found, leaving unchanged\n");
     411  PRINTF(4)("now Working on %d\n", this->currentTrackElem->ID);
    187412
    188413}
     
    190415/**
    191416   \brief Sets the Type of the Curve
    192    \brief curveType The Type to set
     417   \param curveType The Type to set
     418   \param trackElem the TrackElement that should get a new Curve.
    193419*/
    194420void TrackManager::setCurveType(CurveType curveType, TrackElement* trackElem)
     
    199425      return;
    200426    }
    201   trackElem->curveType = curveType;
     427  this->curveType = curveType;
    202428  switch (curveType)
    203429    {
     
    205431      trackElem->curve = new BezierCurve();
    206432      break;
    207     case UPOINTCURVE:
    208       trackElem->curve = new UPointCurve();
    209       break;
     433
    210434    }
    211435}
     
    240464  if (trackElem->isFresh)
    241465    {
    242       this->setCurveType(BEZIERCURVE, trackElem);
     466      this->setCurveType(TMAN_DEFAULT_CURVETYPE, trackElem);
    243467      trackElem->isFresh = false;
    244468    }
     
    254478int TrackManager::addHotPoint(Vector newPoint)
    255479{
    256   printf("setting up a HotPoint\n");
     480  PRINTF(4)("setting up a HotPoint\n");
    257481  if (this->currentTrackElem->isFresh)
    258482    {
     
    265489  this->currentTrackElem->nodeCount++;
    266490  this->initChildren(1);
    267   this->currentTrackElem = this->currentTrackElem->children[0];
     491  this->currentTrackElem = this->currentTrackElem->getChild(0);
    268492}
    269493
     
    277501int TrackManager::setSavePoint(void)
    278502{
    279   printf("setting up a SavePoint.\n");
     503  PRINTF(4)("setting up a SavePoint.\n");
    280504  if (this->currentTrackElem->isFork || this->currentTrackElem->isSavePoint)
    281     return this->currentTrackElem->children[1]->ID;
     505    {
     506      PRINTF(2)("%d is already finished \n", currentTrackElem->ID);
     507      return this->currentTrackElem->getChild(0)->ID;
     508    }
    282509  this->currentTrackElem->isSavePoint = true;
    283510  this->currentTrackElem->isHotPoint = true;
    284511
    285512  this->initChildren(1);
    286   this->currentTrackElem = this->currentTrackElem->children[0];
     513  this->currentTrackElem = this->currentTrackElem->getChild(0);
    287514}
    288515
     
    319546void TrackManager::forkV(unsigned int count, int* trackIDs)
    320547{
    321   printf("Forking with %d children\n", count);
     548  PRINTF(4)("Forking with %d children\n", count);
    322549  if (this->currentTrackElem->isSavePoint)
    323550    return;
     
    331558/**
    332559   \brief decides under what condition a certain Path will be chosen.
     560   \param cond the CONDITION of the decision
     561   \param subject the Subject that will be decided upon with CONDITION cond.
     562*/
     563void TrackManager::condition(CONDITION cond, void* subject)
     564{
     565  this->condition(this->currentTrackElem->ID, cond, subject);
     566}
     567/**
     568   \brief decides under what condition a certain Path will be chosen.
    333569   \param groupID the ID on which to choose the preceding move
    334    \param cond \todo think about this
    335 */
    336 void TrackManager::condition(unsigned int groupID, PathCondition cond)
    337 {
    338  
    339 }
     570   \param cond the CONDITION of the decision
     571   \param subject the Subject that will be decided upon with CONDITION cond.
     572*/
     573void TrackManager::condition(unsigned int groupID, CONDITION cond, void* subject)
     574{
     575  TrackElement* tmpElem = this->findTrackElementByID(groupID);
     576  if (!tmpElem->isFork)
     577    {
     578      PRINTF(2)("%d is not a Fork, and no condition can be set in this case\n", tmpElem->ID);
     579      return;
     580    }
     581  else
     582    {
     583      switch (cond)
     584        {
     585        case LOWEST:
     586          tmpElem->condFunc = &TrackElement::lowest;
     587          break;
     588        case HIGHEST:
     589          tmpElem->condFunc = &TrackElement::highest;
     590          break;
     591        case RANDOM:
     592          tmpElem->condFunc = &TrackElement::random;
     593          break;
     594        case LEFTRIGHT:
     595          tmpElem->condFunc = &TrackElement::leftRight;
     596          break;
     597        case NEAREST:
     598          tmpElem->condFunc = &TrackElement::nearest;
     599          break;
     600        case ENEMYKILLED:
     601          break;
     602        }
     603      tmpElem->subject=subject;
     604    }
     605}
     606
    340607
    341608/**
     
    369636void TrackManager::joinV(unsigned int count, int* trackIDs)
    370637{
    371   printf("Joining %d tracks and merging to Track %d\n", count, trackIDs[0]);
     638  PRINTF(3)("Joining %d tracks and merging to Track %d\n", count, trackIDs[0]);
     639
     640  // checking if there is a back-loop-connection and ERROR if it is.
     641  TrackElement* tmpTrackElem = this->findTrackElementByID(trackIDs[0]);
     642  if (!tmpTrackElem->backLoopCheck(tmpTrackElem))
     643    PRINTF(2)("Backloop connection detected at joining trackElements\n");
    372644
    373645  // chanching work-on to temporary value. going back at the end.
     
    419691    }
    420692  if(firstJoint->childCount > 0)
    421     for(int i = 0; i < firstJoint->childCount; i++)
    422       {
    423         printf("Setting startingTime of %d to %f.\n", firstJoint->children[i]->ID, tmpLatestTime);
    424         firstJoint->children[i]->startingTime = tmpLatestTime;
    425         firstJoint->children[i]->endTime = tmpLatestTime+firstJoint->children[i]->duration;
    426       }
    427 
     693    {
     694      TrackElement* enumElem = firstJoint->children->enumerate();
     695      while (enumElem)
     696        {
     697          PRINTF(4)("Setting startingTime of %d to %f.\n", enumElem->ID, tmpLatestTime);
     698          enumElem->startingTime = tmpLatestTime;
     699          enumElem->endTime = tmpLatestTime + enumElem->duration;
     700         
     701          enumElem = firstJoint->children->nextElement();
     702        }
     703    }
    428704  // returning to the TrackElement we were working on.
    429705  this->workOn(tmpCurrentWorkingID);
     
    440716    {
    441717      TrackElement* tmpElem = findTrackElementByID(i);
    442       if (tmpElem->childCount>0 && tmpElem->mainJoin)
     718      if (tmpElem->childCount > 0 && tmpElem->mainJoin)
    443719        {
    444           for (int j = 0; j < tmpElem->childCount; j++)
     720
     721          TrackElement* enumElem = tmpElem->children->enumerate();
     722          while (enumElem)
    445723            {
    446724             
    447725              // c1-continuity
    448               tmpElem->children[j]->curve->addNode(tmpElem->children[j]->curve->getNode(0) +
    449                                                    ((tmpElem->children[j]->curve->getNode(0) -
     726              enumElem->curve->addNode(enumElem->curve->getNode(0) +
     727                                                   ((enumElem->curve->getNode(0) -
    450728                                                    tmpElem->curve->getNode(tmpElem->curve->getNodeCount()-1))
    451729                                                    ),2);
    452               tmpElem->children[j]->nodeCount++;
     730              enumElem->nodeCount++;
    453731              // c2-continuity
    454               tmpElem->children[j]->curve->addNode((tmpElem->curve->getNode(tmpElem->curve->getNodeCount())-
     732              enumElem->curve->addNode((tmpElem->curve->getNode(tmpElem->curve->getNodeCount())-
    455733                                                    tmpElem->curve->getNode(tmpElem->curve->getNodeCount()-1)) * 4 +
    456734                                                   tmpElem->curve->getNode(tmpElem->curve->getNodeCount()-2), 3);
    457               tmpElem->children[j]->nodeCount++;                                                   
    458               printf("accelerations: %d-in: count: %d, %f, %f, %f\n                  %d-out: count: %d %f, %f, %f\n",
     735              enumElem->nodeCount++;                                               
     736              PRINTF(5)("accelerations: %d-in: count: %d, %f, %f, %f\n                  %d-out: count: %d %f, %f, %f\n",
    459737                     tmpElem->ID, tmpElem->nodeCount,
    460738                     tmpElem->curve->calcAcc(0.999).x, tmpElem->curve->calcAcc(0.999).y, tmpElem->curve->calcAcc(0.999).z,
    461                      tmpElem->children[j]->ID, tmpElem->children[j]->nodeCount,
    462                      tmpElem->children[j]->curve->calcAcc(0).x, tmpElem->children[j]->curve->calcAcc(0).y, tmpElem->children[j]->curve->calcAcc(0).z);
     739                     enumElem->ID, enumElem->nodeCount,
     740                     enumElem->curve->calcAcc(0).x, enumElem->curve->calcAcc(0).y, enumElem->curve->calcAcc(0).z);
     741             
     742              enumElem = tmpElem->children->nextElement();
    463743            }
    464744        }
    465745    }
     746  for (int i = 1; i <=trackElemCount;i++)
     747    if (this->findTrackElementByID(i)->endTime > this->maxTime)
     748      this->maxTime = findTrackElementByID(i)->endTime; // very bad implemented :/
    466749}
    467750
     
    475758Vector TrackManager::calcPos() const
    476759{
    477   //  PRINTF(0)("TrackElement:%d, localTime: %f\n",this->currentTrackElem->ID, this->localTime);
    478760  return this->currentTrackElem->curve->calcPos((this->localTime-this->currentTrackElem->startingTime)/this->currentTrackElem->duration);
    479761}
     
    489771
    490772/**
     773   \returns the current Width of the track
     774*/
     775float TrackManager::getWidth(void) const
     776{
     777  return this->currentTrackElem->width;
     778}
     779
     780/**
    491781   \brief Advances the local-time of the Track around dt
    492782   \param dt The time about which to advance.
     
    497787{
    498788  dt /= 1000;
    499   printf("CurrentTrackID: %d, LocalTime is: %f, timestep is: %f\n", this->currentTrackElem->ID, this->localTime, dt);
     789  PRINTF(4)("CurrentTrackID: %d, LocalTime is: %f, timestep is: %f\n", this->currentTrackElem->ID, this->localTime, dt);
    500790  if (this->localTime <= this->firstTrackElem->duration)
    501791    this->jumpTo(this->localTime);
    502   this->localTime += dt;
     792  if (this->localTime <= this->maxTime)
     793    this->localTime += dt;
    503794  if (this->localTime > this->currentTrackElem->endTime
    504795      && this->currentTrackElem->children)
    505796    {
    506       if (this->currentTrackElem->jumpTime > 0)
     797      if (this->currentTrackElem->jumpTime != 0.0)
    507798        this->jumpTo(this->localTime + this->currentTrackElem->jumpTime);
    508       this->currentTrackElem = this->currentTrackElem->children[0];
     799      // jump to the next TrackElement and also set the history of the new Element to the old one.
     800      TrackElement* tmpHistoryElem = this->currentTrackElem;
     801      this->currentTrackElem = this->currentTrackElem->getChild(this->choosePath(this->currentTrackElem));
     802      this->currentTrackElem->history = tmpHistoryElem;
    509803    }
    510804  if (this->bindSlave)
     
    512806      Vector tmp = this->calcPos();
    513807      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));
     808
     809      Vector v(0.0, 1.0, 0.0);
     810      Quaternion q(-PI/2, v);
     811      quat = quat * q;
     812
    514813      this->bindSlave->setAbsCoor(&tmp);
    515814      this->bindSlave->setAbsDir(&quat);
     
    533832/**
    534833   \brief a Function that decides which Path we should follow.
    535    \param graphID The Path to choose.
     834   \param trackElem The Path to choose.
    536835   
    537836*/
    538 void TrackManager::choosePath(int graphID)
    539 {
    540 
     837int TrackManager::choosePath(TrackElement* trackElem)
     838{
     839  return (trackElem->*(trackElem->condFunc))(trackElem->subject);
    541840}
    542841
     
    547846void TrackManager::setBindSlave(PNode* bindSlave)
    548847{
    549   if (!this->bindSlave)
    550     this->bindSlave = bindSlave;
    551 }
    552 
     848  this->bindSlave = bindSlave;
     849}
     850
     851/**
     852   \returns the main TrackNode
     853*/
     854PNode* TrackManager::getTrackNode(void)
     855{
     856  return this->trackNode;
     857}
    553858
    554859// DEBUG //
     
    585890void TrackManager::debug(unsigned int level) const
    586891{
    587   printf("::CLASS TRACKMANAGER::debug information::\n");
    588   //  printf("Status is: %
    589   printf(" Consists of %d elements\n", this->trackElemCount);
    590   printf(" localTime is: %f\n", this->localTime);
     892  PRINT(0)("=========================================\n");
     893  PRINT(0)("= CLASS TRACKMANAGER::debug information =\n");
     894  PRINT(0)("=========================================\n");
     895  //  PRINT(0)("Status is: %
     896  PRINT(0)(" Consists of %d elements\n", this->trackElemCount);
     897  PRINT(0)(" localTime is: %f\n", this->localTime);
    591898  if (level >= 2)
    592899    {
     
    594901        {
    595902          TrackElement* tmpElem = this->findTrackElementByID(i);
    596           printf("  ::TrackElement:%i::", tmpElem->ID);
    597           if(tmpElem->name)
    598             printf("name:%s::", tmpElem->name);
    599           if(tmpElem->isFresh)
    600             printf("   has not jet eddited in any way\n");
    601           printf("\n   TimeTable: startingTime=%f; endTime=%f; duration=%f; jumpTime=%f\n", tmpElem->startingTime, tmpElem->endTime, tmpElem->duration, tmpElem->jumpTime);
    602           printf("   consists of %d Points\n", tmpElem->nodeCount);
    603           if (tmpElem->childCount == 0)
    604             printf("   has no child\n");           
    605           else if (tmpElem->childCount == 1)
    606             printf("   has 1 child: ==%d==\n", tmpElem->children[0]->ID);
    607           else if (tmpElem->childCount > 1)
    608             {
    609               printf("   has %d children: ", tmpElem->childCount);
    610               for(int i = 0; i < tmpElem->childCount; i++)
    611                 printf("=%d= ", tmpElem->children[i]->ID);
    612               printf("\n");
    613             }
    614 
    615           if(tmpElem->isHotPoint)
    616             printf("   is a special Point:\n");
    617           if(tmpElem->isSavePoint)
    618             printf("    is a SavePoint\n");
    619           if(tmpElem->isFork)
    620             {
    621               printf("    is A Fork with with %d children.\n", tmpElem->childCount);
    622             }
    623           if(tmpElem->isJoined)
    624             printf("   is Joined at the End\n");
     903          tmpElem->debug();
    625904        }
    626905    }
    627 }
     906  PRINT(0)("-----------------------------------------\n");
     907}
Note: See TracChangeset for help on using the changeset viewer.