Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8561


Ignore:
Timestamp:
May 24, 2011, 4:44:39 PM (13 years ago)
Author:
dafrick
Message:

Merging dockingsystem2 branch to presentation branch.

Location:
code/branches/presentation
Files:
7 edited
21 copied

Legend:

Unmodified
Added
Removed
  • code/branches/presentation

  • code/branches/presentation/src/modules/CMakeLists.txt

    r8457 r8561  
    3535ADD_SUBDIRECTORY(questsystem)
    3636ADD_SUBDIRECTORY(weapons)
     37ADD_SUBDIRECTORY(docking)
  • code/branches/presentation/src/modules/objects/triggers/MultiTrigger.cc

    r8213 r8561  
    312312
    313313        // We only want WorldEntities
    314         //TODO: Really?
    315314        ClassTreeMask WEMask;
    316315        WEMask.include(Class(WorldEntity));
  • code/branches/presentation/src/orxonox/controllers/ArtificialController.cc

    r8351 r8561  
    381381            }
    382382        }
     383
     384        if (distance < 10)
     385        {
     386            this->positionReached();
     387        }
    383388    }
    384389
     
    387392        this->moveToPosition(this->targetPosition_);
    388393    }
    389 
    390394
    391395    /**
  • code/branches/presentation/src/orxonox/controllers/ArtificialController.h

    r7163 r8561  
    9797            void moveToTargetPosition();
    9898
     99            virtual void positionReached() {}
     100
    99101            void removeFromFormation();
    100102            void unregisterSlave();
  • code/branches/presentation/src/orxonox/infos/PlayerInfo.cc

    r8327 r8561  
    5151        this->controllableEntity_ = 0;
    5252        this->controllableEntityID_ = OBJECTID_UNKNOWN;
    53         this->oldControllableEntity_ = 0;
    5453
    5554        this->gtinfo_ = 0;
     
    151150            return;
    152151
    153         if (this->oldControllableEntity_)
     152        while (this->previousControllableEntity_.size() > 0)
    154153            this->stopTemporaryControl();
     154       
    155155        if (this->controllableEntity_)
    156156            this->stopControl();
     
    176176        if (!entity)
    177177            return;
    178 
    179         assert( this->oldControllableEntity_==0 );
    180 
    181         this->oldControllableEntity_ = this->controllableEntity_;
     178       
     179        this->previousControllableEntity_.push_back(WeakPtr<ControllableEntity>(this->controllableEntity_));
    182180        this->controllableEntity_ = entity;
    183181        this->controllableEntityID_ = entity->getObjectID();
     
    194192    void PlayerInfo::stopControl()
    195193    {
    196         if ( this->oldControllableEntity_ )
     194        while ( this->previousControllableEntity_.size() > 0)
    197195            this->stopTemporaryControl();
    198196
     
    215213    }
    216214
     215    void PlayerInfo::pauseControl()
     216    {
     217        ControllableEntity* entity = this->controllableEntity_;
     218
     219        if (!entity)
     220            return;
     221
     222        this->controllableEntity_->getController()->setActive(false);
     223        //this->controllableEntity_->getController()->setControllableEntity(NULL);
     224        this->controllableEntity_->setController(0);
     225    }
     226
    217227    void PlayerInfo::stopTemporaryControl()
    218228    {
    219229        ControllableEntity* entity = this->controllableEntity_;
    220230
    221         assert( this->controllableEntity_ && this->oldControllableEntity_ );
    222         if( !entity || !this->oldControllableEntity_ )
     231        assert(this->controllableEntity_ != NULL);
     232        if( !entity || this->previousControllableEntity_.size() == 0 )
    223233            return;
    224234
    225235        this->controllableEntity_->setController(0);
    226236       
    227         this->controllableEntity_ = this->oldControllableEntity_;
     237//        this->controllableEntity_ = this->previousControllableEntity_.back();
     238        do {
     239            this->controllableEntity_ = this->previousControllableEntity_.back();
     240        } while(this->controllableEntity_ == NULL && this->previousControllableEntity_.size() > 0);
    228241        this->controllableEntityID_ = this->controllableEntity_->getObjectID();
    229         this->oldControllableEntity_ = 0;
    230 
    231         if ( this->controllableEntity_ && this->controller_)
     242        this->previousControllableEntity_.pop_back();
     243
     244        if ( this->controllableEntity_ != NULL && this->controller_ != NULL)
    232245            this->controller_->setControllableEntity(this->controllableEntity_);
    233246
  • code/branches/presentation/src/orxonox/infos/PlayerInfo.h

    r7163 r8561  
    6868            void startControl(ControllableEntity* entity);
    6969            void stopControl();
     70            void pauseControl();
    7071            void startTemporaryControl(ControllableEntity* entity);
    7172            void stopTemporaryControl();
     
    9899            Controller* controller_;
    99100            ControllableEntity* controllableEntity_;
    100             ControllableEntity* oldControllableEntity_;
     101            std::vector< WeakPtr<ControllableEntity> > previousControllableEntity_; //!< List of the previous ControllableEntities if repeatedly startTemporary control was called. The ControllableEntity at the back is the most recent.
    101102            unsigned int controllableEntityID_;
    102103
Note: See TracChangeset for help on using the changeset viewer.