/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. ### File Specific: main-programmer: Patrick Boenzli */ #include "network_node.h" #include "debug.h" /** * constructor */ NetworkNode::NetworkNode(PeerInfo* pInfo) { this->playerNumber = 0; this->peerInfo = pInfo; } /** * deconstructor */ NetworkNode::~NetworkNode() {} /** * adds a client */ void NetworkNode::addClient(PeerInfo* node) { this->clientList.push_back(node); this->playerNumber++; } /** * adds a proxy server */ void NetworkNode::addProxyServer(PeerInfo* node) { this->proxyServerList.push_back(node); this->playerNumber++; } /** * adds a master server */ void NetworkNode::addMasterServer(PeerInfo* node) { this->masterServerList.push_back(node); this->playerNumber++; } /** * removes a client */ void NetworkNode::removeClient(PeerInfo* node) { std::list::iterator it = this->clientList.begin(); for(; it != this->clientList.end(); it++) { if( *it == node) { this->clientList.erase(it); this->playerNumber--; return; } } PRINTF(2)("Could not remove client from the list, very strange..."); } /** * removes a proxy server */ void NetworkNode::removeProxyServer(PeerInfo* node) { std::list::iterator it = this->proxyServerList.begin(); for(; it != this->proxyServerList.end(); it++) { if( *it == node) { this->proxyServerList.erase(it); this->playerNumber--; return; } } PRINTF(2)("Could not remove proxy server from the list, very strange..."); } /** * removes a master server */ void NetworkNode::removeMasterServer(PeerInfo* node) { std::list::iterator it = this->masterServerList.begin(); for(; it != this->masterServerList.end(); it++) { if( *it == node) { this->masterServerList.erase(it); this->playerNumber--; return; } } PRINTF(2)("Could not remove client from the list, very strange..."); }