Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 19, 2008, 9:50:36 PM (16 years ago)
Author:
landauf
Message:

added chat overlay

Location:
code/branches/objecthierarchy/src/orxonox/objects/infos
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/orxonox/objects/infos/PlayerInfo.cc

    r1950 r1953  
    5151
    5252        this->ping_ = -1;
    53         this->clientID_ = (unsigned int)-1;
     53        this->clientID_ = network::CLIENTID_UNKNOWN;
    5454        this->bLocalPlayer_ = Core::isStandalone();
    5555        this->bLocalPlayer_ = false;
     
    6060        this->registerVariables();
    6161
    62         COUT(0) << "created PlayerInfo (" << this->getObjectID() << ")" << std::endl;
     62//COUT(0) << "created PlayerInfo (" << this->getObjectID() << ")" << std::endl;
    6363    }
    6464
     
    6868        if (gametype)
    6969            gametype->removePlayer(this);
    70         COUT(0) << "destroyed PlayerInfo (" << this->getObjectID() << ")" << std::endl;
     70//COUT(0) << "destroyed PlayerInfo (" << this->getObjectID() << ")" << std::endl;
    7171    }
    7272
    7373    void PlayerInfo::setConfigValues()
    7474    {
    75         SetConfigValue(playerName_, "Player").callback(this, &PlayerInfo::checkName);
     75        SetConfigValue(nick_, "Player").callback(this, &PlayerInfo::checkNick);
    7676    }
    7777
    78     void PlayerInfo::checkName()
     78    void PlayerInfo::checkNick()
    7979    {
    80 std::cout << "# PI(" << this->getObjectID() << "): checkName: " << this->bLocalPlayer_ << std::endl;
    81         if (this->bLocalPlayer_ && Core::isMaster())
    82             this->setName(this->playerName_);
     80//std::cout << "# PI(" << this->getObjectID() << "): checkName: " << this->bLocalPlayer_ << std::endl;
     81        if (this->bLocalPlayer_)
     82        {
     83            this->playerName_ = this->nick_;
     84
     85            if (Core::isMaster())
     86                this->setName(this->playerName_);
     87        }
    8388    }
    8489
    8590    void PlayerInfo::changedName()
    8691    {
    87 std::cout << "# PI(" << this->getObjectID() << "): changedName to " << this->getName() << std::endl;
     92//std::cout << "# PI(" << this->getObjectID() << "): changedName to " << this->getName() << std::endl;
    8893        Gametype* gametype = Gametype::getCurrentGametype();
    8994        if (gametype)
     
    103108    void PlayerInfo::clientChangedName()
    104109    {
    105 std::cout << "# PI(" << this->getObjectID() << "): clientChangedName() to " << this->playerName_ << std::endl;
     110//std::cout << "# PI(" << this->getObjectID() << "): clientChangedName() from " << this->getName() << " to " << this->playerName_ << std::endl;
    106111        this->setName(this->playerName_);
    107112    }
     
    109114    void PlayerInfo::checkClientID()
    110115    {
    111 std::cout << "# PI(" << this->getObjectID() << "): checkClientID()" << std::endl;
     116//std::cout << "# PI(" << this->getObjectID() << "): checkClientID()" << std::endl;
    112117        this->bHumanPlayer_ = true;
    113118
    114119        if (this->clientID_ == network::Host::getPlayerID())
    115120        {
    116 std::cout << "# PI(" << this->getObjectID() << "): checkClientID(): it's the client's ID" << std::endl;
     121//std::cout << "# PI(" << this->getObjectID() << "): checkClientID(): it's the client's ID" << std::endl;
    117122            this->bLocalPlayer_ = true;
     123            this->playerName_ = this->nick_;
    118124//std::cout << "# PI(" << this->getObjectID() << "): checkClientID(): name: " << this->getName() << std::endl;
    119125
    120126            if (Core::isClient())
    121127            {
    122 std::cout << "# PI(" << this->getObjectID() << "): checkClientID(): we're on a client: set object mode to bidirectional" << std::endl;
     128//std::cout << "# PI(" << this->getObjectID() << "): checkClientID(): we're on a client: set object mode to bidirectional" << std::endl;
    123129                this->setObjectMode(network::direction::bidirectional);
    124                 this->playerName_ += "blub";
    125 std::cout << "# PI(" << this->getObjectID() << "): checkClientID(): proposed name: " << this->playerName_ << std::endl;
     130//std::cout << "# PI(" << this->getObjectID() << "): checkClientID(): proposed name: " << this->playerName_ << std::endl;
    126131            }
    127132            else
    128133            {
    129 std::cout << "# PI(" << this->getObjectID() << "): checkClientID(): we're not on a client: finish setup" << std::endl;
     134//std::cout << "# PI(" << this->getObjectID() << "): checkClientID(): we're not on a client: finish setup" << std::endl;
    130135                this->clientChangedName();
    131136                this->bFinishedSetup_ = true;
     
    137142    void PlayerInfo::finishedSetup()
    138143    {
    139 std::cout << "# PI(" << this->getObjectID() << "): finishedSetup(): " << this->bFinishedSetup_ << std::endl;
     144//std::cout << "# PI(" << this->getObjectID() << "): finishedSetup(): " << this->bFinishedSetup_ << std::endl;
    140145        if (Core::isClient())
    141146        {
    142 std::cout << "# PI(" << this->getObjectID() << "): finishedSetup(): we're a client: finish setup" << std::endl;
     147//std::cout << "# PI(" << this->getObjectID() << "): finishedSetup(): we're a client: finish setup" << std::endl;
    143148            this->bFinishedSetup_ = true;
    144149        }
    145150        else if (this->bFinishedSetup_)
    146151        {
    147 std::cout << "# PI(" << this->getObjectID() << "): finishedSetup(): we're a server: add player" << std::endl;
     152//std::cout << "# PI(" << this->getObjectID() << "): finishedSetup(): we're a server: add player" << std::endl;
    148153            Gametype* gametype = Gametype::getCurrentGametype();
    149154            if (gametype)
     
    152157        else
    153158        {
    154 std::cout << "# PI(" << this->getObjectID() << "): finishedSetup(): we're a server: client not yet finished" << std::endl;
     159//std::cout << "# PI(" << this->getObjectID() << "): finishedSetup(): we're a server: client not yet finished" << std::endl;
    155160        }
    156161    }
  • code/branches/objecthierarchy/src/orxonox/objects/infos/PlayerInfo.h

    r1946 r1953  
    6060            void checkClientID();
    6161            void finishedSetup();
    62             void checkName();
     62            void checkNick();
    6363            void clientChangedName();
    6464
     
    7070
    7171            std::string playerName_;
     72            std::string nick_;
    7273    };
    7374}
Note: See TracChangeset for help on using the changeset viewer.