Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 12, 2011, 4:36:30 PM (14 years ago)
Author:
kmaurus
Message:

several small improvements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.cc

    r8458 r8468  
    4747         * falls im XML-File keine Werte spezifiziert wurden. */
    4848        this->setMaxDistance(3000);
    49         this->setWarnDistance(2000);
    50         this->setShowDistance(2500);
    51         this->setHealthDecrease(1);
     49        this->setWarnDistance(this->getMaxDistance());
     50        this->setShowDistance(this->getMaxDistance());
    5251        this->setReaction(0);
    5352       
     
    8180        {
    8281            Pawn* currentPawn = *current;
    83             float distance = this->computeDistance(currentPawn);
    84             if(distance <= this->maxDistance_)
    85             {
     82            if( this->reaction_ == 0 )
     83            {
     84                float distance = this->computeDistance(currentPawn);
     85                if(distance <= this->maxDistance_)
     86                {
     87                    pawnsIn_.push_back(currentPawn);
     88                }
     89            } else {
    8690                pawnsIn_.push_back(currentPawn);
    8791            }
     
    183187        XMLPortParam(SpaceBoundaries, "maxDistance", setMaxDistance, getMaxDistance, xmlelement, mode);
    184188        XMLPortParam(SpaceBoundaries, "warnDistance", setWarnDistance, getWarnDistance, xmlelement, mode);
     189        XMLPortParam(SpaceBoundaries, "showDistance", setShowDistance, getShowDistance, xmlelement, mode);
    185190        XMLPortParam(SpaceBoundaries, "healthDecrease", setHealthDecrease, getHealthDecrease, xmlelement, mode);
    186191        XMLPortParam(SpaceBoundaries, "reactionMode", setReaction, getReaction, xmlelement, mode);
     
    191196        this->checkWhoIsIn();
    192197        this->removeAllBillboards();
    193         COUT(0) << "Groesse der Liste: " << (int) pawnsIn_.size() << std::endl;
     198        COUT(4) << "Groesse der Pawn-Liste 'SpaceBoundaries::pawnsIn_': " << (int) pawnsIn_.size() << std::endl;
    194199       
    195200        float distance;
     
    202207                distance = this->computeDistance(currentPawn);
    203208                humanItem = this->isHumanPlayer(currentPawn);
    204                 COUT(0) << "Distanz:" << distance << std::endl; // message for debugging
     209                COUT(5) << "Distanz:" << distance << std::endl; // message for debugging
    205210                if(distance > this->warnDistance_ && distance < this->maxDistance_) // Zeige Warnung an!
    206211                {
    207                     COUT(0) << "You are near by the boundaries!" << std::endl; // message for debugging
    208212                    if(humanItem)
    209213                    {
    210                         COUT(0) << "humanItem ist true" << std::endl;
    211                         this->displayWarning("Attention! You are near by the boundaries!");
     214                        COUT(5) << "humanItem ist true" << std::endl;
     215                        this->displayWarning("Attention! You are close to the boundary!");
    212216                    }
    213217                }
    214                 if( (this->maxDistance_ - distance) < this->showDistance_ )
     218                if( humanItem && (this->maxDistance_ - distance) < this->showDistance_ )
    215219                {
    216220                    this->displayBoundaries(currentPawn); // Zeige Grenze an!
     
    220224                    if( humanItem )
    221225                    {
    222                         COUT(0) << "Health should be decreasing!" << std::endl;
     226                        COUT(5) << "Health should be decreasing!" << std::endl;
    223227                        this->displayWarning("You are out of the area now!");
    224228                    }
     
    269273        /* Checke, ob das Pawn innerhalb des nächsten Ticks, das erlaubte Gebiet verlassen würde.
    270274           Falls ja: Spicke es zurück. */
    271         if( currentDistance + normalSpeed * dt > this->maxDistance_ )
     275        if( currentDistance + normalSpeed * dt > this->maxDistance_ - 10 ) // -10: "security measure"
    272276        {
    273277            float dampingFactor = 0.5;
Note: See TracChangeset for help on using the changeset viewer.