Changeset 2041 for code/branches/objecthierarchy/src/orxonox/objects/infos
- Timestamp:
- Oct 29, 2008, 12:48:11 AM (16 years ago)
- 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 55 55 this->registerVariables(); 56 56 57 COUT(0) << "HumanPlayer created" << std::endl; 57 COUT(0) << this->getObjectID() << ": HumanPlayer created" << std::endl; 58 network::Synchronisable* temp = dynamic_cast<network::Synchronisable*>(creator); 59 if (temp) 60 { 61 COUT(0) << this->getObjectID() << ": CreatorID: " << temp->getObjectID() << std::endl; 62 } 63 else 64 { 65 COUT(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 } 82 COUT(0) << this->getObjectID() << ": ### tranmitted creatorID: " << creatorID << std::endl; 58 83 } 59 84 60 85 HumanPlayer::~HumanPlayer() 61 86 { 87 COUT(0) << this->getObjectID() << ": HumanPlayer destroyed" << std::endl; 62 88 } 63 89 … … 94 120 void HumanPlayer::networkcallback_clientIDchanged() 95 121 { 122 COUT(0) << this->getObjectID() << ": PI: clientID changed to " << this->clientID_ << std::endl; 96 123 if (this->clientID_ == network::Host::getPlayerID()) 97 124 { 125 COUT(0) << this->getObjectID() << ": PI: it's my clientID" << std::endl; 98 126 this->bLocalPlayer_ = true; 99 127 this->synchronize_nick_ = this->nick_; … … 101 129 102 130 if (!Core::isMaster()) 131 { 103 132 this->setObjectMode(network::direction::bidirectional); 133 COUT(0) << this->getObjectID() << ": PI: set objectmode to bidirectional" << std::endl; 134 } 104 135 else 105 136 this->setName(this->nick_); … … 112 143 { 113 144 this->client_ready_ = true; 145 COUT(0) << this->getObjectID() << ": PI: server ready, client set ready too" << std::endl; 114 146 } 115 147 116 148 void HumanPlayer::networkcallback_client_ready() 117 149 { 150 COUT(0) << this->getObjectID() << ": PI: client ready" << std::endl; 118 151 if (this->getGametype()) 152 { 153 COUT(0) << this->getObjectID() << ": PI: adding client to gametype" << std::endl; 119 154 this->getGametype()->playerEntered(this); 155 } 120 156 } 121 157 … … 137 173 void HumanPlayer::setClientID(unsigned int clientID) 138 174 { 175 COUT(0) << this->getObjectID() << ": PI: set clientID to " << clientID << std::endl; 139 176 this->clientID_ = clientID; 140 177 this->networkcallback_clientIDchanged(); -
code/branches/objecthierarchy/src/orxonox/objects/infos/PlayerInfo.cc
r2040 r2041 71 71 REGISTERSTRING(this->name_, network::direction::toclient, new network::NetworkCallback<PlayerInfo>(this, &PlayerInfo::changedName)); 72 72 REGISTERDATA (this->controllableEntityID_, network::direction::toclient, new network::NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedcontrollableentityID)); 73 REGISTERDATA (this->bReadyToSpawn_, network::direction::toserver); 73 74 } 74 75 … … 127 128 this->controllableEntityID_ = network::OBJECTID_UNKNOWN; 128 129 } 129 130 COUT(0) << this->getObjectID() << ": PI: start control" << std::endl; 130 131 if (this->controller_) 131 132 this->controller_->setControllableEntity(entity); 132 133 } 133 134 134 void PlayerInfo::stopControl(ControllableEntity* entity )135 void PlayerInfo::stopControl(ControllableEntity* entity, bool callback) 135 136 { 136 137 if (entity && this->controllableEntity_ == entity) … … 142 143 this->controller_->setControllableEntity(0); 143 144 144 entity->removePlayer(); 145 if (callback) 146 entity->removePlayer(); 145 147 } 146 148 } -
code/branches/objecthierarchy/src/orxonox/objects/infos/PlayerInfo.h
r2040 r2041 66 66 67 67 void startControl(ControllableEntity* entity); 68 void stopControl(ControllableEntity* entity );68 void stopControl(ControllableEntity* entity, bool callback = true); 69 69 70 70 inline ControllableEntity* getControllableEntity() const
Note: See TracChangeset
for help on using the changeset viewer.