Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 13, 2008, 3:25:10 PM (16 years ago)
Author:
scheusso
Message:

sdfsdf

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

Legend:

Unmodified
Added
Removed
  • code/branches/network/src/network/Client.h

    r790 r888  
    1616#include <string>
    1717
     18#include "orxonox/objects/Tickable.h"
     19
    1820#include "NetworkPrereqs.h"
    1921#include "ClientConnection.h"
     
    2123#include "GameStateClient.h"
    2224//#include "NetworkFrameListener.h"
     25
    2326
    2427
     
    3235  *
    3336  */
    34   class _NetworkExport Client : PacketDecoder{
     37  class _NetworkExport Client : PacketDecoder, public orxonox::Tickable{
    3538  public:
    3639    Client();
  • code/branches/network/src/network/ConnectionManager.cc

    r790 r888  
    281281  }
    282282
     283 
     284 
     285  void ConnectionManager::addClientsObjectID( int clientID, int objectID ) {
     286    COUT(4) << "ship of client: " << clientID << ": " << objectID << " mapped" << std::endl;
     287    clientsShip.insert( std::make_pair( clientID, objectID ) );
     288  }
     289
     290  int ConnectionManager::getClientsShipID( int clientID ) {
     291    return clientsShip[clientID];
     292  }
     293
     294  int ConnectionManager::getObjectsClientID( int objectID ) {
     295    std::map<int, int>::iterator iter = clientsShip.begin();
     296    while( iter != clientsShip.end() ) {
     297      if( iter->second == objectID ) return iter->first;
     298    }
     299    return -99;
     300  }
     301
     302  void ConnectionManager::deleteClientIDReg( int clientID ) {
     303    clientsShip.erase( clientID );
     304  }
     305
     306  void ConnectionManager::deleteObjectIDReg( int objectID ) {
     307    std::map<int, int>::iterator iter = clientsShip.begin();
     308    while( iter != clientsShip.end() ) {
     309      if( iter->second == objectID ) break;
     310    }
     311    clientsShip.erase( iter->first );
     312  }
     313 
    283314}
  • code/branches/network/src/network/ConnectionManager.h

    r790 r888  
    1414
    1515#include <string>
     16#include <map>
    1617// enet library for networking support
    1718#include <enet/enet.h>
     
    7374    bool quit; // quit-variable (communication with threads)
    7475    ClientInformation *head_;
     76   
     77    //functions to map what object every clients uses
     78    std::map<int, int> clientsShip;
     79    void addClientsObjectID( int clientID, int objectID );
     80    int getClientsShipID( int clientID );
     81    int getObjectsClientID( int objectID );
     82    void deleteClientIDReg( int clientID );
     83    void deleteObjectIDReg( int objectID );
    7584  };
    7685
  • code/branches/network/src/network/Server.h

    r790 r888  
    1616#include <string>
    1717
     18#include "orxonox/objects/Tickable.h"
     19
    1820#include "PacketManager.h"
    1921#include "NetworkPrereqs.h"
     22
     23
    2024
    2125namespace network
     
    2529  * It implements all functions necessary for a Server
    2630  */
    27   class _NetworkExport Server : public PacketDecoder{
     31  class _NetworkExport Server : public PacketDecoder, public orxonox::Tickable{
    2832  public:
    2933    Server();
Note: See TracChangeset for help on using the changeset viewer.