Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 9, 2008, 4:35:38 AM (16 years ago)
Author:
landauf
Message:

big change in ObjectList: separated the class into a non-template base and a template wrapper for the base. this also changes the Iterator, there is now a non-template IteratorBase. this brings much more flexibility, like iterating through all objects of a given identifier without knowing the type. however this needs a dynamic_cast, which isn't quite optimal, but I think there are much worser things than that out there. ;)

there isn't much you have to know about this, except there is no more ObjectList<myClass>::start() function but a ObjectList<myClass>::begin() to be more STLish. another thing: ObjectList<myClass>::end() points now to the element _after_ the last element, so it's possible to iterate in a for-loop until (it != ObjectList<myClass>::end()). the reason is the same as above. however, (it) as a boolean still works perfectly fine.

File:
1 edited

Legend:

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

    r1534 r1574  
    6464{
    6565  //boost::thread_group network_threads;
    66  
     66
    6767  ConnectionManager::ConnectionManager():receiverThread_(0){}
    6868  boost::recursive_mutex ConnectionManager::enet_mutex_;
    69  
     69
    7070  ConnectionManager::ConnectionManager(ClientInformation *head) : receiverThread_(0) {
    7171    quit=false;
     
    7474    head_ = head;
    7575  }
    76  
     76
    7777  ConnectionManager::ConnectionManager(ClientInformation *head, int port){
    7878    quit=false;
     
    115115    return packet;
    116116  }*/
    117  
     117
    118118  ENetEvent *ConnectionManager::getEvent(){
    119119    if(!buffer.isEmpty())
     
    251251    }
    252252  }
    253  
     253
    254254  //### added some bugfixes here, but we cannot test them because
    255255  //### the server crashes everytime because of some gamestates
     
    333333  }
    334334
    335  
    336  
     335
     336
    337337  bool ConnectionManager::removeShip(ClientInformation *client){
    338338    int id=client->getShipID();
    339339    orxonox::Iterator<orxonox::SpaceShip> it;
    340     for(it = orxonox::ObjectList<orxonox::SpaceShip>::start(); it; ++it){
     340    for(it = orxonox::ObjectList<orxonox::SpaceShip>::begin(); it; ++it){
    341341      if(it->objectID!=id)
    342342        continue;
     
    345345    return true;
    346346  }
    347  
     347
    348348  bool ConnectionManager::sendWelcome(int clientID, int shipID, bool allowed){
    349349    if(addPacket(packet_gen.generateWelcome(clientID, shipID, allowed),clientID)){
     
    353353      return false;
    354354  }
    355  
     355
    356356  void ConnectionManager::disconnectClient(ClientInformation *client){
    357357    {
     
    362362    removeShip(client);
    363363  }
    364  
     364
    365365  bool ConnectionManager::addFakeConnectRequest(ENetEvent *ev){
    366366    ENetEvent event;
     
    369369    return buffer.push(&event);
    370370  }
    371  
    372  
     371
     372
    373373
    374374}
Note: See TracChangeset for help on using the changeset viewer.