Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 12, 2008, 11:44:01 PM (17 years ago)
Author:
scheusso
Message:

fixed a 'bug' in WE-Model-Spaceship

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network3/src/network/ConnectionManager.cc

    r1250 r1261  
    191191          //std::cout << "received data" << std::endl;
    192192          COUT(5) << "Con.Man: receive event has occured" << std::endl;
    193           processData(event);
     193          // only add, if client has connected yet and not been disconnected
     194          if(head_->findClient(&event->peer->address))
     195            processData(event);
    194196          break;
    195197        case ENET_EVENT_TYPE_DISCONNECT:
     
    354356  }
    355357 
     358  bool ConnectionManager::removeShip(ClientInformation *client){
     359    int id=client->getShipID();
     360    orxonox::Iterator<orxonox::SpaceShip> it;
     361    for(it = orxonox::ObjectList<orxonox::SpaceShip>::start(); it; ++it){
     362      if(it->objectID!=id)
     363        continue;
     364      delete *it;
     365    }
     366    return true;
     367  }
     368 
    356369  bool ConnectionManager::sendWelcome(int clientID, int shipID, bool allowed){
    357370    addPacket(packet_gen.generateWelcome(clientID, shipID, allowed),clientID);
    358371    sendPackets();
    359372    return true;
     373  }
     374 
     375  void ConnectionManager::disconnectClient(ClientInformation *client){
     376    enet_peer_disconnect(client->getPeer(), 0);
     377    removeShip(client);
    360378  }
    361379 
Note: See TracChangeset for help on using the changeset viewer.