Changeset 2171 for code/trunk/src/orxonox/objects/infos
- Timestamp:
- Nov 10, 2008, 12:05:03 AM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 2 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/objecthierarchy merged: 2111-2115,2123,2132-2134,2143-2144,2153-2158,2160-2169
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/infos/CMakeLists.txt
r2131 r2171 1 1 SET( SRC_FILES 2 2 Info.cc 3 Level.cc4 3 PlayerInfo.cc 5 4 HumanPlayer.cc -
code/trunk/src/orxonox/objects/infos/HumanPlayer.cc
r2087 r2171 46 46 RegisterObject(HumanPlayer); 47 47 48 this->server_ ready_ = Core::isMaster();49 this->client_ ready_ = false;48 this->server_initialized_ = Core::isMaster(); 49 this->client_initialized_ = false; 50 50 51 51 this->bHumanPlayer_ = true; … … 67 67 void HumanPlayer::registerVariables() 68 68 { 69 REGISTERSTRING(this->synchronize_nick_, network::direction::toserver, new network::NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_changednick));69 REGISTERSTRING(this->synchronize_nick_, direction::toserver, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_changednick)); 70 70 71 REGISTERDATA(this->clientID_, network::direction::toclient, new network::NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_clientIDchanged));72 REGISTERDATA(this->server_ ready_, network::direction::toclient, new network::NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_server_ready));73 REGISTERDATA(this->client_ ready_, network::direction::toserver, new network::NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_client_ready));71 REGISTERDATA(this->clientID_, direction::toclient, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_clientIDchanged)); 72 REGISTERDATA(this->server_initialized_, direction::toclient, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_server_initialized)); 73 REGISTERDATA(this->client_initialized_, direction::toserver, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_client_initialized)); 74 74 } 75 75 … … 92 92 void HumanPlayer::networkcallback_clientIDchanged() 93 93 { 94 if (this->clientID_ == network::Host::getPlayerID())94 if (this->clientID_ == Host::getPlayerID()) 95 95 { 96 96 this->bLocalPlayer_ = true; 97 97 this->synchronize_nick_ = this->nick_; 98 this->client_ ready_ = true;98 this->client_initialized_ = true; 99 99 100 100 if (!Core::isMaster()) 101 this->setObjectMode( network::direction::bidirectional);101 this->setObjectMode(direction::bidirectional); 102 102 else 103 103 this->setName(this->nick_); … … 107 107 } 108 108 109 void HumanPlayer::networkcallback_server_ ready()109 void HumanPlayer::networkcallback_server_initialized() 110 110 { 111 this->client_ ready_ = true;111 this->client_initialized_ = true; 112 112 } 113 113 114 void HumanPlayer::networkcallback_client_ ready()114 void HumanPlayer::networkcallback_client_initialized() 115 115 { 116 116 if (this->getGametype()) … … 118 118 } 119 119 120 bool HumanPlayer::is Ready() const120 bool HumanPlayer::isInitialized() const 121 121 { 122 return (this->server_ ready_ && this->client_ready_);122 return (this->server_initialized_ && this->client_initialized_); 123 123 } 124 124 125 125 float HumanPlayer::getPing() const 126 126 { 127 return network::ClientInformation::findClient(this->getClientID())->getRTT();127 return ClientInformation::findClient(this->getClientID())->getRTT(); 128 128 } 129 129 130 130 float HumanPlayer::getPacketLossRatio() const 131 131 { 132 return network::ClientInformation::findClient(this->getClientID())->getPacketLoss();132 return ClientInformation::findClient(this->getClientID())->getPacketLoss(); 133 133 } 134 134 -
code/trunk/src/orxonox/objects/infos/HumanPlayer.h
r2087 r2171 47 47 void setConfigValues(); 48 48 49 bool is Ready() const;49 bool isInitialized() const; 50 50 float getPing() const; 51 51 float getPacketLossRatio() const; … … 57 57 void networkcallback_changednick(); 58 58 void networkcallback_clientIDchanged(); 59 void networkcallback_server_ ready();60 void networkcallback_client_ ready();59 void networkcallback_server_initialized(); 60 void networkcallback_client_initialized(); 61 61 62 62 std::string nick_; 63 63 std::string synchronize_nick_; 64 bool server_ ready_;65 bool client_ ready_;64 bool server_initialized_; 65 bool client_initialized_; 66 66 }; 67 67 } -
code/trunk/src/orxonox/objects/infos/Info.cc
r2087 r2171 34 34 namespace orxonox 35 35 { 36 Info::Info(BaseObject* creator) : BaseObject(creator), network::Synchronisable(creator)36 Info::Info(BaseObject* creator) : BaseObject(creator), Synchronisable(creator) 37 37 { 38 38 RegisterObject(Info); -
code/trunk/src/orxonox/objects/infos/Info.h
r2087 r2171 37 37 namespace orxonox 38 38 { 39 class _OrxonoxExport Info : public BaseObject, public network::Synchronisable39 class _OrxonoxExport Info : public BaseObject, public Synchronisable 40 40 { 41 41 public: -
code/trunk/src/orxonox/objects/infos/PlayerInfo.cc
r2087 r2171 42 42 RegisterObject(PlayerInfo); 43 43 44 this->clientID_ = network::CLIENTID_UNKNOWN;44 this->clientID_ = CLIENTID_UNKNOWN; 45 45 this->bHumanPlayer_ = false; 46 46 this->bLocalPlayer_ = false; … … 48 48 this->controller_ = 0; 49 49 this->controllableEntity_ = 0; 50 this->controllableEntityID_ = network::CLIENTID_UNKNOWN;50 this->controllableEntityID_ = CLIENTID_UNKNOWN; 51 51 52 52 this->registerVariables(); … … 55 55 PlayerInfo::~PlayerInfo() 56 56 { 57 if (this-> isInitialized())57 if (this->BaseObject::isInitialized()) 58 58 { 59 59 this->stopControl(this->controllableEntity_); … … 69 69 void PlayerInfo::registerVariables() 70 70 { 71 REGISTERSTRING(this->name_, network::direction::toclient, new network::NetworkCallback<PlayerInfo>(this, &PlayerInfo::changedName));72 REGISTERDATA (this->controllableEntityID_, network::direction::toclient, new network::NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedcontrollableentityID));73 REGISTERDATA (this->bReadyToSpawn_, network::direction::toserver);71 REGISTERSTRING(this->name_, direction::toclient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::changedName)); 72 REGISTERDATA (this->controllableEntityID_, direction::toclient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedcontrollableentityID)); 73 REGISTERDATA (this->bReadyToSpawn_, direction::toserver); 74 74 } 75 75 76 76 void PlayerInfo::changedName() 77 77 { 78 if (this->is Ready() && this->getGametype())78 if (this->isInitialized() && this->getGametype()) 79 79 this->getGametype()->playerChangedName(this); 80 80 } … … 82 82 void PlayerInfo::changedGametype() 83 83 { 84 if (this->is Ready())84 if (this->isInitialized()) 85 85 { 86 86 if (this->getOldGametype()) … … 126 126 else 127 127 { 128 this->controllableEntityID_ = network::OBJECTID_UNKNOWN;128 this->controllableEntityID_ = OBJECTID_UNKNOWN; 129 129 } 130 130 … … 138 138 { 139 139 this->controllableEntity_ = 0; 140 this->controllableEntityID_ = network::OBJECTID_UNKNOWN;140 this->controllableEntityID_ = OBJECTID_UNKNOWN; 141 141 142 142 if (this->controller_) … … 150 150 void PlayerInfo::networkcallback_changedcontrollableentityID() 151 151 { 152 if (this->controllableEntityID_ != network::OBJECTID_UNKNOWN)152 if (this->controllableEntityID_ != OBJECTID_UNKNOWN) 153 153 { 154 154 Synchronisable* temp = Synchronisable::getSynchronisable(this->controllableEntityID_); -
code/trunk/src/orxonox/objects/infos/PlayerInfo.h
r2087 r2171 55 55 inline unsigned int getClientID() const 56 56 { return this->clientID_; } 57 inline bool isReadyToSpawn() const58 { return this->bReadyToSpawn_; }59 57 60 virtual bool is Ready() const = 0;58 virtual bool isInitialized() const = 0; 61 59 virtual float getPing() const = 0; 62 60 virtual float getPacketLossRatio() const = 0; … … 64 62 inline void setReadyToSpawn(bool bReady) 65 63 { this->bReadyToSpawn_ = bReady; } 64 inline bool isReadyToSpawn() const 65 { return this->bReadyToSpawn_; } 66 66 67 67 void startControl(ControllableEntity* entity);
Note: See TracChangeset
for help on using the changeset viewer.