Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 13, 2008, 10:54:26 PM (16 years ago)
Author:
landauf
Message:
  • Moved some variables from Gametype to GametypeInfo (Gametype exists only on the Server while GametypeInfo is synchronized)
  • Created a new HUD-element, GametypeStatus, based on GametypeInfo (the same effect was formerly achieved by using a hack in Spectator and a TextOverlay)
  • HumanController creates a HUD (additionally to the SpaceShips HUD) which includes GametypeStatus and ChatOverlay and even more in the future
Location:
code/branches/objecthierarchy2/src/orxonox/objects/infos
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy2/src/orxonox/objects/infos/CMakeLists.txt

    r2362 r2428  
    44  PlayerInfo.cc
    55  HumanPlayer.cc
     6  GametypeInfo.cc
    67)
    78
  • code/branches/objecthierarchy2/src/orxonox/objects/infos/HumanPlayer.cc

    r2171 r2428  
    3737#include "objects/controllers/HumanController.h"
    3838#include "objects/gametypes/Gametype.h"
     39#include "overlays/OverlayGroup.h"
    3940
    4041namespace orxonox
     
    6364    {
    6465        SetConfigValue(nick_, "Player").callback(this, &HumanPlayer::configvaluecallback_changednick);
     66        SetConfigValue(hudtemplate_, "defaultHUD").callback(this, &HumanPlayer::configvaluecallback_changedHUDTemplate);
    6567    }
    6668
     
    6971        REGISTERSTRING(this->synchronize_nick_, direction::toserver, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_changednick));
    7072
    71         REGISTERDATA(this->clientID_,     direction::toclient, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_clientIDchanged));
     73        REGISTERDATA(this->clientID_,           direction::toclient, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_clientIDchanged));
    7274        REGISTERDATA(this->server_initialized_, direction::toclient, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_server_initialized));
    7375        REGISTERDATA(this->client_initialized_, direction::toserver, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_client_initialized));
     
    8385                this->setName(this->nick_);
    8486        }
     87    }
     88
     89    void HumanPlayer::configvaluecallback_changedHUDTemplate()
     90    {
     91        this->changedController();
    8592    }
    8693
     
    138145        this->networkcallback_clientIDchanged();
    139146    }
     147
     148    void HumanPlayer::changedController()
     149    {
     150        if (this->getController())
     151        {
     152            this->getController()->setHUDTemplate(this->hudtemplate_);
     153
     154            if (this->getController() && this->getController()->getHUD())
     155                this->getController()->getHUD()->setOwner(this->getControllableEntity());
     156        }
     157    }
    140158}
  • code/branches/objecthierarchy2/src/orxonox/objects/infos/HumanPlayer.h

    r2362 r2428  
    5151            void setClientID(unsigned int clientID);
    5252
     53            virtual void changedController();
     54
    5355        protected:
    5456            void configvaluecallback_changednick();
     57            void configvaluecallback_changedHUDTemplate();
    5558            void networkcallback_changednick();
    5659            void networkcallback_clientIDchanged();
     
    6063            std::string nick_;
    6164            std::string synchronize_nick_;
     65            std::string hudtemplate_;
    6266            bool server_initialized_;
    6367            bool client_initialized_;
  • code/branches/objecthierarchy2/src/orxonox/objects/infos/PlayerInfo.cc

    r2369 r2428  
    112112        if (this->controllableEntity_)
    113113            this->controller_->setControllableEntity(this->controllableEntity_);
     114        this->changedController();
    114115    }
    115116
    116117    void PlayerInfo::startControl(ControllableEntity* entity)
    117118    {
     119        if (entity == this->controllableEntity_)
     120            return;
     121
    118122        if (this->controllableEntity_)
    119123            this->stopControl(this->controllableEntity_);
  • code/branches/objecthierarchy2/src/orxonox/objects/infos/PlayerInfo.h

    r2362 r2428  
    7171                { return this->controllableEntity_; }
    7272
     73            inline Controller* getController() const
     74                { return this->controller_; }
     75            virtual void changedController() {}
     76
    7377        protected:
    7478            void createController();
Note: See TracChangeset for help on using the changeset viewer.