- Timestamp:
- Jan 17, 2010, 11:49:48 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network2/src/libraries/network/GamestateManager.cc
r6417 r6449 43 43 #include <cassert> 44 44 #include <queue> 45 #include "util/Clock.h" 45 46 // #include <boost/thread/mutex.hpp> 46 47 … … 158 159 159 160 clientGamestates.push(0); 160 finishGamestate( cid, &clientGamestates.back(), client, reference );161 finishGamestate( cid, clientGamestates.back(), client, reference ); 161 162 //FunctorMember<GamestateManager>* functor = 162 163 // ExecutorMember<GamestateManager>* executor = createExecutor( createFunctor(&GamestateManager::finishGamestate, this) ); … … 180 181 181 182 182 void GamestateManager::finishGamestate( unsigned int clientID, packet::Gamestate* *destgamestate, packet::Gamestate* base, packet::Gamestate* gamestate ) {183 void GamestateManager::finishGamestate( unsigned int clientID, packet::Gamestate*& destgamestate, packet::Gamestate* base, packet::Gamestate* gamestate ) { 183 184 //why are we searching the same client's gamestate id as we searched in 184 185 //Server::sendGameState? … … 186 187 //chose wheather the next gamestate is the first or not 187 188 188 packet::Gamestate *gs = gamestate->doSelection(clientID, 20000); 189 // packet::Gamestate *gs = new packet::Gamestate(*gamestate); 189 // packet::Gamestate *gs = gamestate->doSelection(clientID, 20000); 190 // packet::Gamestate* gs = new packet::Gamestate(*gamestate); 191 // packet::Gamestate* gs = gamestate; 192 packet::Gamestate *gs = new packet::Gamestate(*gamestate); 190 193 // packet::Gamestate *gs = new packet::Gamestate(); 191 194 // gs->collectData( id_, 0x1 ); … … 193 196 gamestateMap_[clientID][gamestate->getID()]=gs; 194 197 // this->threadMutex_->unlock(); 198 Clock clock; 199 clock.capture(); 195 200 196 201 if(base) … … 200 205 // packet::Gamestate* gs1 = gs; 201 206 packet::Gamestate *diffed = gs->diff(base); 207 if( diffed->getDataSize() == 0 ) 208 { 209 delete diffed; 210 destgamestate = 0; 211 return; 212 } 213 else 214 gs = diffed; 202 215 //packet::Gamestate *gs2 = diffed->undiff(gs); 203 216 // assert(*gs == *gs2); 204 gs = diffed;205 217 // packet::Gamestate* gs2 = gs->undiff(client); 206 218 // gs = new packet::Gamestate(*gs); … … 214 226 bool b = gs->compressData(); 215 227 assert(b); 216 // COUT(4) << "sending gamestate with id " << gs->getID(); 228 clock.capture(); 229 COUT(0) << "diff time: " << clock.getDeltaTime() << endl; 230 // COUT(5) << "sending gamestate with id " << gs->getID(); 217 231 // if(gamestate->isDiffed()) 218 // COUT(4) << " and baseid " << gs->getBaseID() << endl;232 // COUT(5) << " and baseid " << gs->getBaseID() << endl; 219 233 // else 220 // COUT(4) << endl;234 // COUT(5) << endl; 221 235 gs->setClientID(clientID); 222 *destgamestate = gs;236 destgamestate = gs; 223 237 } 224 238
Note: See TracChangeset
for help on using the changeset viewer.