Changeset 6678 in orxonox.OLD for branches/network/src/lib/network/network_manager.cc
- Timestamp:
- Jan 24, 2006, 10:22:33 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/network_manager.cc
r6672 r6678 20 20 #define DEBUG_MODULE_NETWORK 21 21 22 23 #include "network_stream.h"24 22 #include "class_list.h" 25 26 23 #include "debug.h" 27 24 #include "shell_command.h" … … 29 26 /* include your own header */ 30 27 #include "network_manager.h" 28 #include "shared_network_data.h" 29 #include "network_stream.h" 31 30 32 31 … … 52 51 this->syncList = NULL; 53 52 this->defaultSyncStream = NULL; 54 55 this->hostID = -1; 56 this->newUniqueID = MAX_CONNECTIONS + 2; 57 this->bGameServer = false; 53 this->sharedNetworkData = SharedNetworkData::getInstance(); 58 54 59 55 PRINTF(0)("NetworkManager created\n"); … … 102 98 103 99 this->defaultSyncStream = new NetworkStream(ipAddress); 100 this->sharedNetworkData->setDefaultSyncStream(this->defaultSyncStream); 104 101 this->defaultSyncStream->startHandshake(); 105 102 return 1; … … 113 110 int NetworkManager::createServer(unsigned int port) 114 111 { 115 this-> hostID = 0;116 this-> bGameServer = true;112 this->sharedNetworkData->setHostID(0); 113 this->sharedNetworkData->setGameServer(true); 117 114 this->defaultSyncStream = new NetworkStream(port); 115 this->sharedNetworkData->setDefaultSyncStream(this->defaultSyncStream); 118 116 this->defaultSyncStream->createNetworkGameManager(); 119 117 PRINTF(0)("CREATE SERVER\n"); 120 this->bGameServer = true;121 118 SDL_Delay(20); 122 119 return 1; 123 }124 125 126 /**127 * creates a connection from one object to a host128 * @param address: the address of the destination host129 * @param synchronizeable: reference to the sync object130 */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 connection141 */142 void NetworkManager::shutdownConnection()143 {144 PRINTF(0)("Shutdown connection\n");145 120 } 146 121 … … 167 142 } 168 143 169 /**170 * Sets the hostID to a specific number171 * @param id: The new ID172 */173 void NetworkManager::setHostID(int id)174 {175 this->hostID = id;176 }177 178 144 179 145
Note: See TracChangeset
for help on using the changeset viewer.