Changeset 3837 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Apr 15, 2005, 6:10:45 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/track_manager.cc
r3836 r3837 452 452 if (childCount == 1) 453 453 trackElem->getChild(0)->setName(trackElem->getName()); 454 455 // select the first Child to work on. 456 this->currentTrackElem = trackElem->getChild(0); 454 457 } 455 458 … … 558 561 trackElem->curve->addNode(newPoint); 559 562 trackElem->nodeCount++; 560 this->initChildren(1); 561 this->currentTrackElem = this->currentTrackElem->getChild(0); 563 this->initChildren(1, trackElem); 562 564 } 563 565 564 566 /** 565 567 \brief Sets the last HotPoint into a savePoint. 568 \param trackElem The TrackElement to appy this to. (if NULL chose this->currentTrackElement) 566 569 \returns A Pointer to a newly appended Curve 567 570 568 571 If no HotPoint was defined the last added Point will be rendered into a savePoint. \n 569 572 If the HotPoint was defined as a fork the Point will \b not be set into a savePoint. 570 573 */ 571 int TrackManager::setSavePoint(void) 572 { 574 int TrackManager::setSavePoint(TrackElement* trackElem) 575 { 576 if (!trackElem) 577 trackElem = this->currentTrackElem; 578 573 579 PRINTF(4)("setting up a SavePoint.\n"); 574 if (this->currentTrackElem->isFork || this->currentTrackElem->isSavePoint) 575 { 576 PRINTF(2)("%d is already finished \n", currentTrackElem->ID); 577 return this->currentTrackElem->getChild(0)->ID; 578 } 579 this->currentTrackElem->isSavePoint = true; 580 this->currentTrackElem->isHotPoint = true; 581 582 this->initChildren(1); 583 this->currentTrackElem = this->currentTrackElem->getChild(0); 580 if (trackElem->isFork || trackElem->isSavePoint) 581 { 582 PRINTF(2)("%d is already finished \n", trackElem->ID); 583 return trackElem->getChild(0)->ID; 584 } 585 trackElem->isSavePoint = true; 586 trackElem->isHotPoint = true; 587 588 this->initChildren(1, trackElem); 584 589 } 585 590 … … 609 614 \param count The Count of childrens the current HotPoint will have. 610 615 \param trackIDs A Pointer to an Array of ints which will hold the trackID's (the user will have to reserve space for this). 611 612 \see void TrackManager::fork(int count, ...) 613 614 \todo initialisation is wrong!! also in setSavePoint. 615 */ 616 void TrackManager::forkV(unsigned int count, int* trackIDs) 617 { 616 \param trackElem The TrackElement to appy this to. (if NULL chose this->currentTrackElement) 617 */ 618 void TrackManager::forkV(unsigned int count, int* trackIDs, TrackElement* trackElem) 619 { 620 if (!trackElem) 621 trackElem = this->currentTrackElem; 622 618 623 PRINTF(4)("Forking with %d children\n", count); 619 if (t his->currentTrackElem->isSavePoint)624 if (trackElem->isSavePoint) 620 625 return; 621 t his->currentTrackElem->isFork = true;622 t his->currentTrackElem->isHotPoint = true;626 trackElem->isFork = true; 627 trackElem->isHotPoint = true; 623 628 for(int i = 0; i < count; i++) 624 629 trackIDs[i]=this->trackElemCount+1+i; 625 this->initChildren(count); 630 this->initChildren(count, trackElem); 631 } 632 633 /** 634 \brief decides under what condition a certain Path will be chosen. 635 \param trackID the trackID to apply this to. 636 \param cond the CONDITION of the decision 637 \param subject the Subject that will be decided upon with CONDITION cond. 638 */ 639 void TrackManager::condition(unsigned int trackID, CONDITION cond, void* subject) 640 { 641 this->condition(cond, subject, this->firstTrackElem->findByID(trackID)); 626 642 } 627 643 … … 630 646 \param cond the CONDITION of the decision 631 647 \param subject the Subject that will be decided upon with CONDITION cond. 632 */ 633 void TrackManager::condition(CONDITION cond, void* subject) 634 { 635 this->condition(this->currentTrackElem->ID, cond, subject); 636 } 637 /** 638 \brief decides under what condition a certain Path will be chosen. 639 \param groupID the ID on which to choose the preceding move 640 \param cond the CONDITION of the decision 641 \param subject the Subject that will be decided upon with CONDITION cond. 642 */ 643 void TrackManager::condition(unsigned int groupID, CONDITION cond, void* subject) 644 { 645 TrackElement* tmpElem = this->firstTrackElem->findByID(groupID); 646 if (!tmpElem->isFork) 647 { 648 PRINTF(2)("%d is not a Fork, and no condition can be set in this case\n", tmpElem->ID); 648 \param trackElem The TrackElement to appy this to. (if NULL chose this->currentTrackElement) 649 */ 650 void TrackManager::condition(CONDITION cond, void* subject, TrackElement* trackElem) 651 { 652 if (!trackElem) 653 trackElem = this->currentTrackElem; 654 655 if (!trackElem->isFork) 656 { 657 PRINTF(2)("%d is not a Fork, and no condition can be set in this case\n", trackElem->ID); 649 658 return; 650 659 } … … 654 663 { 655 664 case LOWEST: 656 t mpElem->condFunc = &TrackElement::lowest;665 trackElem->condFunc = &TrackElement::lowest; 657 666 break; 658 667 case HIGHEST: 659 t mpElem->condFunc = &TrackElement::highest;668 trackElem->condFunc = &TrackElement::highest; 660 669 break; 661 670 case RANDOM: 662 t mpElem->condFunc = &TrackElement::random;671 trackElem->condFunc = &TrackElement::random; 663 672 break; 664 673 case LEFTRIGHT: 665 t mpElem->condFunc = &TrackElement::leftRight;674 trackElem->condFunc = &TrackElement::leftRight; 666 675 break; 667 676 case NEAREST: 668 t mpElem->condFunc = &TrackElement::nearest;677 trackElem->condFunc = &TrackElement::nearest; 669 678 break; 670 679 case ENEMYKILLED: 671 680 break; 672 681 } 673 t mpElem->subject=subject;682 trackElem->subject=subject; 674 683 } 675 684 } -
orxonox/trunk/src/track_manager.h
r3836 r3837 156 156 bool addPoint(Vector newPoint, TrackElement* trackElem = NULL); 157 157 int addHotPoint(Vector newPoint, TrackElement* trackElem = NULL); 158 int setSavePoint( void);158 int setSavePoint(TrackElement* trackElem = NULL); 159 159 void fork(unsigned int count, ...); 160 void forkV(unsigned int count, int* trackIDs );161 void condition( CONDITION cond, void* subject);162 void condition( unsigned int groupID, CONDITION cond, void* subject);160 void forkV(unsigned int count, int* trackIDs, TrackElement* trackElem = NULL); 161 void condition(unsigned int trackID, CONDITION cond, void* subject); 162 void condition(CONDITION cond, void* subject, TrackElement* trackElem = NULL); 163 163 void join(unsigned int count, ...); 164 164 void joinV(unsigned int count, int* trackIDs);
Note: See TracChangeset
for help on using the changeset viewer.