- Timestamp:
- Jul 12, 2010, 1:08:58 PM (14 years ago)
- Location:
- code/branches/presentation3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3
- Property svn:mergeinfo changed
/code/branches/network2 (added) merged: 6448-6450,6455-6458,6462,6464-6465
- Property svn:mergeinfo changed
-
code/branches/presentation3/src/libraries/network/GamestateManager.cc
r6417 r7153 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); //TODO: is this neccessary ? 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) 197 202 { 198 199 // COUT(3) << "diffing" << std::endl; 200 // packet::Gamestate* gs1 = gs; 201 packet::Gamestate *diffed = gs->diff(base); 202 //packet::Gamestate *gs2 = diffed->undiff(gs); 203 // assert(*gs == *gs2); 204 gs = diffed; 205 // packet::Gamestate* gs2 = gs->undiff(client); 206 // gs = new packet::Gamestate(*gs); 207 // assert(*gs1==*gs2); 208 } 209 else{ 203 packet::Gamestate *diffed1 = gs->diffVariables(base); 204 if( diffed1->getDataSize() == 0 ) 205 { 206 delete diffed1; 207 destgamestate = 0; 208 return; 209 } 210 gs = diffed1; 211 } 212 else 213 { 210 214 gs = new packet::Gamestate(*gs); 211 215 } … … 214 218 bool b = gs->compressData(); 215 219 assert(b); 216 // COUT(4) << "sending gamestate with id " << gs->getID(); 220 clock.capture(); 221 COUT(0) << "diff time: " << clock.getDeltaTime() << endl; 222 // COUT(5) << "sending gamestate with id " << gs->getID(); 217 223 // if(gamestate->isDiffed()) 218 // COUT(4) << " and baseid " << gs->getBaseID() << endl;224 // COUT(5) << " and baseid " << gs->getBaseID() << endl; 219 225 // else 220 // COUT(4) << endl;226 // COUT(5) << endl; 221 227 gs->setClientID(clientID); 222 *destgamestate = gs;228 destgamestate = gs; 223 229 } 224 230
Note: See TracChangeset
for help on using the changeset viewer.