Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 24, 2006, 10:22:33 PM (18 years ago)
Author:
patrick
Message:

network: sys better now, got less errors and removed the pnode link sync alg, replacing

File:
1 edited

Legend:

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

    r6672 r6678  
    2020#define DEBUG_MODULE_NETWORK
    2121
    22 
    23 #include "network_stream.h"
    2422#include "class_list.h"
    25 
    2623#include "debug.h"
    2724#include "shell_command.h"
     
    2926/* include your own header */
    3027#include "network_manager.h"
     28#include "shared_network_data.h"
     29#include "network_stream.h"
    3130
    3231
     
    5251  this->syncList = NULL;
    5352  this->defaultSyncStream = NULL;
    54 
    55   this->hostID = -1;
    56   this->newUniqueID = MAX_CONNECTIONS + 2;
    57   this->bGameServer = false;
     53  this->sharedNetworkData = SharedNetworkData::getInstance();
    5854
    5955  PRINTF(0)("NetworkManager created\n");
     
    10298
    10399  this->defaultSyncStream = new NetworkStream(ipAddress);
     100  this->sharedNetworkData->setDefaultSyncStream(this->defaultSyncStream);
    104101  this->defaultSyncStream->startHandshake();
    105102  return 1;
     
    113110int NetworkManager::createServer(unsigned int port)
    114111{
    115   this->hostID = 0;
    116   this->bGameServer = true;
     112  this->sharedNetworkData->setHostID(0);
     113  this->sharedNetworkData->setGameServer(true);
    117114  this->defaultSyncStream = new NetworkStream(port);
     115  this->sharedNetworkData->setDefaultSyncStream(this->defaultSyncStream);
    118116  this->defaultSyncStream->createNetworkGameManager();
    119117  PRINTF(0)("CREATE SERVER\n");
    120   this->bGameServer = true;
    121118  SDL_Delay(20);
    122119  return 1;
    123 }
    124 
    125 
    126 /**
    127  *  creates a connection from one object to a host
    128  * @param address: the address of the destination host
    129  * @param synchronizeable: reference to the sync object
    130  */
    131 NetworkStream& NetworkManager::establishConnection(IPaddress& address, Synchronizeable& sync)
    132 {
    133   /* creating a new network stream, it will register itself automaticaly to the class list */
    134   this->defaultSyncStream = new NetworkStream(address);
    135   this->defaultSyncStream->connectSynchronizeable(sync);
    136 }
    137 
    138 
    139 /**
    140  *  teardown a connection
    141  */
    142 void NetworkManager::shutdownConnection()
    143 {
    144   PRINTF(0)("Shutdown connection\n");
    145120}
    146121
     
    167142}
    168143
    169 /**
    170  * Sets the hostID to a specific number
    171  * @param id: The new ID
    172  */
    173 void NetworkManager::setHostID(int id)
    174 {
    175     this->hostID = id;
    176 }
    177 
    178144
    179145
Note: See TracChangeset for help on using the changeset viewer.