Changeset 1945 for code/branches
- Timestamp:
- Oct 19, 2008, 1:36:13 AM (16 years ago)
- Location:
- code/branches/objecthierarchy/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/network/Synchronisable.cc
r1940 r1945 139 139 COUT(3) << "fabricate objectID: " << no->objectID << " classID: " << no->classID << std::endl; 140 140 // update data and create object/entity... 141 bool b = no->updateData(mem, mode );141 bool b = no->updateData(mem, mode, true); 142 142 assert(b); 143 143 b = no->create(); … … 297 297 * @return true/false 298 298 */ 299 bool Synchronisable::updateData(uint8_t*& mem, int mode ){299 bool Synchronisable::updateData(uint8_t*& mem, int mode, bool forceCallback){ 300 300 if(mode==0x0) 301 301 mode=state_; … … 349 349 } 350 350 // call the callback function, if defined 351 if( callback&& (*i)->callback)351 if((callback || forceCallback) && (*i)->callback) 352 352 (*i)->callback->call(); 353 353 } -
code/branches/objecthierarchy/src/network/Synchronisable.h
r1940 r1945 117 117 bool getData(uint8_t*& men, unsigned int id, int mode=0x0); 118 118 uint32_t getSize(unsigned int id, int mode=0x0); 119 bool updateData(uint8_t*& mem, int mode=0x0 );119 bool updateData(uint8_t*& mem, int mode=0x0, bool forceCallback=false); 120 120 bool isMyData(uint8_t* mem); 121 121 bool doSelection(unsigned int id); -
code/branches/objecthierarchy/src/orxonox/objects/infos/PlayerInfo.cc
r1943 r1945 73 73 } 74 74 75 void PlayerInfo::checkName() 76 { 77 std::cout << "# PlayerInfo: checkName: " << this->bLocalPlayer_ << std::endl; 78 if (this->bLocalPlayer_) 79 this->setName(this->playerName_); 80 } 81 75 82 void PlayerInfo::registerVariables() 76 83 { … … 84 91 } 85 92 86 void PlayerInfo::checkName()87 {88 if (this->bLocalPlayer_)89 this->setName(this->playerName_);90 }91 92 93 void PlayerInfo::checkClientID() 93 94 { 95 std::cout << "# PlayerInfo: checkClientID" << std::endl; 94 96 this->bHumanPlayer_ = true; 95 97 96 98 if (this->clientID_ == network::Host::getPlayerID()) 97 99 { 100 std::cout << "# it's the client's ID" << std::endl; 98 101 this->bLocalPlayer_ = true; 99 102 this->setName(this->playerName_); 103 std::cout << "# " << this->getName() << std::endl; 100 104 101 105 if (!Settings::isClient()) 102 106 { 107 std::cout << "# not client: finish setup" << std::endl; 103 108 this->bFinishedSetup_ = true; 104 109 this->finishedSetup(); … … 109 114 void PlayerInfo::finishedSetup() 110 115 { 116 std::cout << "# PlayerInfo: finishedSetup: " << this->bFinishedSetup_ << std::endl; 111 117 if (Settings::isClient()) 118 { 119 std::cout << "# client: set to true" << std::endl; 112 120 this->bFinishedSetup_ = true; 121 } 113 122 else if (this->bFinishedSetup_) 114 123 { 124 std::cout << "# not client but finished: add player" << std::endl; 115 125 Gametype* gametype = Gametype::getCurrentGametype(); 116 126 if (gametype) 117 127 gametype->addPlayer(this); 118 128 } 129 else 130 { 131 std::cout << "# not client and not finished" << std::endl; 132 } 119 133 } 120 134 }
Note: See TracChangeset
for help on using the changeset viewer.