Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 12, 2009, 9:24:58 PM (15 years ago)
Author:
landauf
Message:

changed type of gametype-HUD and default-HUD to PlayerInfo (instead of Gametype and ControllableEntity respectively). The owner of the Pawn-HUD remains Pawn.

File:
1 edited

Legend:

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

    r2839 r2973  
    5151        this->controllableEntityID_ = CLIENTID_UNKNOWN;
    5252
     53        this->gtinfo_ = 0;
     54        this->gtinfoID_ = OBJECTID_UNKNOWN;
     55        this->updateGametypeInfo();
     56
    5357        this->registerVariables();
    5458    }
     
    7680        registerVariable(this->controllableEntityID_, variableDirection::toclient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedcontrollableentityID));
    7781        registerVariable(this->bReadyToSpawn_,        variableDirection::toserver);
     82        registerVariable(this->gtinfoID_,             variableDirection::toclient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedgtinfoID));
    7883    }
    7984
     
    8893    void PlayerInfo::changedGametype()
    8994    {
     95        this->updateGametypeInfo();
     96
    9097        if (this->isInitialized())
    9198        {
     
    108115    }
    109116
     117    void PlayerInfo::updateGametypeInfo()
     118    {
     119        this->gtinfo_ = 0;
     120        this->gtinfoID_ = OBJECTID_UNKNOWN;
     121
     122        if (this->getGametype() && this->getGametype()->getGametypeInfo())
     123        {
     124            this->gtinfo_ = this->getGametype()->getGametypeInfo();
     125            this->gtinfoID_ = this->gtinfo_->getObjectID();
     126        }
     127    }
     128
    110129    void PlayerInfo::createController()
    111130    {
     
    181200        }
    182201    }
     202
     203    void PlayerInfo::networkcallback_changedgtinfoID()
     204    {
     205        if (this->gtinfoID_ != OBJECTID_UNKNOWN)
     206        {
     207            this->gtinfo_ = dynamic_cast<GametypeInfo*>(Synchronisable::getSynchronisable(this->gtinfoID_));
     208
     209            if (!this->gtinfo_)
     210                this->gtinfoID_ = OBJECTID_UNKNOWN;
     211        }
     212    }
    183213}
Note: See TracChangeset for help on using the changeset viewer.