Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 29, 2008, 12:48:11 AM (16 years ago)
Author:
landauf
Message:

bugs—
network++
endurance—
tiredness++

but it still doesn't work properly
(commit because oli is very impatient)

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

Legend:

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

    r2040 r2041  
    5555        this->registerVariables();
    5656
    57         COUT(0) << "HumanPlayer created" << std::endl;
     57COUT(0) << this->getObjectID() << ": HumanPlayer created" << std::endl;
     58        network::Synchronisable* temp = dynamic_cast<network::Synchronisable*>(creator);
     59        if (temp)
     60        {
     61COUT(0) << this->getObjectID() << ": CreatorID: " << temp->getObjectID() << std::endl;
     62        }
     63        else
     64        {
     65COUT(0) << this->getObjectID() << ": Creator is no Synchronisable" << std::endl;
     66        }
     67    unsigned int creatorID = network::OBJECTID_UNKNOWN;
     68    searchcreatorID:
     69    if (creator)
     70    {
     71        if (creator->isA(Class(Synchronisable)))
     72        {
     73            Synchronisable* synchronisable_creator = dynamic_cast<Synchronisable*>(creator);
     74            creatorID = synchronisable_creator->getObjectID();
     75        }
     76        else if (creator != creator->getCreator())
     77        {
     78            creator = creator->getCreator();
     79            goto searchcreatorID;
     80        }
     81    }
     82COUT(0) << this->getObjectID() << ": ### tranmitted creatorID: " << creatorID << std::endl;
    5883    }
    5984
    6085    HumanPlayer::~HumanPlayer()
    6186    {
     87COUT(0) << this->getObjectID() << ": HumanPlayer destroyed" << std::endl;
    6288    }
    6389
     
    94120    void HumanPlayer::networkcallback_clientIDchanged()
    95121    {
     122COUT(0) << this->getObjectID() << ": PI: clientID changed to " << this->clientID_ << std::endl;
    96123        if (this->clientID_ == network::Host::getPlayerID())
    97124        {
     125COUT(0) << this->getObjectID() << ": PI: it's my clientID" << std::endl;
    98126            this->bLocalPlayer_ = true;
    99127            this->synchronize_nick_ = this->nick_;
     
    101129
    102130            if (!Core::isMaster())
     131            {
    103132                this->setObjectMode(network::direction::bidirectional);
     133COUT(0) << this->getObjectID() << ": PI: set objectmode to bidirectional" << std::endl;
     134            }
    104135            else
    105136                this->setName(this->nick_);
     
    112143    {
    113144        this->client_ready_ = true;
     145COUT(0) << this->getObjectID() << ": PI: server ready, client set ready too" << std::endl;
    114146    }
    115147
    116148    void HumanPlayer::networkcallback_client_ready()
    117149    {
     150COUT(0) << this->getObjectID() << ": PI: client ready" << std::endl;
    118151        if (this->getGametype())
     152        {
     153COUT(0) << this->getObjectID() << ": PI: adding client to gametype" << std::endl;
    119154            this->getGametype()->playerEntered(this);
     155        }
    120156    }
    121157
     
    137173    void HumanPlayer::setClientID(unsigned int clientID)
    138174    {
     175COUT(0) << this->getObjectID() << ": PI: set clientID to " << clientID << std::endl;
    139176        this->clientID_ = clientID;
    140177        this->networkcallback_clientIDchanged();
  • code/branches/objecthierarchy/src/orxonox/objects/infos/PlayerInfo.cc

    r2040 r2041  
    7171        REGISTERSTRING(this->name_,                 network::direction::toclient, new network::NetworkCallback<PlayerInfo>(this, &PlayerInfo::changedName));
    7272        REGISTERDATA  (this->controllableEntityID_, network::direction::toclient, new network::NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedcontrollableentityID));
     73        REGISTERDATA  (this->bReadyToSpawn_,        network::direction::toserver);
    7374    }
    7475
     
    127128            this->controllableEntityID_ = network::OBJECTID_UNKNOWN;
    128129        }
    129 
     130COUT(0) << this->getObjectID() << ": PI: start control" << std::endl;
    130131        if (this->controller_)
    131132            this->controller_->setControllableEntity(entity);
    132133    }
    133134
    134     void PlayerInfo::stopControl(ControllableEntity* entity)
     135    void PlayerInfo::stopControl(ControllableEntity* entity, bool callback)
    135136    {
    136137        if (entity && this->controllableEntity_ == entity)
     
    142143                this->controller_->setControllableEntity(0);
    143144
    144             entity->removePlayer();
     145            if (callback)
     146                entity->removePlayer();
    145147        }
    146148    }
  • code/branches/objecthierarchy/src/orxonox/objects/infos/PlayerInfo.h

    r2040 r2041  
    6666
    6767            void startControl(ControllableEntity* entity);
    68             void stopControl(ControllableEntity* entity);
     68            void stopControl(ControllableEntity* entity, bool callback = true);
    6969
    7070            inline ControllableEntity* getControllableEntity() const
Note: See TracChangeset for help on using the changeset viewer.