WorldPlugin/WorldServer.cc
// WorldServer::AlreadyConnected
// A replacement of the old function, a BFS (Breath First Search)
// TODO: Need to be tested
:AlreadyConnected
A replacement of the old function, a BFS (Breath First Search)
TODO: Need to be tested
: AlreadyConnected A replacement of the old function a BFS ( Breath First Search ) TODO : Need to be tested
unsigned int WorldServer::CountModules(SmoresModulePtr module)
{
  std::queue<SmoresModulePtr> frontier;
  vector<SmoresModulePtr> cluster;
  frontier.push(module);
  while (frontier.size()>0) {
    if (std::find(cluster.begin(), cluster.end(), frontier.front())
        ==cluster.end()) {
      cluster.push_back(frontier.front());
      for (int i = 0; i < 4; ++i) {
        if (frontier.front()->GetNode(i)->Edge) {
          SmoresModulePtr connected_module = frontier.front()->GetNode(i)->Edge
              ->FindMatchingNode(frontier.front()->GetNode(i))->Parent;
          frontier.push(connected_module);
        }
      }
    }
    frontier.pop();
  }
  return cluster.size();
}
unsigned int WorldServer :: CountModules ( SmoresModulePtr module ) { std :: queue < SmoresModulePtr > frontier ; vector < SmoresModulePtr > cluster ; frontier . push ( module ) ; while ( frontier . size ( ) > 0 ) { if ( std :: find ( cluster . begin ( ) , cluster . end ( ) , frontier . front ( ) ) == cluster . end ( ) ) { cluster . push_back ( frontier . front ( ) ) ; for ( int i = 0 ; i < 4 ; ++ i ) { if ( frontier . front ( ) -> GetNode ( i ) -> Edge ) { SmoresModulePtr connected_module = frontier . front ( ) -> GetNode ( i ) -> Edge -> FindMatchingNode ( frontier . front ( ) -> GetNode ( i ) ) -> Parent ; frontier . push ( connected_module ) ; } } } frontier . pop ( ) ; } return cluster . size ( ) ; }
WorldServer::AlreadyConnected
A replacement of the old function, a BFS (Breath First Search)
TODO: Need to be tested
WorldServer :: AlreadyConnected A replacement of the old function a BFS ( Breath First Search ) TODO : Need to be tested