Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8153 in orxonox.OLD


Ignore:
Timestamp:
Jun 5, 2006, 3:25:05 PM (18 years ago)
Author:
rennerc
Message:

removed nasty bug

Location:
branches/network/src/lib/network
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/lib/network/network_game_manager.cc

    r8152 r8153  
    112112  stats->setPlayableUniqueId( playable.getUniqueID() );
    113113  stats->setModelFileName( playableModel );
     114 
     115  return true;
    114116}
    115117
     
    122124bool NetworkGameManager::signalLeftPlayer(int userID)
    123125{
    124   delete PlayerStats::getStats( userID )->getPlayable();
    125   delete PlayerStats::getStats( userID );
     126  if ( PlayerStats::getStats( userID ) )
     127  {
     128    if ( PlayerStats::getStats( userID )->getPlayable() )
     129      delete PlayerStats::getStats( userID )->getPlayable();
     130    delete PlayerStats::getStats( userID );
     131  }
     132 
     133  return true;
    126134}
    127135
     
    165173        return true;
    166174      }
    167        
     175     
    168176      delete dynamic_cast<Synchronizeable*>(*it);
    169177      return true;
  • branches/network/src/lib/network/network_stream.cc

    r8068 r8153  
    651651          }
    652652        }
     653       
    653654
    654655        int n = sync->setStateDiff( peer->second.userId, buf+offset, syncDataLength, state, fromState );
     
    664665      }
    665666     
    666       //TODO REMOVE THIS
    667       int saveOffset = offset;
    668667     
    669668      for ( SynchronizeableList::iterator it = synchronizeables.begin(); it != synchronizeables.end(); it++ )
     
    682681      assert( peer->second.lastRecvedState < state );
    683682      peer->second.lastRecvedState = state;
    684      
    685       assert( saveOffset == offset );
    686      
     683
    687684    }
    688685 
  • branches/network/src/lib/network/player_stats.cc

    r8147 r8153  
    2121#include "player.h"
    2222#include "state.h"
     23#include "shared_network_data.h"
    2324
    2425
     
    8586    this->setPlayableUniqueId( this->playableUniqueId );
    8687   
    87     PRINTF(0)("uniqueID changed %d %d\n", userId, getHostID());
     88    PRINTF(0)("uniqueID changed %d %d %d\n", userId, getHostID(), getUniqueID());
    8889  }
    8990}
     
    99100 
    100101  if ( !list )
     102  {
    101103    return NULL;
     104  }
    102105 
    103106  for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
     
    108111    }
    109112  }
    110  
    111   //TODO maybe we should create an object here
    112113 
    113114  return NULL;
     
    138139 
    139140  if ( this->playable && userId == getHostID() )
     141  {
    140142    State::getPlayer()->setPlayable( this->playable );
     143  }
    141144 
    142145  this->playableUniqueId = uniqueId;
  • branches/network/src/lib/network/synchronizeable.cc

    r8147 r8153  
    369369void Synchronizeable::cleanUpUser( int userId )
    370370{
    371   for ( UserStateHistory::iterator it = sentStates.begin(); it != sentStates.end(); it++ )
    372   {
    373     for ( StateHistory::iterator it2 = it->begin(); it2 != it->end(); it2++ )
    374     {
    375       if ( (*it2)->data )
    376         delete [] (*it2)->data;
    377       (*it2)->data = NULL;
    378      
    379       delete *it2;
    380     }
    381   }
    382  
    383   sentStates.clear();
    384  
    385   for ( UserStateHistory::iterator it = recvStates.begin(); it != recvStates.end(); it++ )
    386   {
    387     for ( StateHistory::iterator it2 = it->begin(); it2 != it->end(); it2++ )
    388     {
    389       if ( (*it2)->data )
    390         delete [] (*it2)->data;
    391       (*it2)->data = NULL;
    392      
    393       delete *it2;
    394     }
    395   }
    396  
    397   recvStates.clear();
     371  if ( recvStates.size() > userId )
     372  {
     373    for ( std::list<StateHistoryEntry*>::iterator it = recvStates[userId].begin(); it != recvStates[userId].end(); it++ )
     374    {
     375      if ( (*it)->data )
     376        delete [] (*it)->data;
     377      (*it)->data = NULL;
     378   
     379      delete *it;
     380    }
     381    recvStates[userId].clear();
     382  }
     383 
     384  if ( sentStates.size() > userId )
     385  {
     386   
     387    for ( std::list<StateHistoryEntry*>::iterator it = sentStates[userId].begin(); it != sentStates[userId].end(); it++ )
     388    {
     389      if ( (*it)->data )
     390        delete [] (*it)->data;
     391      (*it)->data = NULL;
     392   
     393      delete *it;
     394    }
     395    sentStates[userId].clear();
     396  }
    398397}
    399398
Note: See TracChangeset for help on using the changeset viewer.