Changeset 7882
- Timestamp:
- Feb 14, 2011, 9:00:48 AM (14 years ago)
- Location:
- code/branches/network6/src/libraries/network
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network6/src/libraries/network/Client.cc
r7878 r7882 155 155 COUT(4) << "popping partial gamestate: " << std::endl; 156 156 // packet::Gamestate *gs = GamestateClient::getGamestate(); 157 GamestateManager::update(); 158 std::vector<packet::Gamestate*> gamestates = GamestateManager::getGamestates(); 159 std::vector<packet::Gamestate*>::iterator it; 160 for( it = gamestates.begin(); it != gamestates.end(); ++it ) 157 if( GamestateManager::update() ) 161 158 { 162 (*it)->send( static_cast<Host*>(this) ); 159 std::vector<packet::Gamestate*> gamestates = GamestateManager::getGamestates(); 160 std::vector<packet::Gamestate*>::iterator it; 161 for( it = gamestates.begin(); it != gamestates.end(); ++it ) 162 { 163 (*it)->send( static_cast<Host*>(this) ); 164 } 163 165 } 164 166 //assert(gs); <--- there might be the case that no data has to be sent, so its commented out now -
code/branches/network6/src/libraries/network/GamestateManager.cc
r7878 r7882 57 57 58 58 namespace orxonox 59 { 59 { 60 60 GamestateManager::GamestateManager() : 61 61 currentGamestate_(0), id_(0) … … 110 110 bool b = processGamestate(it->second); 111 111 assert(b); 112 //sendAck( it->second->getID(), it->second->getPeerID() );112 sendAck( it->second->getID(), it->second->getPeerID() ); 113 113 delete it->second; 114 114 } … … 140 140 if ( currentGamestate_ != 0 ) 141 141 delete currentGamestate_; 142 currentGamestate_ = new packet::Gamestate();143 142 uint8_t gsMode; 144 143 if( GameMode::isMaster() ) … … 153 152 assert(peerMap_.size()!=0); 154 153 newID = peerMap_[NETWORK_PEER_ID_SERVER].lastReceivedGamestateID; 154 if( newID == GAMESTATEID_INITIAL ) 155 { 156 return false; 157 } 155 158 } 156 159 157 if(!currentGamestate_->collectData(newID, gsMode)){ //we have no data to send 160 currentGamestate_ = new packet::Gamestate(); 161 162 if(!currentGamestate_->collectData(newID, gsMode)) 163 { //we have no data to send 158 164 delete currentGamestate_; 159 165 currentGamestate_=0; 166 return false; 160 167 } 161 168 return true; -
code/branches/network6/src/libraries/network/Server.cc
r7878 r7882 417 417 b = w->send( static_cast<Host*>(this) ); 418 418 assert(b); 419 packet::Gamestate *g = new packet::Gamestate(); 420 g->setPeerID(clientID); 421 b = g->collectData(0,packet::GAMESTATE_MODE_SERVER); 422 assert(b); 423 if(!b) 424 return false; //no data for the client 425 // b = g->compressData(); 419 // packet::Gamestate *g = new packet::Gamestate(); 420 // g->setPeerID(clientID); 421 // b = g->collectData(0,packet::GAMESTATE_MODE_SERVER); 426 422 // assert(b); 427 b = g->send( static_cast<Host*>(this) ); 428 assert(b); 423 // if(!b) 424 // return false; //no data for the client 425 // // b = g->compressData(); 426 // // assert(b); 427 // b = g->send( static_cast<Host*>(this) ); 428 // assert(b); 429 429 return true; 430 430 }
Note: See TracChangeset
for help on using the changeset viewer.