Changeset 8623 in orxonox.OLD for trunk/src/lib/network/synchronizeable.cc
- Timestamp:
- Jun 20, 2006, 1:39:01 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/network/synchronizeable.cc
r8228 r8623 70 70 this->networkStream->disconnectSynchronizeable(*this); 71 71 72 if ( this->isServer() && this->beSynchronized() && this->getUniqueID() > 0 )72 if ( this->isServer() && this->beSynchronized() && this->getUniqueID() > 0 && !this->isA( CL_MESSAGE_MANAGER ) ) 73 73 NetworkGameManager::getInstance()->removeSynchronizeable( this->getUniqueID() ); 74 75 for ( SyncVarList::iterator it = syncVarList.begin(); it != syncVarList.end(); it++ ) 76 { 77 delete *it; 78 } 79 syncVarList.clear(); 80 81 for ( UserStateHistory::iterator it = recvStates.begin(); it != recvStates.end(); it++ ) 82 { 83 for ( StateHistory::iterator it2 = it->begin(); it2 != it->end(); it2++ ) 84 { 85 if ( (*it2)->data ) 86 { 87 delete [] (*it2)->data; 88 (*it2)->data = NULL; 89 } 90 delete *it2; 91 } 92 93 } 94 95 for ( UserStateHistory::iterator it = sentStates.begin(); it != sentStates.end(); it++ ) 96 { 97 for ( StateHistory::iterator it2 = it->begin(); it2 != it->end(); it2++ ) 98 { 99 if ( (*it2)->data ) 100 { 101 delete [] (*it2)->data; 102 (*it2)->data = NULL; 103 } 104 delete *it2; 105 } 106 107 } 74 108 } 75 109 … … 134 168 (*it2)->data = NULL; 135 169 } 170 171 delete *it2; 136 172 } 137 173 sentStates[userId].erase( sentStates[userId].begin(), it ); … … 159 195 160 196 stateFrom = initialEntry; 197 198 sentStates[userId].push_back( stateFrom ); 161 199 } 162 200 else 163 201 stateFrom = (*it); 164 202 165 StateHistoryEntry * stateTo = new StateHistoryEntry(); 166 203 StateHistoryEntry * stateTo = new StateHistoryEntry; 204 205 sentStates[userId].push_back( stateTo ); 206 167 207 stateTo->stateId = stateId; 168 208 stateTo->dataLength = neededSize; … … 175 215 176 216 bool hasPermission; 217 bool sizeChanged = false; 177 218 178 219 // now do the actual synchronization: kick all variables to write into a common buffer … … 186 227 ); 187 228 188 if ( ( sizeIter != stateFrom->sizeList.end() && *sizeIter != (*it)->getSize() ) || ( hasPermission && (*it)->getPriority() >= priorityTH ) || sizeIter == stateFrom->sizeList.end() ) 229 if ( sizeIter == stateFrom->sizeList.end() || *sizeIter != (*it)->getSize() ) 230 sizeChanged = true; 231 232 if ( ( hasPermission && (*it)->getPriority() >= priorityTH ) || sizeChanged ) 189 233 { 190 234 n = (*it)->writeToBuf( stateTo->data+i, stateTo->dataLength - i ); … … 210 254 } 211 255 212 sentStates[userId].push_back( stateTo );213 214 256 if ( i != neededSize ) 215 257 { … … 275 317 276 318 stateFrom = initialEntry; 319 320 recvStates[userId].push_back( stateFrom ); 277 321 } 278 322 else … … 374 418 { 375 419 if ( (*it)->data ) 420 { 376 421 delete [] (*it)->data; 377 (*it)->data = NULL; 422 (*it)->data = NULL; 423 } 378 424 379 425 delete *it; … … 388 434 { 389 435 if ( (*it)->data ) 436 { 390 437 delete [] (*it)->data; 391 (*it)->data = NULL; 438 (*it)->data = NULL; 439 } 392 440 393 441 delete *it; … … 438 486 439 487 if ( (*delIt)->data ) 488 { 440 489 delete [] (*delIt)->data; 490 (*delIt)->data = NULL; 491 } 492 delete *delIt; 441 493 recvStates[userId].erase( delIt ); 442 494 … … 506 558 507 559 if ( (*delIt)->data ) 560 { 508 561 delete [] (*delIt)->data; 562 (*delIt)->data = NULL; 563 } 564 delete *delIt; 509 565 sentStates[userId].erase( delIt ); 510 566
Note: See TracChangeset
for help on using the changeset viewer.