- Timestamp:
- Oct 21, 2008, 4:56:41 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/orxonox/objects/infos/PlayerInfo.cc
r1953 r1989 41 41 #include "GraphicsEngine.h" 42 42 #include "objects/gametypes/Gametype.h" 43 #include "objects/worldentities/ControllableEntity.h" 43 44 44 45 namespace orxonox … … 56 57 this->bHumanPlayer_ = false; 57 58 this->bFinishedSetup_ = false; 59 60 this->pawn_ = 0; 61 this->pawnID_ = network::OBJECTID_UNKNOWN; 58 62 59 63 this->setConfigValues(); … … 103 107 REGISTERDATA(ping_, network::direction::toclient); 104 108 REGISTERDATA(bHumanPlayer_, network::direction::toclient); 109 REGISTERDATA(pawnID_, network::direction::toclient, new network::NetworkCallback<PlayerInfo>(this, &PlayerInfo::updatePawn)); 105 110 REGISTERDATA(bFinishedSetup_, network::direction::bidirectional, new network::NetworkCallback<PlayerInfo>(this, &PlayerInfo::finishedSetup)); 106 111 } … … 160 165 } 161 166 } 167 168 void PlayerInfo::startControl(ControllableEntity* pawn) 169 { 170 pawn->setPlayer(this); 171 this->pawn_ = pawn; 172 this->pawnID_ = pawn->getObjectID(); 173 } 174 175 void PlayerInfo::stopControl() 176 { 177 this->pawn_->removePlayer(); 178 this->pawn_ = 0; 179 this->pawnID_ = network::OBJECTID_UNKNOWN; 180 } 181 182 void PlayerInfo::updatePawn() 183 { 184 this->pawn_ = dynamic_cast<ControllableEntity*>(network::Synchronisable::getSynchronisable(this->pawnID_)); 185 if (this->pawn_ && (this->pawn_->getPlayer() != this)) 186 this->pawn_->setPlayer(this); 187 } 162 188 }
Note: See TracChangeset
for help on using the changeset viewer.