Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 24, 2011, 10:41:43 PM (14 years ago)
Author:
dafrick
Message:

Renaming member variables to adhere to styleguide, initialize values, always select an item in the DockingDialog.

Location:
code/branches/presentation
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/data/gui/scripts/DockingDialog.lua

    r8561 r8568  
    4444        item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
    4545        listbox:addItem(item)
     46        if k == 1 then
     47            listbox:setItemSelectState(item, true)
     48        end
    4649    end
    4750end
  • code/branches/presentation/src/modules/docking/DockToShip.cc

    r8561 r8568  
    5959
    6060    void DockToShip::setTargetId(const std::string& str) {
    61         this->target = str;
     61        this->target_ = str;
    6262    }
    6363
    6464    const std::string& DockToShip::getTargetId() const {
    65         return this->target;
     65        return this->target_;
    6666    }
    6767
     
    7171        COUT(4) << "DockToShip::attach" << endl;
    7272
    73         DockingTarget *target = DockingEffect::findTarget(this->target);
     73        DockingTarget *target = DockingEffect::findTarget(this->target_);
    7474        if (target == NULL) {
    75             COUT(0) << "Can't retrieve target for '" << this->target << "'.." << std::endl;
     75            COUT(0) << "Can't retrieve target for '" << this->target_ << "'.." << std::endl;
    7676            return false;
    7777        }
  • code/branches/presentation/src/modules/docking/DockToShip.h

    r8561 r8568  
    6767            virtual bool release(PlayerInfo* player); //!< Called when player wants undock
    6868        private:
    69             std::string target;
     69            std::string target_;
    7070    };
    7171
  • code/branches/presentation/src/modules/docking/DockingAnimation.cc

    r8561 r8568  
    4141    {
    4242        RegisterObject(DockingAnimation);
     43
     44        this->parent_ = NULL;
    4345    }
    4446
  • code/branches/presentation/src/modules/docking/DockingAnimation.h

    r8561 r8568  
    7373            static DockingTarget *findTarget(std::string name); //!< Iterates through all DockingTarget objects to find the one with name=target
    7474
    75             void setParent(Dock *parent) { this->parent = parent; }
     75            void setParent(Dock *parent) { this->parent_ = parent; }
    7676
    7777        protected:
    78             Dock *parent;
    79             std::set<PlayerInfo*> animations; //!< Contains a list of currently running animations
     78            Dock *parent_;
     79            std::set<PlayerInfo*> animations_; //!< Contains a list of currently running animations
    8080    };
    8181
  • code/branches/presentation/src/modules/docking/DockingController.cc

    r8561 r8568  
    4242    {
    4343        RegisterObject(DockingController);
     44
     45        this->dock_ = NULL;
     46        this->player_ = NULL;
     47        this->entity_ = NULL;
    4448    }
    4549
     
    5559            return;
    5660
    57         float distance = (dock->getWorldPosition() - entity->getPosition()).length();
     61        float distance = (this->dock_->getWorldPosition() - entity->getPosition()).length();
    5862        Vector2 coord = get2DViewdirection(     // I don't understand this too
    5963            entity->getPosition(),
    6064            entity->getOrientation() * WorldEntity::FRONT,
    6165            entity->getOrientation() * WorldEntity::UP,
    62             dock->getWorldPosition()
     66            dock_->getWorldPosition()
    6367        );
    6468
     
    8690    void DockingController::takeControl(bool docking)
    8791    {
    88         this->docking = docking;
     92        this->docking_ = docking;
    8993
    90         entity = player->getControllableEntity();
    91         assert(entity);
     94        this->entity_ = this->player_->getControllableEntity();
     95        assert(this->entity_);
    9296
    9397        if (docking)
     
    9599            COUT(4) << "DockingController::takeControl Taking over control." << std::endl;
    96100
    97             entity->setDestroyWhenPlayerLeft(false);
    98             player->pauseControl();
    99             entity->setController(this);
    100             this->setControllableEntity(entity);
     101            this->entity_->setDestroyWhenPlayerLeft(false);
     102            this->player_->pauseControl();
     103            this->entity_->setController(this);
     104            this->setControllableEntity(this->entity_);
    101105        }
    102106    }
     
    106110        COUT(4) << "DockingController::positionReached() called." << std::endl;
    107111
    108         assert(this->player);
    109         assert(this->dock);
     112        assert(this->player_);
     113        assert(this->dock_);
    110114
    111115        // stop spaceship
    112         entity->setPosition(dock->getWorldPosition());
    113         entity->setVelocity(0, 0, 0);
    114         entity->setOrientation(dock->getWorldOrientation());
     116        this->entity_->setPosition(this->dock_->getWorldPosition());
     117        this->entity_->setVelocity(0, 0, 0);
     118        this->entity_->setOrientation(this->dock_->getWorldOrientation());
    115119
    116120        // give control back to player
    117         player->startControl(entity);
     121        this->player_->startControl(this->entity_);
    118122        this->setActive(false);
    119123        this->controllableEntity_ = NULL;
    120124
    121         if (docking)
    122             dock->dockingAnimationFinished(player);
     125        if (this->docking_)
     126            this->dock_->dockingAnimationFinished(this->player_);
    123127        /*else
    124128            dock->undockingAnimationFinished(player);*/
  • code/branches/presentation/src/modules/docking/DockingController.h

    r8561 r8568  
    4949            void takeControl(bool docking);
    5050
    51             void setDock(Dock* dock) { this->dock = dock; }
    52             void setPlayer(PlayerInfo* player) { this->player = player; }
     51            void setDock(Dock* dock) { this->dock_ = dock; }
     52            void setPlayer(PlayerInfo* player) { this->player_ = player; }
    5353
    5454        protected:
     
    5656
    5757        private:
    58             bool docking;
     58            bool docking_;
    5959
    60             Dock* dock;
    61             PlayerInfo* player;
     60            Dock* dock_;
     61            PlayerInfo* player_;
    6262
    63             ControllableEntity* entity;
     63            ControllableEntity* entity_;
    6464    };
    6565}
  • code/branches/presentation/src/modules/docking/DockingEffect.cc

    r8561 r8568  
    6262
    6363    DockingTarget *DockingEffect::findTarget(std::string name) {
    64         for (ObjectList<DockingTarget>::iterator it = ObjectList<DockingTarget>::begin();
    65                                  it != ObjectList<DockingTarget>::end(); ++it)
     64        for (ObjectList<DockingTarget>::iterator it = ObjectList<DockingTarget>::begin(); it != ObjectList<DockingTarget>::end(); ++it)
    6665        {
    6766            if ((*it)->getName().compare(name) == 0)
  • code/branches/presentation/src/modules/docking/DockingTarget.cc

    r8561 r8568  
    6060
    6161    void DockingTarget::setName(const std::string& str) {
    62         this->name = str;
     62        this->name_ = str;
    6363    }
    6464
    6565    const std::string& DockingTarget::getName() const {
    66         return this->name;
     66        return this->name_;
    6767    }
    6868}
  • code/branches/presentation/src/modules/docking/DockingTarget.h

    r8561 r8568  
    5555    {
    5656        private:
    57             std::string name;
     57            std::string name_;
    5858
    5959        public:
  • code/branches/presentation/src/modules/docking/MoveToDockingTarget.cc

    r8561 r8568  
    5252    bool MoveToDockingTarget::docking(PlayerInfo *player)
    5353    {
    54         assert(parent);
     54        assert(this->parent_);
    5555
    5656        DockingController *dockingController = new DockingController(this);
    57         dockingController->setDock(parent);
     57        dockingController->setDock(this->parent_);
    5858        dockingController->setPlayer(player);
    5959        dockingController->takeControl(true);
     
    6565    {
    6666        //TODO: Investigate strange things...
    67         parent->detach((WorldEntity*)player->getControllableEntity());
     67        this->parent_->detach((WorldEntity*)player->getControllableEntity());
    6868
    69         parent->undockingAnimationFinished(player);
     69        this->parent_->undockingAnimationFinished(player);
    7070        return true;
    7171    }
Note: See TracChangeset for help on using the changeset viewer.