Changeset 3605 in orxonox.OLD for orxonox/branches/levelloader/src/track_manager.cc
- Timestamp:
- Mar 18, 2005, 11:52:15 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/levelloader/src/track_manager.cc
r3562 r3605 14 14 */ 15 15 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_TRACK_MANAGER 16 17 17 18 #include "track_manager.h" … … 19 20 #include "p_node.h" 20 21 #include "substring.h" 22 23 #include "track_node.h" 21 24 22 25 #include <stdarg.h> … … 35 38 this->isJoined = false; 36 39 this->mainJoin = false; 37 this->cond; //!< todo think!!38 40 this->ID = -1; 39 this->startingTime = 0; //!< \todo eventually set this to the max time of TrackManager.40 this->duration = 1;41 this->startingTime = 0; 42 this->duration = TMAN_DEFAULT_DURATION; 41 43 this->endTime = 1; 42 44 this->jumpTime = 0; 43 this-> curveType = BEZIERCURVE;45 this->width = TMAN_DEFAULT_WIDTH; 44 46 this->nodeCount = 0; 45 47 this->childCount = 0; … … 47 49 this->curve = NULL; 48 50 this->children = NULL; 51 52 this->history = NULL; 53 54 this->condFunc = &TrackElement::random; 49 55 } 50 56 … … 61 67 if ((!this->isJoined &&this->childCount > 0) || (this->isJoined && this->mainJoin)) 62 68 { 63 for (int i=0; i < this->childCount; i++) 64 delete this->children[i]; 69 TrackElement* enumElem = children->enumerate(); 70 while (enumElem) 71 { 72 delete enumElem; 73 enumElem = children->nextElement(); 74 } 65 75 delete this->children; 66 76 } … … 81 91 // search on. 82 92 if (this->childCount > 0) 83 for (int i=0; i < this->childCount; i++) 84 { 85 TrackElement* tmpElem; 86 if ((tmpElem = this->children[i]->findByID(trackID))) 87 return tmpElem; 88 } 89 else return NULL; 90 } 91 92 /** 93 \brief Sets the name of this TrackElement 94 \param trackName The new name for this element 95 */ 96 void TrackElement::setName(const char* trackName) 97 { 98 if( this->name != NULL) delete this->name; 99 100 this->name = new char[strlen(trackName) + 1]; 101 strcpy( this->name, trackName); 93 { 94 TrackElement* enumElem = this->children->enumerate(); 95 TrackElement* tmpElem; 96 while (enumElem) 97 { 98 if ((tmpElem = enumElem->findByID(trackID))) 99 return tmpElem; 100 enumElem = this->children->nextElement(); 101 } 102 } 103 else 104 return NULL; 102 105 } 103 106 … … 116 119 // search on. 117 120 if (this->childCount > 0) 118 for (int i=0; i < this->childCount; i++) 119 { 120 TrackElement* tmpElem; 121 if ((tmpElem = this->children[i]->findByName(trackName))) 122 return tmpElem; 123 } 124 else return NULL; 125 } 126 127 128 129 130 ///////////////////////////////////// 131 ///// TRACKMANAGER ////////////////// 132 ///////////////////////////////////// 121 { 122 123 TrackElement* enumElem = this->children->enumerate(); 124 TrackElement* tmpElem; 125 while (enumElem) 126 { 127 if ((tmpElem = enumElem->findByName(trackName))) 128 return tmpElem; 129 enumElem = this->children->nextElement(); 130 } 131 } 132 else 133 return NULL; 134 } 135 136 /** 137 \brief checks if there are any BackLoops in the Track 138 \param trackElem the trackElement to check about 139 it simply does this by looking if the current trackElem is found again somewhere else in the Track 140 */ 141 bool TrackElement::backLoopCheck(TrackElement* trackElem) 142 { 143 if (this->childCount == 0) 144 return true; 145 else 146 { 147 TrackElement* enumElem = this->children->enumerate(); 148 while (enumElem) 149 { 150 if(!enumElem->backLoopCheck(trackElem)) 151 return false; 152 enumElem = this->children->nextElement(); 153 } 154 155 return true; 156 } 157 } 158 159 /** 160 \param childNumber which child to return 161 \returns the n-the children (starting at 0) 162 */ 163 TrackElement* TrackElement::getChild(int childCount) 164 { 165 if (this->childCount == 0) 166 return NULL; 167 if (childCount > this->childCount) 168 childCount = this->childCount; 169 170 TrackElement* enumElem = this->children->enumerate(); 171 for (int i = 0; i < childCount; i++) 172 enumElem = this->children->nextElement(); 173 return enumElem; 174 } 175 176 /** 177 \param name the Name to set. 178 */ 179 void TrackElement::setName(const char* name) 180 { 181 // delete the old name 182 if (this->name) 183 delete []this->name; 184 // if a name was given already. 185 if (name) 186 { 187 this->name = new char[strlen(name)+1]; 188 strcpy(this->name, name); 189 } 190 else 191 this->name = NULL; 192 } 193 194 /** 195 \returns The name of this TrackElement 196 */ 197 char* TrackElement::getName(void) const 198 { 199 return this->name; 200 } 201 202 /** 203 \brief prints out debug information about this TrackElement 204 */ 205 void TrackElement::debug(void) 206 { 207 PRINT(0)("--== TrackElement:%i ==--", this->ID); 208 if(this->getName()) 209 PRINT(0)("Name: %s::", this->getName()); 210 if(this->isFresh) 211 PRINT(0)(" -- has not jet eddited in any way --\n"); 212 PRINT(0)("\n TimeTable: startingTime=%f; endTime=%f; duration=%f; jumpTime=%f\n", this->startingTime, this->endTime, this->duration, this->jumpTime); 213 PRINT(0)(" consists of %d Points\n", this->nodeCount); 214 if (this->childCount == 0) 215 PRINT(0)(" has no child\n"); 216 else if (this->childCount == 1) 217 PRINT(0)(" has 1 child: =%d=\n", this->getChild(0)->ID); 218 else if (this->childCount > 1) 219 { 220 PRINT(0)(" has %d children: ", this->childCount); 221 TrackElement* enumElem = this->children->enumerate(); 222 while (enumElem) 223 { 224 PRINT(0)("=%d= ", enumElem->ID); 225 enumElem = this->children->nextElement(); 226 } 227 PRINT(0)("\n"); 228 } 229 230 if(this->isHotPoint) 231 PRINT(0)(" is a special Point:\n"); 232 if(this->isSavePoint) 233 PRINT(0)(" is a SavePoint\n"); 234 if(this->isFork) 235 { 236 PRINT(0)(" is A Fork with with %d children.\n", this->childCount); 237 } 238 if(this->isJoined) 239 PRINT(0)(" is Joined at the End\n"); 240 241 if(!this->backLoopCheck(this)) /* this should not happen */ 242 PRINT(2)(" THERE IS A BACKLOOP TO THIS ELEMENT\n"); 243 } 244 245 /** 246 \brief CONDITION that chooses the first child for the decision (static) 247 \param nothing Nothing in this function 248 \returns the chosen child 249 */ 250 int TrackElement::lowest(void* nothing) 251 { 252 return 0; 253 } 254 255 /** 256 \brief CONDITION that chooses the last child for the decision (static) 257 \param nothing Nothing in this function 258 \returns the chosen child 259 */ 260 int TrackElement::highest(void* nothing) 261 { 262 return this->childCount-1; 263 } 264 265 /** 266 \brief CONDITION that chooses a random child for the decision (static) 267 \param nothing Nothing in this function 268 \returns the chosen child 269 */ 270 int TrackElement::random(void* nothing) 271 { 272 int i = (int)floor ((float)rand()/(float)RAND_MAX * (float)this->childCount); 273 if (i >= this->childCount) 274 return this->childCount-1; 275 else 276 return i; 277 } 278 279 /** 280 \brief CONDITION that chooses child 0, if the node(probably Player) 281 is left of its parent (z<0)) and 1/right otherwise. 282 \param node The node to act upon. 283 \returns the chosen child 284 */ 285 int TrackElement::leftRight(void* node) 286 { 287 PNode* tmpNode = (PNode*)node; 288 289 if (tmpNode->getRelCoor().z < 0) 290 return 0; 291 else 292 return 1; 293 } 294 295 296 /** 297 \brief CONDITION that chooses the child, that has the nearest distance to the node (probably player). 298 \param node The node to act upon. 299 \returns the chosen child 300 301 This is rather dangerous, because one must carefully set the points on the curve. 302 The best Way is to set the nodes as wide away of each other as possible, 303 but take into consideration, that if the nodes are to far from a center node, the center will be chosen. 304 (play with this!!). 305 */ 306 int TrackElement::nearest(void* node) 307 { 308 PNode* tmpNode = (PNode*)node; 309 310 Vector nodeRelCoord = tmpNode->getRelCoor(); 311 float minDist = 100000000; 312 int childNumber = 0; 313 int i = 0; 314 315 TrackElement* enumElem = this->children->enumerate(); 316 while (enumElem) 317 { 318 float dist = (nodeRelCoord - enumElem->curve->getNode(4)).len(); 319 if (dist < minDist) 320 { 321 minDist = dist; 322 childNumber = i; 323 } 324 i++; 325 enumElem = this->children->nextElement(); 326 } 327 328 PRINTF(4)("PathDecision with nearest algorithm: %d\n", childNumber); 329 return childNumber; 330 } 331 332 333 //////////////////////// 334 ///// TRACKMANAGER ///// 335 //////////////////////// 133 336 /** 134 337 \brief standard constructor … … 137 340 TrackManager::TrackManager(void) 138 341 { 139 this->setClassName ("TrackManager"); 342 this->setClassName("TrackManager"); 343 344 TrackManager::singletonRef = this; 140 345 141 346 PRINTF(3)("Initializing the TrackManager\n"); … … 146 351 this->maxTime = 0; 147 352 this->trackElemCount = 1; 148 this-> bindSlave = NULL;353 this->setBindSlave(this->trackNode = new TrackNode()); 149 354 } 150 355 … … 152 357 /** 153 358 \brief standard destructor 154 155 359 */ 156 360 TrackManager::~TrackManager(void) … … 158 362 PRINTF(3)("Destruct TrackManager\n"); 159 363 160 PRINTF( 3)("Deleting all the TrackElements\n");364 PRINTF(4)("Deleting all the TrackElements\n"); 161 365 delete this->firstTrackElem; 162 366 // delete this->name; 163 367 164 368 // we do not have a TrackManager anymore 165 singletonRef = NULL; 166 } 167 369 TrackManager::singletonRef = NULL; 370 } 371 372 //! Singleton Reference to TrackManager 168 373 TrackManager* TrackManager::singletonRef = NULL; 169 374 … … 175 380 TrackManager* TrackManager::getInstance(void) 176 381 { 177 if (singletonRef) 178 return singletonRef; 179 else 180 return singletonRef = new TrackManager(); 382 if (!TrackManager::singletonRef) 383 TrackManager::singletonRef = new TrackManager(); 384 return TrackManager::singletonRef; 181 385 } 182 386 … … 189 393 this->currentTrackElem->childCount = childCount; 190 394 this->currentTrackElem->mainJoin = true; 191 this->currentTrackElem->children = new TrackElement*[childCount];192 for (int i =0; i<childCount; i++)193 { 194 195 this->currentTrackElem->children [i] = new TrackElement();196 this->currentTrackElem->children[i]->ID = ++trackElemCount;197 this->currentTrackElem->children[i]->startingTime = this->currentTrackElem->endTime + this->currentTrackElem->jumpTime;198 this->addPoint(this->currentTrackElem->curve->getNode(this->currentTrackElem->curve->getNodeCount()), this->currentTrackElem-> children[i]);199 395 this->currentTrackElem->children = new tList<TrackElement>(); 396 for (int i = 0; i < childCount; i++) 397 { 398 TrackElement* newElem = new TrackElement(); 399 this->currentTrackElem->children->add(newElem); 400 newElem->ID = ++trackElemCount; 401 newElem->startingTime = this->currentTrackElem->endTime + this->currentTrackElem->jumpTime; 402 this->addPoint(this->currentTrackElem->curve->getNode(this->currentTrackElem->curve->getNodeCount()), this->currentTrackElem->getChild(i)); 403 if( names != NULL) 200 404 { 201 202 203 204 205 this->currentTrackElem->children[i]->setName(names->getString(i));206 405 // todo check for duplicate track names to avoid confusion 406 /*if( this->findTrackElementByName( names->getString(i)) != NULL) 407 PRINTF0("Track name '%s' already taken", names->getString(i)); 408 else*/ 409 this->currentTrackElem->getChild(i)->setName(names->getString(i)); 410 } 207 411 208 412 } 413 if (childCount == 1) 414 this->currentTrackElem->getChild(0)->setName(this->currentTrackElem->getName()); 209 415 } 210 416 … … 240 446 this->currentTrackElem = tmpElem; 241 447 else 242 printf("TrackElement not Found, leaving unchanged\n");243 printf("now Working on %d\n", this->currentTrackElem->ID);448 PRINTF(2)("TrackElement not Found, leaving unchanged\n"); 449 PRINTF(4)("now Working on %d\n", this->currentTrackElem->ID); 244 450 245 451 } … … 247 453 /** 248 454 \brief Sets the Type of the Curve 249 \brief curveType The Type to set 455 \param curveType The Type to set 456 \param trackElem the TrackElement that should get a new Curve. 250 457 */ 251 458 void TrackManager::setCurveType(CurveType curveType, TrackElement* trackElem) … … 256 463 return; 257 464 } 258 t rackElem->curveType = curveType;465 this->curveType = curveType; 259 466 switch (curveType) 260 467 { … … 262 469 trackElem->curve = new BezierCurve(); 263 470 break; 264 case UPOINTCURVE: 265 trackElem->curve = new UPointCurve(); 266 break; 471 267 472 } 268 473 } … … 297 502 if (trackElem->isFresh) 298 503 { 299 this->setCurveType( BEZIERCURVE, trackElem);504 this->setCurveType(TMAN_DEFAULT_CURVETYPE, trackElem); 300 505 trackElem->isFresh = false; 301 506 } … … 311 516 int TrackManager::addHotPoint(Vector newPoint) 312 517 { 313 printf("setting up a HotPoint\n");518 PRINTF(4)("setting up a HotPoint\n"); 314 519 if (this->currentTrackElem->isFresh) 315 520 { … … 322 527 this->currentTrackElem->nodeCount++; 323 528 this->initChildren(1); 324 this->currentTrackElem = this->currentTrackElem-> children[0];529 this->currentTrackElem = this->currentTrackElem->getChild(0); 325 530 } 326 531 … … 334 539 int TrackManager::setSavePoint(void) 335 540 { 336 printf("setting up a SavePoint.\n");541 PRINTF(4)("setting up a SavePoint.\n"); 337 542 if (this->currentTrackElem->isFork || this->currentTrackElem->isSavePoint) 338 return this->currentTrackElem->children[1]->ID; 543 { 544 PRINTF(2)("%d is already finished \n", currentTrackElem->ID); 545 return this->currentTrackElem->getChild(0)->ID; 546 } 339 547 this->currentTrackElem->isSavePoint = true; 340 548 this->currentTrackElem->isHotPoint = true; 341 549 342 550 this->initChildren(1); 343 this->currentTrackElem = this->currentTrackElem-> children[0];551 this->currentTrackElem = this->currentTrackElem->getChild(0); 344 552 } 345 553 … … 377 585 void TrackManager::forkV(unsigned int count, int* trackIDs, SubString* names) 378 586 { 379 printf("Forking with %d children\n", count);587 PRINTF(4)("Forking with %d children\n", count); 380 588 if (this->currentTrackElem->isSavePoint) 381 589 { … … 392 600 /** 393 601 \brief decides under what condition a certain Path will be chosen. 602 \param cond the CONDITION of the decision 603 \param subject the Subject that will be decided upon with CONDITION cond. 604 */ 605 void TrackManager::condition(CONDITION cond, void* subject) 606 { 607 this->condition(this->currentTrackElem->ID, cond, subject); 608 } 609 /** 610 \brief decides under what condition a certain Path will be chosen. 394 611 \param groupID the ID on which to choose the preceding move 395 \param cond \todo think about this 396 */ 397 void TrackManager::condition(unsigned int groupID, PathCondition cond) 398 { 399 400 } 612 \param cond the CONDITION of the decision 613 \param subject the Subject that will be decided upon with CONDITION cond. 614 */ 615 void TrackManager::condition(unsigned int groupID, CONDITION cond, void* subject) 616 { 617 TrackElement* tmpElem = this->findTrackElementByID(groupID); 618 if (!tmpElem->isFork) 619 { 620 PRINTF(2)("%d is not a Fork, and no condition can be set in this case\n", tmpElem->ID); 621 return; 622 } 623 else 624 { 625 switch (cond) 626 { 627 case LOWEST: 628 tmpElem->condFunc = &TrackElement::lowest; 629 break; 630 case HIGHEST: 631 tmpElem->condFunc = &TrackElement::highest; 632 break; 633 case RANDOM: 634 tmpElem->condFunc = &TrackElement::random; 635 break; 636 case LEFTRIGHT: 637 tmpElem->condFunc = &TrackElement::leftRight; 638 break; 639 case NEAREST: 640 tmpElem->condFunc = &TrackElement::nearest; 641 break; 642 case ENEMYKILLED: 643 break; 644 } 645 tmpElem->subject=subject; 646 } 647 } 648 401 649 402 650 /** … … 430 678 void TrackManager::joinV(unsigned int count, int* trackIDs) 431 679 { 432 printf("Joining %d tracks and merging to Track %d\n", count, trackIDs[0]); 680 PRINTF(3)("Joining %d tracks and merging to Track %d\n", count, trackIDs[0]); 681 682 // checking if there is a back-loop-connection and ERROR if it is. 683 TrackElement* tmpTrackElem = this->findTrackElementByID(trackIDs[0]); 684 if (!tmpTrackElem->backLoopCheck(tmpTrackElem)) 685 PRINTF(2)("Backloop connection detected at joining trackElements\n"); 433 686 434 687 // chanching work-on to temporary value. going back at the end. … … 480 733 } 481 734 if(firstJoint->childCount > 0) 482 for(int i = 0; i < firstJoint->childCount; i++) 483 { 484 printf("Setting startingTime of %d to %f.\n", firstJoint->children[i]->ID, tmpLatestTime); 485 firstJoint->children[i]->startingTime = tmpLatestTime; 486 firstJoint->children[i]->endTime = tmpLatestTime+firstJoint->children[i]->duration; 487 } 488 735 { 736 TrackElement* enumElem = firstJoint->children->enumerate(); 737 while (enumElem) 738 { 739 PRINTF(4)("Setting startingTime of %d to %f.\n", enumElem->ID, tmpLatestTime); 740 enumElem->startingTime = tmpLatestTime; 741 enumElem->endTime = tmpLatestTime + enumElem->duration; 742 743 enumElem = firstJoint->children->nextElement(); 744 } 745 } 489 746 // returning to the TrackElement we were working on. 490 747 this->workOn(tmpCurrentWorkingID); … … 501 758 { 502 759 TrackElement* tmpElem = findTrackElementByID(i); 503 if (tmpElem->childCount>0 && tmpElem->mainJoin) 504 { 505 for (int j = 0; j < tmpElem->childCount; j++) 760 if (tmpElem->childCount > 0 && tmpElem->mainJoin) 761 { 762 763 TrackElement* enumElem = tmpElem->children->enumerate(); 764 while (enumElem) 506 765 { 507 766 508 767 // c1-continuity 509 tmpElem->children[j]->curve->addNode(tmpElem->children[j]->curve->getNode(0) +510 (( tmpElem->children[j]->curve->getNode(0) -768 enumElem->curve->addNode(enumElem->curve->getNode(0) + 769 ((enumElem->curve->getNode(0) - 511 770 tmpElem->curve->getNode(tmpElem->curve->getNodeCount()-1)) 512 771 ),2); 513 tmpElem->children[j]->nodeCount++;772 enumElem->nodeCount++; 514 773 // c2-continuity 515 tmpElem->children[j]->curve->addNode((tmpElem->curve->getNode(tmpElem->curve->getNodeCount())-774 enumElem->curve->addNode((tmpElem->curve->getNode(tmpElem->curve->getNodeCount())- 516 775 tmpElem->curve->getNode(tmpElem->curve->getNodeCount()-1)) * 4 + 517 776 tmpElem->curve->getNode(tmpElem->curve->getNodeCount()-2), 3); 518 tmpElem->children[j]->nodeCount++;519 printf("accelerations: %d-in: count: %d, %f, %f, %f\n %d-out: count: %d %f, %f, %f\n",777 enumElem->nodeCount++; 778 PRINTF(5)("accelerations: %d-in: count: %d, %f, %f, %f\n %d-out: count: %d %f, %f, %f\n", 520 779 tmpElem->ID, tmpElem->nodeCount, 521 780 tmpElem->curve->calcAcc(0.999).x, tmpElem->curve->calcAcc(0.999).y, tmpElem->curve->calcAcc(0.999).z, 522 tmpElem->children[j]->ID, tmpElem->children[j]->nodeCount, 523 tmpElem->children[j]->curve->calcAcc(0).x, tmpElem->children[j]->curve->calcAcc(0).y, tmpElem->children[j]->curve->calcAcc(0).z); 781 enumElem->ID, enumElem->nodeCount, 782 enumElem->curve->calcAcc(0).x, enumElem->curve->calcAcc(0).y, enumElem->curve->calcAcc(0).z); 783 784 enumElem = tmpElem->children->nextElement(); 524 785 } 525 786 } 526 787 } 788 for (int i = 1; i <=trackElemCount;i++) 789 if (this->findTrackElementByID(i)->endTime > this->maxTime) 790 this->maxTime = findTrackElementByID(i)->endTime; // very bad implemented :/ 527 791 } 528 792 … … 536 800 Vector TrackManager::calcPos() const 537 801 { 538 // PRINTF(0)("TrackElement:%d, localTime: %f\n",this->currentTrackElem->ID, this->localTime);539 802 return this->currentTrackElem->curve->calcPos((this->localTime-this->currentTrackElem->startingTime)/this->currentTrackElem->duration); 540 803 } … … 550 813 551 814 /** 815 \returns the current Width of the track 816 */ 817 float TrackManager::getWidth(void) const 818 { 819 return this->currentTrackElem->width; 820 } 821 822 /** 552 823 \brief Advances the local-time of the Track around dt 553 824 \param dt The time about which to advance. … … 558 829 { 559 830 dt /= 1000; 560 printf("CurrentTrackID: %d, LocalTime is: %f, timestep is: %f\n", this->currentTrackElem->ID, this->localTime, dt);831 PRINTF(4)("CurrentTrackID: %d, LocalTime is: %f, timestep is: %f\n", this->currentTrackElem->ID, this->localTime, dt); 561 832 if (this->localTime <= this->firstTrackElem->duration) 562 833 this->jumpTo(this->localTime); 563 this->localTime += dt; 834 if (this->localTime <= this->maxTime) 835 this->localTime += dt; 564 836 if (this->localTime > this->currentTrackElem->endTime 565 837 && this->currentTrackElem->children) 566 838 { 567 if (this->currentTrackElem->jumpTime > 0)839 if (this->currentTrackElem->jumpTime != 0.0) 568 840 this->jumpTo(this->localTime + this->currentTrackElem->jumpTime); 569 this->currentTrackElem = this->currentTrackElem->children[0]; 841 // jump to the next TrackElement and also set the history of the new Element to the old one. 842 TrackElement* tmpHistoryElem = this->currentTrackElem; 843 this->currentTrackElem = this->currentTrackElem->getChild(this->choosePath(this->currentTrackElem)); 844 this->currentTrackElem->history = tmpHistoryElem; 570 845 } 571 846 if (this->bindSlave) … … 573 848 Vector tmp = this->calcPos(); 574 849 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)); 850 851 Vector v(0.0, 1.0, 0.0); 852 Quaternion q(-PI/2, v); 853 quat = quat * q; 854 575 855 this->bindSlave->setAbsCoor(&tmp); 576 856 this->bindSlave->setAbsDir(&quat); … … 594 874 /** 595 875 \brief a Function that decides which Path we should follow. 596 \param graphIDThe Path to choose.876 \param trackElem The Path to choose. 597 877 598 878 */ 599 void TrackManager::choosePath(int graphID)600 { 601 879 int TrackManager::choosePath(TrackElement* trackElem) 880 { 881 return (trackElem->*(trackElem->condFunc))(trackElem->subject); 602 882 } 603 883 … … 608 888 void TrackManager::setBindSlave(PNode* bindSlave) 609 889 { 610 if (!this->bindSlave) 611 this->bindSlave = bindSlave; 612 } 613 890 this->bindSlave = bindSlave; 891 } 892 893 /** 894 \returns the main TrackNode 895 */ 896 PNode* TrackManager::getTrackNode(void) 897 { 898 return this->trackNode; 899 } 614 900 615 901 // DEBUG // … … 646 932 void TrackManager::debug(unsigned int level) const 647 933 { 648 printf("::CLASS TRACKMANAGER::debug information::\n"); 649 // printf("Status is: % 650 printf(" Consists of %d elements\n", this->trackElemCount); 651 printf(" localTime is: %f\n", this->localTime); 934 PRINT(0)("=========================================\n"); 935 PRINT(0)("= CLASS TRACKMANAGER::debug information =\n"); 936 PRINT(0)("=========================================\n"); 937 // PRINT(0)("Status is: % 938 PRINT(0)(" Consists of %d elements\n", this->trackElemCount); 939 PRINT(0)(" localTime is: %f\n", this->localTime); 652 940 if (level >= 2) 653 941 { … … 655 943 { 656 944 TrackElement* tmpElem = this->findTrackElementByID(i); 657 printf(" ::TrackElement:%i::", tmpElem->ID); 658 if(tmpElem->name) 659 printf("name:%s::", tmpElem->name); 660 if(tmpElem->isFresh) 661 printf(" has not jet eddited in any way\n"); 662 printf("\n TimeTable: startingTime=%f; endTime=%f; duration=%f; jumpTime=%f\n", tmpElem->startingTime, tmpElem->endTime, tmpElem->duration, tmpElem->jumpTime); 663 printf(" consists of %d Points\n", tmpElem->nodeCount); 664 if (tmpElem->childCount == 0) 665 printf(" has no child\n"); 666 else if (tmpElem->childCount == 1) 667 printf(" has 1 child: ==%d==\n", tmpElem->children[0]->ID); 668 else if (tmpElem->childCount > 1) 669 { 670 printf(" has %d children: ", tmpElem->childCount); 671 for(int i = 0; i < tmpElem->childCount; i++) 672 printf("=%d= ", tmpElem->children[i]->ID); 673 printf("\n"); 674 } 675 676 if(tmpElem->isHotPoint) 677 printf(" is a special Point:\n"); 678 if(tmpElem->isSavePoint) 679 printf(" is a SavePoint\n"); 680 if(tmpElem->isFork) 681 { 682 printf(" is A Fork with with %d children.\n", tmpElem->childCount); 683 } 684 if(tmpElem->isJoined) 685 printf(" is Joined at the End\n"); 686 } 687 } 945 tmpElem->debug(); 946 } 947 } 948 PRINT(0)("-----------------------------------------\n"); 688 949 } 689 950
Note: See TracChangeset
for help on using the changeset viewer.