Changeset 1735 for code/trunk
- Timestamp:
- Sep 7, 2008, 5:03:10 PM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 15 deleted
- 21 edited
- 21 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/bin/run-script
r1505 r1735 22 22 fi 23 23 fi 24 trap "xset r" EXIT HUP INT TERM ABRT KILL 25 exec ./orxonox $@ 24 25 trap "xset r && echo 'resetting autorepeat'" HUP INT TERM QUIT ABRT KILL ALRM 26 ./orxonox $@ -
code/trunk/src/core/input/InputManager.cc
r1555 r1735 118 118 //paramList.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_NONEXCLUSIVE"))); 119 119 //paramList.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_FOREGROUND"))); 120 //#if defined OIS_LINUX_PLATFORM121 //paramList.insert(std::make_pair(std::string("XAutoRepeatOn"), std::string("true")));122 //#endif120 #if defined OIS_LINUX_PLATFORM 121 paramList.insert(std::make_pair(std::string("XAutoRepeatOn"), std::string("true"))); 122 #endif 123 123 124 124 try … … 723 723 if (iKey == keysDown_.size()) 724 724 keysDown_.push_back(Key(e)); 725 else 726 return true; 725 727 726 728 // update modifiers -
code/trunk/src/network/CMakeLists.txt
r1505 r1735 4 4 ClientInformation.cc 5 5 ConnectionManager.cc 6 GameStateManager.cc 7 GameStateClient.cc 6 GamestateManager.cc 7 GamestateClient.cc 8 GamestateHandler.cc 8 9 PacketBuffer.cc 9 PacketDecoder.cc10 PacketGenerator.cc11 10 Server.cc 12 11 Synchronisable.cc 12 Host.cc 13 packet/Packet.cc 14 packet/Chat.cc 15 packet/ClassID.cc 16 packet/Acknowledgement.cc 17 packet/Gamestate.cc 18 packet/Welcome.cc 19 Host.cc 13 20 ) 14 21 … … 31 38 ##### test for gamestate stuff ##### 32 39 SET( TEST_SRC_FILES 33 ConnectionManager.cc 34 GameStateManager.cc 35 PacketBuffer.cc 36 PacketDecoder.cc 37 PacketGenerator.cc 38 ClientConnection.cc 39 ClientInformation.cc 40 diffTest.cc 41 GameStateClient.cc 42 Server.cc 43 Client.cc 44 Synchronisable.cc 40 ${NETWORK_SRC_FILES} 45 41 ) 46 47 42 ADD_EXECUTABLE(networktest ${TEST_SRC_FILES}) 48 43 TARGET_LINK_LIBRARIES( networktest … … 55 50 ##### end test for gamestate stuff ##### 56 51 ENDIF(NETWORK_TESTING_ENABLED) 57 # build this if you want dummyserver4 and dummyclient458 IF(NETWORKTRAFFIC_TESTING_ENABLED)59 ##### test network traffic #####60 SET( DUMMYSERVER4_SRC_FILES61 ConnectionManager.cc62 GameStateManager.cc63 PacketBuffer.cc64 PacketDecoder.cc65 PacketGenerator.cc66 ClientConnection.cc67 ClientInformation.cc68 GameStateClient.cc69 Server.cc70 Client.cc71 Synchronisable.cc72 dummyserver4.cc73 )74 75 SET( DUMMYCLIENT4_SRC_FILES76 ConnectionManager.cc77 GameStateManager.cc78 PacketBuffer.cc79 PacketDecoder.cc80 PacketGenerator.cc81 ClientConnection.cc82 ClientInformation.cc83 GameStateClient.cc84 Server.cc85 Client.cc86 Synchronisable.cc87 dummyclient4.cc88 )89 90 ADD_EXECUTABLE(dummyserver4 ${DUMMYSERVER4_SRC_FILES})91 TARGET_LINK_LIBRARIES( dummyserver492 network93 ${ENet_LIBRARY}94 ${ZLIB_LIBRARY}95 ${WINDOWS_ENET_DEPENDENCIES}96 ${Boost_thread_LIBRARIES}97 core98 orxonoxs99 audio100 )101 102 ADD_EXECUTABLE(dummyclient4 ${DUMMYCLIENT4_SRC_FILES})103 TARGET_LINK_LIBRARIES( dummyclient4104 network105 ${ENet_LIBRARY}106 ${ZLIB_LIBRARY}107 ${WINDOWS_ENET_DEPENDENCIES}108 ${Boost_thread_LIBRARIES}109 core110 orxonoxs111 audio112 )113 ENDIF(NETWORKTRAFFIC_TESTING_ENABLED)114 115 IF(BLABLA)116 SET( CHATCLIENT_SRC_FILES117 ClientConnection.cc118 Client.cc119 PacketBuffer.cc120 PacketDecoder.cc121 PacketGenerator.cc122 dummyclient3.cc123 )124 125 SET( CHATSERVER_SRC_FILES126 ConnectionManager.cc127 GameStateManager.cc128 PacketBuffer.cc129 PacketDecoder.cc130 PacketGenerator.cc131 dummyserver3.cc132 )133 134 # chatserver for testing purposes135 ADD_EXECUTABLE(chatserver ${CHATSERVER_SRC_FILES})136 TARGET_LINK_LIBRARIES( chatserver137 ${OGRE_LIBRARIES}138 network139 core140 #objects141 ${ENet_LIBRARY}142 ${ZLIB_LIBRARY}143 ${WINDOWS_ENET_DEPENDENCIES}144 )145 146 # chatclient for testing purpose147 ADD_EXECUTABLE(chatclient ${CHATCLIENT_SRC_FILES})148 TARGET_LINK_LIBRARIES( chatclient149 ${OGRE_LIBRARIES}150 network151 core152 #objects153 ${ENet_LIBRARY}154 ${ZLIB_LIBRARY}155 ${WINDOWS_ENET_DEPENDENCIES}156 )157 158 # client for testing purpose159 ADD_EXECUTABLE(client dummyclient2.cc)160 TARGET_LINK_LIBRARIES( client161 ${OGRE_LIBRARIES}162 network163 core164 #objects165 ${ENet_LIBRARY}166 ${ZLIB_LIBRARY}167 ${WINDOWS_ENET_DEPENDENCIES}168 )169 170 # server for testing purpose171 ADD_EXECUTABLE(server dummyserver.cc)172 TARGET_LINK_LIBRARIES( server173 ${OGRE_LIBRARIES}174 network175 core176 #objects177 ${ENet_LIBRARY}178 ${ZLIB_LIBRARY}179 ${WINDOWS_ENET_DEPENDENCIES}180 )181 ENDIF(BLABLA)182 -
code/trunk/src/network/Client.cc
r1534 r1735 40 40 41 41 #include "Client.h" 42 #include "Host.h" 42 43 #include "Synchronisable.h" 43 44 #include "core/CoreIncludes.h" 44 45 #include "core/ConsoleCommand.h" 45 #include "Server.h" 46 #include "packet/Packet.h" 47 #include "packet/Acknowledgement.h" 46 48 47 49 namespace network 48 50 { 49 SetConsoleCommandShortcut(Client, Chat);51 // SetConsoleCommandShortcut(Client, chat); 50 52 51 Client* Client::_sClient = 0;52 53 Client* Client::createSingleton(){54 if(!_sClient){55 _sClient = new Client();56 }57 return _sClient;58 }59 60 Client* Client::createSingleton(std::string address, int port){61 if(!_sClient)62 _sClient = new Client(address, port);63 return _sClient;64 }65 66 Client* Client::createSingleton(const char *address, int port){67 if(!_sClient)68 _sClient = new Client(address, port);69 return _sClient;70 }71 72 void Client::destroySingleton(){73 if(_sClient){74 delete _sClient;75 _sClient = 0;76 }77 }78 79 Client* Client::getSingleton(){80 return _sClient;81 }82 53 83 54 /** … … 144 115 } 145 116 117 bool Client::queuePacket(ENetPacket *packet, int clientID){ 118 return client_connection.addPacket(packet); 119 } 146 120 147 148 void Client::Chat( std::string message ){ 149 if(Client::getSingleton()) 150 Client::getSingleton()->sendChat(message); 151 else if(Server::getSingleton()) 152 Server::getSingleton()->sendChat(message); 153 else 154 COUT(1) << "do you want to monologize ??" << std::endl; 121 bool Client::processChat(packet::Chat *message, unsigned int clientID){ 122 return message->process(); 155 123 } 124 125 /*bool Client::sendChat(packet::Chat *chat){ 126 chat->process(); 127 packet::Packet *p = new packet::Packet(chat); 128 return p->send(); 129 }*/ 156 130 157 131 … … 165 139 if(!isConnected) 166 140 return false; 167 return client_connection.addPacket(pck_gen.chatMessage( message.c_str() ));168 //return client_connection.sendPackets();141 packet::Chat chat(message, 0); 142 return chat.send(); 169 143 // send packets 170 return false;171 144 } 172 145 … … 178 151 if(client_connection.isConnected() && isSynched_){ 179 152 COUT(4) << "popping partial gamestate: " << std::endl; 180 GameStateCompressed *gs = gamestate.popPartialGameState();153 /*packet::Gamestate *gs = gamestate.getGamestate(); 181 154 if(gs){ 182 155 COUT(4) << "client tick: sending gs " << gs << std::endl; 183 ENetPacket *packet = pck_gen.gstate(gs); 184 if( packet == NULL || !client_connection.addPacket(packet)) 156 if( !gs->send() ) 185 157 COUT(3) << "Problem adding partial gamestate to queue" << std::endl; 186 // now delete it to save memory 187 delete[] gs->data; 188 delete gs; 189 } 158 // gs gets automatically deleted by enet callback 159 }*/ 190 160 } 191 161 ENetEvent *event; … … 194 164 event = client_connection.getEvent(); 195 165 COUT(5) << "tick packet size " << event->packet->dataLength << std::endl; 196 elaborate(event->packet, 0); // ================= i guess we got to change this .... (client_ID is always same = server) 166 packet::Packet *packet = packet::Packet::createPacket(event->packet, event->peer); 167 assert(packet->process()); 197 168 } 198 int gameStateID = gamestate.processGame State();199 if(gameStateID==GAMESTATEID_INITIAL)169 int gameStateID = gamestate.processGamestates(); 170 /*if(gameStateID==GAMESTATEID_INITIAL) 200 171 if(gameStateFailure_){ 201 if(!client_connection.addPacket(pck_gen.acknowledgement(GAMESTATEID_INITIAL))) 172 packet::Acknowledgement ack(GAMESTATEID_INITIAL, 0); 173 if(!ack.send()) 202 174 COUT(3) << "could not (negatively) ack gamestate" << std::endl; 203 175 else … … 211 183 isSynched_=true; 212 184 gameStateFailure_=false; 213 if(!client_connection.addPacket(pck_gen.acknowledgement(gameStateID))) 185 packet::Acknowledgement ack(gameStateID, 0); 186 if(!ack.send()) 214 187 COUT(3) << "could not ack gamestate" << std::endl; 215 } // otherwise we had no gamestate to load188 }*/// otherwise we had no gamestate to load 216 189 gamestate.cleanup(); 217 /*if(!client_connection.sendPackets())218 COUT(3) << "Problem sending packets to server" << std::endl;*/219 190 return; 220 191 } 221 192 222 void Client::processGamestate( GameStateCompressed *data, int clientID){223 COUT(5) << "received gamestate id: " << data->id << std::endl;224 gamestate.addGameState(data);225 }226 227 void Client::processClassid(classid *clid){228 orxonox::Identifier *id;229 id=ID(std::string(clid->message));230 if(id!=NULL)231 id->setNetworkID(clid->clid);232 COUT(4) << "Client: received and set network id: " << clid->clid << "; classname: " << clid->message << std::endl;233 COUT(4) << "id(classid)->getName " << ID((unsigned int)clid->clid)->getName() << std::endl;234 delete clid;235 return;236 }237 238 void Client::processChat( chat *data, int clientId){239 COUT(1) << data->message << std::endl;240 delete[] data->message;241 delete data;242 }243 244 bool Client::processWelcome( welcome *w ){245 COUT(4) << "processing welcome message" << std::endl;246 clientID_ = w->clientID;247 shipID_ = w->shipID;248 delete w;249 return true;250 }251 252 193 } -
code/trunk/src/network/Client.h
r1535 r1735 46 46 #include <string> 47 47 48 #include "Host.h" 49 #include "packet/Chat.h" 48 50 #include "ClientConnection.h" 49 #include "PacketManager.h" 50 #include "GameStateClient.h" 51 #include "GamestateClient.h" 51 52 //#include "NetworkFrameListener.h" 52 53 … … 62 63 * 63 64 */ 64 class _NetworkExport Client : PacketDecoder{65 class _NetworkExport Client : public Host{ 65 66 public: 66 67 static Client* createSingleton();68 static Client* createSingleton(std::string address, int port);69 static Client* createSingleton(const char *address, int port);70 static void destroySingleton();71 static Client *getSingleton();72 73 bool establishConnection();74 bool closeConnection();75 76 static void Chat( std::string message );77 78 int getShipID(){return shipID_;}79 int getClientID(){return clientID_;}80 81 void tick(float time);82 83 private:84 67 Client(); 85 68 Client(std::string address, int port); … … 87 70 ~Client(); 88 71 89 static Client* _sClient; 72 bool establishConnection(); 73 bool closeConnection(); 74 bool queuePacket(ENetPacket *packet, int clientID); 75 bool processChat(packet::Chat *message, unsigned int clientID); 76 //bool sendChat(packet::Chat *chat); 77 78 // static void Chat( std::string message ); 79 80 unsigned int shipID(){return shipID_;} 81 int playerID(){return clientID_;} 82 //static void setShipID( unsigned int shipID){ dynamic_cast<Client *>(instance_)->shipID_=shipID; } 83 static void setClientID( unsigned int clientID){ dynamic_cast<Client *>(instance_)->clientID_=clientID; } 84 85 void tick(float time); 86 87 private: 90 88 91 89 ClientConnection client_connection; 92 PacketGenerator pck_gen; 93 GameStateClient gamestate; 90 GamestateClient gamestate; 94 91 bool isConnected; 95 92 bool isSynched_; … … 98 95 99 96 // implement data processing functions of PacketDecoder 100 void processGamestate( GameStateCompressed *data, int clientID); 101 void processClassid(classid *clid); 102 void processChat( chat *data, int clientId ); 103 bool processWelcome( welcome *w ); 97 // void processChat( chat *data, int clientId ); 104 98 int clientID_; // this is the id the server gave to us 105 99 int shipID_; -
code/trunk/src/network/ClientInformation.cc
r1534 r1735 46 46 { 47 47 48 ClientInformation *ClientInformation::head_=0; 49 48 50 ClientInformation::ClientInformation() { 51 if(!head_) 52 head_=this; 49 53 gamestateID_=GAMESTATEID_INITIAL; 50 54 preve=0; 51 55 nexte=0; 52 56 partialGamestateID_=GAMESTATEID_INITIAL-1; 53 this->head_=false;54 57 synched_=false; 55 58 } 56 59 57 ClientInformation::ClientInformation(bool head) {58 gamestateID_=GAMESTATEID_INITIAL;59 preve=0;60 nexte=0;61 partialGamestateID_=GAMESTATEID_INITIAL-1;62 this->head_=head;63 synched_=false;64 }65 66 // ClientInformation::ClientInformation(ClientInformation *prev) {67 // if(prev->next()!=0){68 // this->nexte=prev->next();69 // this->nexte->setPrev(this);70 // }71 // else72 // this->nexte = 0;73 // prev->setNext(this);74 // this->preve = pref;75 // }76 //77 // ClientInformation::ClientInformation(ClientInformation *prev, ClientInformation *next){78 // this->nexte = next;79 // this->preve = prev;80 // this->preve->setNext(this);81 // this->nexte->setPrev(this);82 // }83 84 60 ClientInformation::~ClientInformation() { 61 if(this==head_) 62 head_=next(); 85 63 if(prev()!=0) 86 64 prev()->setNext(this->next()); … … 103 81 104 82 bool ClientInformation::setPrev(ClientInformation *prev) { 105 if(!head_) 106 this->preve = prev; 107 else 108 return false; 83 if(this==head_) 84 head_=prev; 85 this->preve = prev; 109 86 return true; 110 87 } … … 146 123 } 147 124 148 bool ClientInformation::setGame StateID(int id){125 bool ClientInformation::setGamestateID(int id){ 149 126 if(!this) 150 127 return false; … … 172 149 else 173 150 return NULL; 174 }175 176 bool ClientInformation::getHead(){177 return head_;178 }179 180 void ClientInformation::setHead(bool h){181 head_=h;182 151 } 183 152 … … 215 184 216 185 ClientInformation *ClientInformation::insertBack(ClientInformation *ins) { 217 if(!this) 218 return NULL; 219 ClientInformation *temp = this; 186 ClientInformation *temp = head_; 187 if(temp==head_){ 188 return head_; 189 } 220 190 while(temp->next()!=0){ 221 191 temp = temp->next(); … … 227 197 228 198 bool ClientInformation::removeClient(int clientID) { 229 if( !this ||clientID==CLIENTID_UNKNOWN)230 return false; 231 ClientInformation *temp = this;199 if(clientID==CLIENTID_UNKNOWN) 200 return false; 201 ClientInformation *temp = head_; 232 202 while(temp!=0 && temp->getID()!=clientID) 233 203 temp = temp->next(); … … 239 209 240 210 bool ClientInformation::removeClient(ENetPeer *peer) { 241 if(! this || !peer)242 return false; 243 ClientInformation *temp = this;211 if(!peer) 212 return false; 213 ClientInformation *temp = head_; 244 214 while(temp!=0){ 245 if(!temp->head_) 246 if(temp->getPeer()->address.host==peer->address.host && temp->getPeer()->address.port==peer->address.port) 247 break; 215 if(temp->getPeer()->address.host==peer->address.host && temp->getPeer()->address.port==peer->address.port) 216 break; 248 217 temp = temp->next(); 249 218 } … … 261 230 */ 262 231 ClientInformation *ClientInformation::findClient(int clientID, bool look_backwards) { 263 ClientInformation *temp = this; 264 if (temp->head_) 265 temp=temp->next(); 232 ClientInformation *temp = head_; 266 233 while(temp!=0 && temp->getID()!=clientID){ 267 234 temp = temp->next(); … … 278 245 */ 279 246 ClientInformation *ClientInformation::findClient(ENetAddress *address, bool look_backwards) { 280 ClientInformation *temp = this;247 ClientInformation *temp = head_; 281 248 while(temp!=0){ 282 if(temp->head_){283 temp = temp->next();284 continue;285 }286 249 if(temp->getPeer()->address.host==address->host && temp->getPeer()->address.port == address->port) 287 250 break; -
code/trunk/src/network/ClientInformation.h
r1534 r1735 60 60 public: 61 61 ClientInformation(); 62 ClientInformation(bool head);63 62 // ClientInformation(ClientInformation *prev, ClientInformation *next); 64 63 // ClientInformation(ClientInformation *prev); … … 66 65 ClientInformation *next(); 67 66 ClientInformation *prev(); 68 ClientInformation *insertBack(ClientInformation *ins);67 static ClientInformation *insertBack(ClientInformation *ins); 69 68 70 69 // set functions 71 70 void setID(int clientID); 72 71 bool setPeer(ENetPeer *peer); 73 bool setGame StateID(int id);72 bool setGamestateID(int id); 74 73 bool setPartialGamestateID(int id); 75 inline void setShipID( int id){ShipID_=id;}74 inline void setShipID(unsigned int id){ShipID_=id;} 76 75 77 76 // get functions 78 inline int getShipID(){return ShipID_;}77 inline unsigned int getShipID(){return ShipID_;} 79 78 int getID(); 80 79 int getGamestateID(); 81 80 int getPartialGamestateID(); 82 81 ENetPeer *getPeer(); 83 bool getHead();84 void setHead(bool h);85 82 86 83 int getFailures(); … … 90 87 enet_uint32 getPacketLoss(); 91 88 92 bool removeClient(int clientID); 93 bool removeClient(ENetPeer *peer); 94 //## add bool mask-function eventually 95 ClientInformation *findClient(int clientID, bool look_backwards=false); 96 //## add bool mask-function eventually 97 ClientInformation *findClient(ENetAddress *address, bool look_backwards=false); 89 static bool removeClient(int clientID); 90 static bool removeClient(ENetPeer *peer); 91 static ClientInformation *findClient(int clientID, bool look_backwards=false); 92 static ClientInformation *findClient(ENetAddress *address, bool look_backwards=false); 93 static ClientInformation *getBegin(){return head_;} 98 94 99 95 bool setSynched(bool s); … … 101 97 102 98 103 private: 104 bool setNext(ClientInformation *next); 105 bool setPrev(ClientInformation *prev); 99 private: 100 static ClientInformation *head_; 101 102 bool setNext(ClientInformation *next); 103 bool setPrev(ClientInformation *prev); 106 104 ClientInformation *insertAfter(ClientInformation *ins); 107 105 ClientInformation *insertBefore(ClientInformation *ins); … … 114 112 int gamestateID_; 115 113 int partialGamestateID_; 116 int ShipID_; // this is the unique objectID114 unsigned int ShipID_; // this is the unique objectID 117 115 bool synched_; 118 bool head_;119 116 unsigned short failures_; 120 117 -
code/trunk/src/network/ConnectionManager.cc
r1534 r1735 39 39 40 40 #include <iostream> 41 #include <assert.h> 41 42 // boost.thread library for multithreading support 42 43 #include <boost/bind.hpp> … … 50 51 #include "ConnectionManager.h" 51 52 #include "Synchronisable.h" 53 #include "packet/ClassID.h" 52 54 53 55 namespace std … … 65 67 //boost::thread_group network_threads; 66 68 67 ConnectionManager::ConnectionManager():receiverThread_(0){} 68 boost::recursive_mutex ConnectionManager::enet_mutex_; 69 70 ConnectionManager::ConnectionManager(ClientInformation *head) : receiverThread_(0) { 69 ConnectionManager *ConnectionManager::instance_=0; 70 71 ConnectionManager::ConnectionManager():receiverThread_(0){ 72 assert(instance_==0); 73 instance_=this; 71 74 quit=false; 72 75 bindAddress.host = ENET_HOST_ANY; 73 76 bindAddress.port = NETWORK_PORT; 74 head_ = head; 75 } 76 77 ConnectionManager::ConnectionManager(ClientInformation *head, int port){ 77 } 78 boost::recursive_mutex ConnectionManager::enet_mutex; 79 80 // ConnectionManager::ConnectionManager(ClientInformation *head) : receiverThread_(0) { 81 // assert(instance_==0); 82 // instance_=this; 83 // quit=false; 84 // bindAddress.host = ENET_HOST_ANY; 85 // bindAddress.port = NETWORK_PORT; 86 // } 87 88 ConnectionManager::ConnectionManager(int port){ 89 assert(instance_==0); 90 instance_=this; 78 91 quit=false; 79 92 bindAddress.host = ENET_HOST_ANY; 80 93 bindAddress.port = port; 81 head_ = head; 82 } 83 84 ConnectionManager::ConnectionManager(int port, std::string address, ClientInformation *head) :receiverThread_(0) { 94 } 95 96 ConnectionManager::ConnectionManager(int port, std::string address) :receiverThread_(0) { 97 assert(instance_==0); 98 instance_=this; 85 99 quit=false; 86 100 enet_address_set_host (& bindAddress, address.c_str()); 87 101 bindAddress.port = NETWORK_PORT; 88 head_ = head; 89 } 90 91 ConnectionManager::ConnectionManager(int port, const char *address, ClientInformation *head) : receiverThread_(0) { 102 } 103 104 ConnectionManager::ConnectionManager(int port, const char *address) : receiverThread_(0) { 105 assert(instance_==0); 106 instance_=this; 92 107 quit=false; 93 108 enet_address_set_host (& bindAddress, address); 94 109 bindAddress.port = NETWORK_PORT; 95 head_ = head; 110 } 111 112 ConnectionManager::~ConnectionManager(){ 113 instance_=0; 114 if(!quit) 115 quitListener(); 96 116 } 97 117 … … 140 160 return true; 141 161 } 142 162 163 // bool ConnectionManager::addPacket(Packet::Packet *packet){ 164 // ClientInformation *temp = instance_->head_->findClient(packet->getClientID()); 165 // if(!temp){ 166 // COUT(3) << "C.Man: addPacket findClient failed" << std::endl; 167 // return false; 168 // } 169 // ENetPacket *packet = new ENetPacket; 170 // // TODO: finish implementation 171 // } 172 // 173 143 174 bool ConnectionManager::addPacket(ENetPacket *packet, ENetPeer *peer) { 144 ClientInformation *temp = head_->findClient(&(peer->address)); 145 if(!temp) 146 return false; 147 boost::recursive_mutex::scoped_lock lock(enet_mutex_); 148 if(enet_peer_send(peer, (enet_uint8)temp->getID() , packet)!=0) 175 boost::recursive_mutex::scoped_lock lock(instance_->enet_mutex); 176 if(enet_peer_send(peer, NETWORK_DEFAULT_CHANNEL, packet)!=0) 149 177 return false; 150 178 return true; … … 152 180 153 181 bool ConnectionManager::addPacket(ENetPacket *packet, int clientID) { 154 ClientInformation *temp = head_->findClient(clientID);182 ClientInformation *temp = ClientInformation::findClient(clientID); 155 183 if(!temp){ 156 184 COUT(3) << "C.Man: addPacket findClient failed" << std::endl; 157 185 return false; 158 186 } 159 boost::recursive_mutex::scoped_lock lock(enet_mutex_); 160 if(enet_peer_send(temp->getPeer(), 0, packet)!=0){ 161 COUT(3) << "C.Man: addPacket enet_peer_send failed" << std::endl; 162 return false; 163 } 164 return true; 187 return addPacket(packet, temp->getPeer()); 165 188 } 166 189 167 190 bool ConnectionManager::addPacketAll(ENetPacket *packet) { 168 boost::recursive_mutex::scoped_lock lock(enet_mutex_); 169 for(ClientInformation *i=head_->next(); i!=0; i=i->next()){ 191 if(!instance_) 192 return false; 193 boost::recursive_mutex::scoped_lock lock(instance_->enet_mutex); 194 for(ClientInformation *i=ClientInformation::getBegin()->next(); i!=0; i=i->next()){ 170 195 COUT(3) << "adding broadcast packet for client: " << i->getID() << std::endl; 171 196 if(enet_peer_send(i->getPeer(), 0, packet)!=0) … … 177 202 // we actually dont need that function, because host_service does that for us 178 203 bool ConnectionManager::sendPackets() { 179 if(server==NULL )180 return false; 181 boost::recursive_mutex::scoped_lock lock(enet_mutex _);204 if(server==NULL || !instance_) 205 return false; 206 boost::recursive_mutex::scoped_lock lock(enet_mutex); 182 207 enet_host_flush(server); 183 208 lock.unlock(); … … 190 215 atexit(enet_deinitialize); 191 216 { //scope of the mutex 192 boost::recursive_mutex::scoped_lock lock(enet_mutex _);217 boost::recursive_mutex::scoped_lock lock(enet_mutex); 193 218 enet_initialize(); 194 219 server = enet_host_create(&bindAddress, NETWORK_MAX_CONNECTIONS, 0, 0); … … 204 229 while(!quit){ 205 230 { //mutex scope 206 boost::recursive_mutex::scoped_lock lock(enet_mutex _);231 boost::recursive_mutex::scoped_lock lock(enet_mutex); 207 232 if(enet_host_service(server, event, NETWORK_WAIT_TIMEOUT)<0){ 208 233 // we should never reach this point … … 246 271 // if we're finishied, destroy server 247 272 { 248 boost::recursive_mutex::scoped_lock lock(enet_mutex _);273 boost::recursive_mutex::scoped_lock lock(enet_mutex); 249 274 enet_host_destroy(server); 250 275 lock.unlock(); … … 257 282 void ConnectionManager::disconnectClients() { 258 283 ENetEvent event; 259 ClientInformation *temp = head_->next();284 ClientInformation *temp = ClientInformation::getBegin()->next(); 260 285 while(temp!=0){ 261 286 { 262 boost::recursive_mutex::scoped_lock lock(enet_mutex _);287 boost::recursive_mutex::scoped_lock lock(enet_mutex); 263 288 enet_peer_disconnect(temp->getPeer(), 0); 264 289 lock.unlock(); … … 267 292 } 268 293 //bugfix: might be the reason why server crashes when clients disconnects 269 temp = head_->next();270 boost::recursive_mutex::scoped_lock lock(enet_mutex _);294 temp = ClientInformation::getBegin()->next(); 295 boost::recursive_mutex::scoped_lock lock(enet_mutex); 271 296 while( temp!=0 && enet_host_service(server, &event, NETWORK_WAIT_TIMEOUT) >= 0){ 272 297 switch (event.type) … … 279 304 case ENET_EVENT_TYPE_DISCONNECT: 280 305 COUT(4) << "disconnecting all clients" << std::endl; 281 if( head_->findClient(&(event.peer->address)))282 delete head_->findClient(&(event.peer->address));306 if(ClientInformation::findClient(&(event.peer->address))) 307 delete ClientInformation::findClient(&(event.peer->address)); 283 308 //maybe needs bugfix: might also be a reason for the server to crash 284 309 temp = temp->next(); … … 302 327 303 328 int ConnectionManager::getClientID(ENetAddress address) { 304 return head_->findClient(&address)->getID();329 return ClientInformation::findClient(&address)->getID(); 305 330 } 306 331 307 332 ENetPeer *ConnectionManager::getClientPeer(int clientID) { 308 return head_->findClient(clientID)->getPeer(); 309 } 310 311 void ConnectionManager::syncClassid(int clientID) { 333 return ClientInformation::findClient(clientID)->getPeer(); 334 } 335 336 /** 337 * 338 * @param clientID 339 */ 340 void ConnectionManager::syncClassid(unsigned int clientID) { 312 341 unsigned int network_id=0, failures=0; 313 342 std::string classname; … … 324 353 COUT(4) << "Con.Man:syncClassid:\tnetwork_id: " << network_id << ", classname: " << classname << std::endl; 325 354 326 while(!addPacket(packet_gen.clid( (int)network_id, classname ), clientID) && failures < 10){ 355 packet::ClassID *classid = new packet::ClassID( network_id, classname ); 356 classid->setClientID(clientID); 357 while(!classid->send() && failures < 10){ 327 358 failures++; 328 359 } … … 336 367 337 368 bool ConnectionManager::removeShip(ClientInformation *client){ 338 int id=client->getShipID();369 unsigned int id=client->getShipID(); 339 370 orxonox::Iterator<orxonox::SpaceShip> it; 340 371 for(it = orxonox::ObjectList<orxonox::SpaceShip>::start(); it; ++it){ … … 346 377 } 347 378 348 bool ConnectionManager::sendWelcome(int clientID, int shipID, bool allowed){349 if(addPacket(packet_gen.generateWelcome(clientID, shipID, allowed),clientID)){350 //sendPackets();351 return true;352 }else353 return false;354 }355 379 356 380 void ConnectionManager::disconnectClient(ClientInformation *client){ 357 381 { 358 boost::recursive_mutex::scoped_lock lock(enet_mutex _);382 boost::recursive_mutex::scoped_lock lock(enet_mutex); 359 383 enet_peer_disconnect(client->getPeer(), 0); 360 384 lock.unlock(); … … 363 387 } 364 388 365 bool ConnectionManager::addFakeConnectRequest(ENetEvent *ev){366 ENetEvent event;367 event.peer=ev->peer;368 event.packet = packet_gen.generateConnectRequest();369 return buffer.push(&event);370 }371 372 373 389 374 390 } -
code/trunk/src/network/ConnectionManager.h
r1505 r1735 51 51 52 52 #include "PacketBuffer.h" 53 #include " PacketManager.h"53 #include "packet/Packet.h" 54 54 55 55 namespace std … … 63 63 #define NETWORK_MAX_CONNECTIONS 50 64 64 #define NETWORK_WAIT_TIMEOUT 1 65 #define NETWORK_DEFAULT_CHANNEL 0 65 66 66 67 struct ClientList{ … … 71 72 72 73 class ConnectionManager{ 73 public: 74 public: 75 static boost::recursive_mutex enet_mutex; 74 76 ConnectionManager(); 75 ConnectionManager(ClientInformation *head); 76 ConnectionManager(ClientInformation *head, int port); 77 ConnectionManager(int port, const char *address, ClientInformation *head); 78 ConnectionManager(int port, std::string address, ClientInformation *head); 77 //ConnectionManager(ClientInformation *head); 78 ConnectionManager(int port); 79 ConnectionManager(int port, const char *address); 80 ConnectionManager(int port, std::string address); 81 ~ConnectionManager(); 79 82 //ENetPacket *getPacket(ENetAddress &address); // thread1 80 83 //ENetPacket *getPacket(int &clientID); … … 83 86 void createListener(); 84 87 bool quitListener(); 85 bool addPacket(ENetPacket *packet, ENetPeer *peer); 86 bool addPacket(ENetPacket *packet, int ID); 87 bool addPacketAll(ENetPacket *packet); 88 // bool addPacket(Packet::Packet *packet); 89 static bool addPacket(ENetPacket *packet, ENetPeer *peer); 90 static bool addPacket(ENetPacket *packet, int ID); 91 static bool addPacketAll(ENetPacket *packet); 88 92 // bool sendPackets(ENetEvent *event); 89 93 bool sendPackets(); 90 94 //bool createClient(int clientID); 91 95 void disconnectClient(ClientInformation *client); 92 void syncClassid(int clientID); 93 bool sendWelcome(int clientID, int shipID, bool allowed); 96 void syncClassid(unsigned int clientID); 94 97 95 98 private: … … 105 108 //bool createShip(ClientInformation *client); 106 109 bool removeShip(ClientInformation *client); 107 bool addFakeConnectRequest(ENetEvent *ev);108 110 PacketBuffer buffer; 109 PacketGenerator packet_gen;110 111 111 112 ENetHost *server; … … 113 114 114 115 bool quit; // quit-variable (communication with threads) 115 ClientInformation *head_;116 116 117 117 boost::thread *receiverThread_; 118 static boost::recursive_mutex enet_mutex_; 119 // int getNumberOfClients(); 120 //functions to map what object every clients uses 121 /*std::map<int, int> clientsShip; 122 void addClientsObjectID( int clientID, int objectID ); 123 int getClientsShipID( int clientID ); 124 int getObjectsClientID( int objectID ); 125 void deleteClientIDReg( int clientID ); 126 void deleteObjectIDReg( int objectID );*/ 118 static ConnectionManager *instance_; 119 127 120 }; 128 121 -
code/trunk/src/network/NetworkPrereqs.h
r1505 r1735 66 66 class ClientInformation; 67 67 class ConnectionManager; 68 class GameStateClient; 69 class GameStateManager; 68 class GamestateClient; 69 class GamestateManager; 70 class GamestateHandler; 70 71 class PacketBuffer; 71 class PacketDecoder;72 class PacketGenerator;73 72 class Server; 74 73 class ServerFrameListener; 75 74 class Synchronisable; 76 struct ack;77 struct chat;78 struct classid;79 struct welcome;80 struct connectRequest;81 75 struct ClientList; 82 struct GameState;83 struct GameStateCompressed;84 struct keyboard;85 struct mouse;86 76 struct PacketEnvelope; 87 77 struct QueueItem; 88 78 struct syncData; 89 79 struct synchronisableVariable; 80 namespace packet{ 81 class Gamestate; 82 class Packet; 83 class Acknowledgement; 84 class ClassID; 85 class Welcome; 86 class Chat; 87 } 90 88 } 91 89 -
code/trunk/src/network/Server.cc
r1556 r1735 45 45 46 46 #include "ConnectionManager.h" 47 #include "PacketTypes.h" 48 #include "GameStateManager.h" 47 #include "GamestateManager.h" 49 48 #include "ClientInformation.h" 50 //#include "NetworkFrameListener.h"51 49 #include "util/Sleep.h" 52 50 #include "objects/SpaceShip.h" 53 51 #include "core/ConsoleCommand.h" 52 #include "packet/Chat.h" 53 #include "packet/Packet.h" 54 #include "packet/Welcome.h" 54 55 55 56 namespace network … … 58 59 #define NETWORK_FREQUENCY 30 59 60 60 Server *Server::instance_=0;61 62 Server *Server::createSingleton(){63 if(!instance_)64 instance_ = new Server();65 return instance_;66 }67 Server *Server::createSingleton(int port){68 if(!instance_)69 instance_ = new Server(port);70 return instance_;71 }72 Server *Server::createSingleton(int port, std::string bindAddress){73 if(!instance_)74 instance_ = new Server(port, bindAddress);75 return instance_;76 }77 Server *Server::createSingleton(int port, const char *bindAddress){78 if(!instance_)79 instance_ = new Server(port, bindAddress);80 return instance_;81 }82 83 Server *Server::getSingleton(){84 return instance_;85 }86 87 88 61 /** 89 62 * Constructor for default values (bindaddress is set to ENET_HOST_ANY … … 92 65 Server::Server() { 93 66 timeSinceLastUpdate_=0; 94 packet_gen = PacketGenerator(); 95 clients = new ClientInformation(true); 96 connection = new ConnectionManager(clients); 97 gamestates = new GameStateManager(clients); 67 connection = new ConnectionManager(); 68 gamestates_ = new GamestateManager(); 98 69 } 99 70 100 71 Server::Server(int port){ 101 72 timeSinceLastUpdate_=0; 102 packet_gen = PacketGenerator(); 103 clients = new ClientInformation(true); 104 connection = new ConnectionManager(clients, port); 105 gamestates = new GameStateManager(clients); 73 connection = new ConnectionManager(port); 74 gamestates_ = new GamestateManager(); 106 75 } 107 76 … … 113 82 Server::Server(int port, std::string bindAddress) { 114 83 timeSinceLastUpdate_=0; 115 packet_gen = PacketGenerator(); 116 clients = new ClientInformation(); 117 connection = new ConnectionManager(port, bindAddress, clients); 118 gamestates = new GameStateManager(clients); 84 connection = new ConnectionManager(port, bindAddress); 85 gamestates_ = new GamestateManager(); 119 86 } 120 87 … … 126 93 Server::Server(int port, const char *bindAddress) { 127 94 timeSinceLastUpdate_=0; 128 packet_gen = PacketGenerator(); 129 clients = new ClientInformation(); 130 connection = new ConnectionManager(port, bindAddress, clients); 131 gamestates = new GameStateManager(clients); 95 connection = new ConnectionManager(port, bindAddress); 96 gamestates_ = new GamestateManager(); 132 97 } 133 98 … … 148 113 } 149 114 115 bool Server::processChat(packet::Chat *message, unsigned int clientID){ 116 ClientInformation *temp = ClientInformation::getBegin(); 117 while(temp){ 118 message->setClientID(temp->getID()); 119 if(!message->send()) 120 COUT(3) << "could not send Chat message to client ID: " << temp->getID() << std::endl; 121 temp = temp->next(); 122 } 123 return message->process(); 124 } 125 150 126 /** 151 127 * This function sends out a message to all clients … … 153 129 * @return true/false 154 130 */ 155 bool Server::sendChat(std::string msg) { 156 return sendChat(msg.c_str()); 131 bool Server::sendChat(packet::Chat *chat) { 132 //TODO: change this (no informations about who wrote a message) 133 assert(0); 134 ClientInformation *temp = ClientInformation::getBegin(); 135 while(temp){ 136 chat->setClientID(temp->getID()); 137 if(!chat->send()) 138 COUT(3) << "could not send Chat message to client ID: " << temp->getID() << std::endl; 139 } 140 return chat->process();; 157 141 } 158 142 … … 162 146 * @return true/false 163 147 */ 164 bool Server::sendChat(const char *msg) {165 char *message = new char [strlen(msg)+10+1];166 sprintf(message, "Player %d: %s", CLIENTID_SERVER, msg);167 COUT(1) << message << std::endl;168 ENetPacket *packet = packet_gen.chatMessage(message);169 COUT(5) <<"Server: adding Packets" << std::endl;170 return connection->addPacketAll(packet);171 }148 // bool Server::sendChat(const char *msg) { 149 // char *message = new char [strlen(msg)+10+1]; 150 // sprintf(message, "Player %d: %s", CLIENTID_SERVER, msg); 151 // COUT(1) << message << std::endl; 152 // ENetPacket *packet = packet_gen.chatMessage(message); 153 // COUT(5) <<"Server: adding Packets" << std::endl; 154 // return connection->addPacketAll(packet); 155 // } 172 156 173 157 /** … … 183 167 timeSinceLastUpdate_=(float)((int)(timeSinceLastUpdate_*NETWORK_FREQUENCY))/timeSinceLastUpdate_; 184 168 // timeSinceLastUpdate_-=1./NETWORK_FREQUENCY; 185 gamestates ->processGameStates();169 gamestates_->processGamestates(); 186 170 updateGamestate(); 187 171 } … … 191 175 return; 192 176 } 177 178 bool Server::queuePacket(ENetPacket *packet, int clientID){ 179 return connection->addPacket(packet, clientID); 180 } 193 181 194 182 /** … … 197 185 void Server::processQueue() { 198 186 ENetEvent *event; 199 int clientID=-1;200 187 while(!connection->queueEmpty()){ 201 188 //std::cout << "Client " << clientID << " sent: " << std::endl; … … 211 198 break; 212 199 case ENET_EVENT_TYPE_DISCONNECT: 213 if( clients->findClient(&event->peer->address))200 if(ClientInformation::findClient(&event->peer->address)) 214 201 disconnectClient(event); 215 202 break; 216 203 case ENET_EVENT_TYPE_RECEIVE: 217 if(clients->findClient(&event->peer->address)){ 218 clientID = clients->findClient(&event->peer->address)->getID(); 219 if( !elaborate(event->packet, clientID) ) 220 COUT(3) << "Server: could not elaborate" << std::endl; 221 } 204 if(!processPacket(event->packet, event->peer)) 205 COUT(3) << "processing incoming packet failed" << std::endl; 222 206 break; 223 207 default: … … 233 217 */ 234 218 void Server::updateGamestate() { 235 gamestates ->update();219 gamestates_->update(); 236 220 COUT(5) << "Server: one gamestate update complete, goig to sendGameState" << std::endl; 237 221 //std::cout << "updated gamestate, sending it" << std::endl; … … 242 226 } 243 227 228 bool Server::processPacket( ENetPacket *packet, ENetPeer *peer ){ 229 packet::Packet *p = packet::Packet::createPacket(packet, peer); 230 return p->process(); 231 } 232 244 233 /** 245 234 * sends the gamestate … … 247 236 bool Server::sendGameState() { 248 237 COUT(5) << "Server: starting function sendGameState" << std::endl; 249 ClientInformation *temp = clients;238 ClientInformation *temp = ClientInformation::getBegin(); 250 239 bool added=false; 251 240 while(temp != NULL){ 252 if(temp->getHead()){253 temp=temp->next();254 //think this works without continue255 continue;256 }257 241 if( !(temp->getSynched()) ){ 258 242 COUT(5) << "Server: not sending gamestate" << std::endl; 259 243 temp=temp->next(); 244 if(!temp) 245 break; 260 246 //think this works without continue 261 247 continue; … … 266 252 int cid = temp->getID(); //get client id 267 253 COUT(5) << "Server: got acked (gamestate) ID from clientlist: " << gid << std::endl; 268 GameStateCompressed *gs = gamestates->popGameState(cid);254 packet::Gamestate *gs = gamestates_->popGameState(cid); 269 255 if(gs==NULL){ 270 256 COUT(2) << "Server: could not generate gamestate (NULL from compress)" << std::endl; … … 272 258 } 273 259 //std::cout << "adding gamestate" << std::endl; 274 ENetPacket *packet = packet_gen.gstate(gs); 275 if(!packet) 276 continue; 277 if ( !(connection->addPacket(packet, cid)) ){ 260 gs->setClientID(cid); 261 assert(gs->compressData()); 262 if ( !gs->send() ){ 278 263 COUT(3) << "Server: packet with client id (cid): " << cid << " not sended: " << temp->getFailures() << std::endl; 279 264 temp->addFailure(); 280 /*if(temp->getFailures() > 0 )281 disconnectClient(temp);*/282 //std::cout << "added gamestate" << std::endl;283 265 }else 284 266 temp->resetFailures(); 285 267 added=true; 286 268 temp=temp->next(); 287 // now delete gamestate 288 delete[] gs->data; 289 delete gs; 269 // gs gets automatically deleted by enet callback 290 270 } 291 271 /*if(added) { … … 296 276 return true; 297 277 } 298 299 void Server::processAck( ack *data, int clientID) { 300 COUT(4) << "Server: processing ack from client: " << clientID << "; ack-id: " << data->a << std::endl; 301 gamestates->ackGameState(clientID, data->a); 302 delete data; 303 } 304 305 bool Server::processConnectRequest( connectRequest *con, int clientID ){ 306 //(COUT(3) << "processing connectRequest " << std::endl; 307 //connection->addPacket(packet_gen.gstate(gamestates->popGameState(clientID)) , clientID); 308 //createClient(clientID); 309 delete con; 310 return true; 311 } 312 313 void Server::processGamestate( GameStateCompressed *data, int clientID){ 314 COUT(4) << "processing partial gamestate from client " << clientID << std::endl; 315 gamestates->addGameState(data, clientID); 316 /*COUT(3) << "Could not push gamestate\t\t\t\t=====" << std::endl; 317 else 318 if(clients->findClient(clientID)) 319 clients->findClient(clientID)->resetFailures();*/ 320 } 321 322 void Server::processChat( chat *data, int clientId){ 323 char *message = new char [strlen(data->message)+10+1]; 324 sprintf(message, "Player %d: %s", clientId, data->message); 325 COUT(1) << message << std::endl; 326 ENetPacket *pck = packet_gen.chatMessage(message); 327 connection->addPacketAll(pck); 328 delete[] data->message; 329 delete data; 330 } 278 279 // void Server::processChat( chat *data, int clientId){ 280 // char *message = new char [strlen(data->message)+10+1]; 281 // sprintf(message, "Player %d: %s", clientId, data->message); 282 // COUT(1) << message << std::endl; 283 // ENetPacket *pck = packet_gen.chatMessage(message); 284 // connection->addPacketAll(pck); 285 // delete[] data->message; 286 // delete data; 287 // } 331 288 332 289 bool Server::addClient(ENetEvent *event){ 333 ClientInformation *temp = clients->insertBack(new ClientInformation);290 ClientInformation *temp = ClientInformation::insertBack(new ClientInformation); 334 291 if(!temp){ 335 292 COUT(2) << "Server: could not add client" << std::endl; 336 293 return false; 337 294 } 338 if(temp->prev()->get Head()) { //not good if you use anything else than insertBack295 if(temp->prev()->getBegin()) { //not good if you use anything else than insertBack 339 296 temp->prev()->setID(0); //bugfix: not necessary but usefull 340 297 temp->setID(1); … … 348 305 349 306 bool Server::createClient(int clientID){ 350 ClientInformation *temp = clients->findClient(clientID);307 ClientInformation *temp = ClientInformation::findClient(clientID); 351 308 if(!temp){ 352 309 COUT(2) << "Conn.Man. could not create client with id: " << clientID << std::endl; … … 363 320 temp->setSynched(true); 364 321 COUT(3) << "sending welcome" << std::endl; 365 connection->sendWelcome(temp->getID(), temp->getShipID(), true); 322 packet::Welcome *w = new packet::Welcome(temp->getID(), temp->getShipID()); 323 w->setClientID(temp->getID()); 324 assert(w->send()); 366 325 return true; 367 326 } … … 376 335 } 377 336 orxonox::SpaceShip *no = dynamic_cast<orxonox::SpaceShip *>(id->fabricate()); 337 no->classID = id->getNetworkID(); 338 client->setShipID(no->objectID); 378 339 no->setPosition(orxonox::Vector3(0,0,80)); 379 340 no->setScale(10); … … 388 349 no->setRotDamp(1.0); 389 350 no->setCamera("cam_"+client->getID()); 390 no->classID = id->getNetworkID();391 351 no->create(); 352 no->setBacksync(true); 392 353 393 client->setShipID(no->objectID);394 354 return true; 395 355 } … … 401 361 //boost::recursive_mutex::scoped_lock lock(head_->mutex_); 402 362 orxonox::Iterator<orxonox::SpaceShip> it = orxonox::ObjectList<orxonox::SpaceShip>::start(); 403 ClientInformation *client = clients->findClient(&event->peer->address);363 ClientInformation *client = ClientInformation::findClient(&event->peer->address); 404 364 if(!client) 405 365 return false; … … 412 372 ++it; 413 373 delete *temp; 414 return clients->removeClient(event->peer);374 return ClientInformation::removeClient(event->peer); 415 375 } 416 376 return false; … … 418 378 419 379 void Server::disconnectClient(int clientID){ 420 ClientInformation *client = clients->findClient(clientID);380 ClientInformation *client = ClientInformation::findClient(clientID); 421 381 if(client) 422 382 disconnectClient(client); … … 424 384 void Server::disconnectClient( ClientInformation *client){ 425 385 connection->disconnectClient(client); 426 gamestates ->removeClient(client);386 gamestates_->removeClient(client); 427 387 } 428 388 -
code/trunk/src/network/Server.h
r1535 r1735 46 46 #include <string> 47 47 48 #include "PacketManager.h" 49 50 48 #include "Host.h" 49 #include "GamestateManager.h" 51 50 52 51 namespace network … … 58 57 * It implements all functions necessary for a Server 59 58 */ 60 class _NetworkExport Server : public PacketDecoder{59 class _NetworkExport Server : public Host{ 61 60 public: 62 static Server *createSingleton(); 63 static Server *createSingleton(int port); 64 static Server *createSingleton(int port, std::string bindAddress); 65 static Server *createSingleton(int port, const char *bindAddress); 66 67 static Server *getSingleton(); 61 Server(); 62 Server(int port); 63 Server(int port, std::string bindAddress); 64 Server(int port, const char *bindAddress); 68 65 69 66 void open(); 70 67 void close(); 71 bool sendChat(std::string msg); 72 bool sendChat(const char *msg); 68 bool processChat(packet::Chat *message, unsigned int clientID); 69 bool sendChat(packet::Chat *chat); 70 bool queuePacket(ENetPacket *packet, int clientID); 73 71 void tick(float time); 74 72 protected: … … 76 74 void updateGamestate(); 77 75 private: 78 Server(); 79 Server(int port); 80 Server(int port, std::string bindAddress); 81 Server(int port, const char *bindAddress); 82 83 static Server *instance_; 76 unsigned int shipID(){return 0;} 77 int playerID(){return 0;} 84 78 85 79 bool addClient(ENetEvent *event); … … 89 83 void disconnectClient(int clientID); 90 84 void disconnectClient( ClientInformation *client); 85 bool processPacket( ENetPacket *packet, ENetPeer *peer ); 91 86 bool sendGameState(); 92 void processAck( ack *data, int clientID); 93 bool processConnectRequest( connectRequest *con, int clientID ); 94 void processGamestate( GameStateCompressed *data, int clientID); 95 void processChat( chat *data, int clientId); 87 88 89 //void processChat( chat *data, int clientId); 96 90 ConnectionManager *connection; 97 GameStateManager *gamestates; 98 PacketGenerator packet_gen; 91 GamestateManager *gamestates_; 99 92 100 ClientInformation *clients;93 101 94 float timeSinceLastUpdate_; 102 95 }; -
code/trunk/src/network/Synchronisable.cc
r1639 r1735 43 43 #include <string> 44 44 #include <iostream> 45 #include < string.h>45 #include <assert.h> 46 46 47 47 #include "core/CoreIncludes.h" 48 #include "core/BaseObject.h" 48 49 // #include "core/Identifier.h" 49 50 … … 85 86 else // server 86 87 state_=0x1; 88 } 89 90 bool Synchronisable::fabricate(unsigned char*& mem, int mode) 91 { 92 unsigned int size, objectID, classID; 93 size = *(unsigned int *)mem; 94 objectID = *(unsigned int*)(mem+sizeof(unsigned int)); 95 classID = *(unsigned int*)(mem+2*sizeof(unsigned int)); 96 97 orxonox::Identifier* id = ID(classID); 98 if(!id){ 99 COUT(3) << "We could not identify a new object; classid: " << classID << " uint: " << (unsigned int)classID << " objectID: " << objectID << " size: " << size << std::endl; 100 return false; // most probably the gamestate is corrupted 101 } 102 orxonox::BaseObject *bo = id->fabricate(); 103 Synchronisable *no = dynamic_cast<Synchronisable *>(bo); 104 assert(no); 105 no->objectID=objectID; 106 no->classID=classID; 107 COUT(3) << "fabricate objectID: " << no->objectID << " classID: " << no->classID << std::endl; 108 // update data and create object/entity... 109 if( !no->updateData(mem, mode) ){ 110 COUT(1) << "We couldn't update the object: " << objectID << std::endl; 111 return false; 112 } 113 if( !no->create() ) 114 { 115 COUT(1) << "We couldn't manifest (create() ) the object: " << objectID << std::endl; 116 return false; 117 } 118 return true; 87 119 } 88 120 … … 109 141 } 110 142 111 /** 112 * note: only use this function for debug use, because it's inefficient (in order to produce a gamestate, you have to copy the whole data again to another memory location after this process) 113 * This function takes all SynchronisableVariables out of the Synchronisable and saves it into a syncData struct 114 * structure of the bitstream: 115 * (var1_size,var1,var2_size,var2,...) 116 * varx_size: size = sizeof(int) 117 * varx: size = varx_size 118 * @return data containing all variables and their sizes 119 */ 120 // syncData Synchronisable::getData(){ 121 // std::list<synchronisableVariable>::iterator i; 122 // int totalsize=0; 123 // //figure out size of data to be allocated 124 // for(i=syncList->begin(); i!=syncList->end(); i++){ 125 // // increase size (size of variable and size of size of variable ;) 126 // if(i->type == STRING) 127 // totalsize+=sizeof(int)+((std::string *)i->var)->length()+1; 128 // else 129 // totalsize+=sizeof(int)+i->size; 130 // } 131 // syncData retVal; 132 // retVal.objectID=this->objectID; 133 // retVal.classID=this->classID; 134 // retVal.length=totalsize; 135 // // allocate memory 136 // retVal.data = (unsigned char *)malloc(totalsize); 137 // // copy to location 138 // //CHANGED: REMOVED DECLARATION int n=0 FROM LOOP 139 // int n=0; 140 // for(i=syncList->begin(); n<totalsize && i!=syncList->end(); i++){ 141 // std::memcpy(retVal.data+n, (const void*)(i->size), sizeof(int)); 142 // n+=sizeof(int); 143 // switch(i->type){ 144 // case STRING: 145 // std::memcpy(retVal.data+n, (const void *)(((std::string *)i->var)->c_str()), ((std::string *)i->var)->length()+1); 146 // n+=((std::string *)i->var)->length()+1; 147 // break; 148 // case DATA: 149 // std::memcpy(retVal.data+n, ((const void*)i->var), i->size); 150 // n+=i->size; 151 // break; 152 // } 153 // } 154 // return retVal; 155 // } 143 156 144 /** 157 145 * This function takes all SynchronisableVariables out of the Synchronisable and saves it into a syncData struct … … 203 191 return retVal; 204 192 } 205 193 194 /** 195 * This function takes all SynchronisableVariables out of the Synchronisable and saves it into a syncData struct 196 * Difference to the above function: 197 * takes a pointer to already allocated memory (must have at least getSize bytes length) 198 * structure of the bitstream: 199 * (var1_size,var1,var2_size,var2,...) 200 * varx_size: size = sizeof(int) 201 * varx: size = varx_size 202 * @return data containing all variables and their sizes 203 */ 204 bool Synchronisable::getData2(unsigned char*& mem, int mode){ 205 //std::cout << "inside getData" << std::endl; 206 unsigned int tempsize = 0; 207 if(mode==0x0) 208 mode=state_; 209 if(classID==0) 210 COUT(3) << "classid 0 " << this->getIdentifier()->getName() << std::endl; 211 this->classID=this->getIdentifier()->getNetworkID(); 212 std::list<synchronisableVariable *>::iterator i; 213 unsigned int size; 214 size=getSize2(mode); 215 216 // start copy header 217 memcpy(mem, &size, sizeof(unsigned int)); 218 mem+=sizeof(unsigned int); 219 memcpy(mem, &(this->objectID), sizeof(unsigned int)); 220 mem+=sizeof(unsigned int); 221 memcpy(mem, &(this->classID), sizeof(unsigned int)); 222 mem+=sizeof(unsigned int); 223 tempsize+=12; 224 // end copy header 225 226 227 COUT(5) << "Synchronisable getting data from objectID: " << objectID << " classID: " << classID << " length: " << size << std::endl; 228 // copy to location 229 for(i=syncList->begin(); i!=syncList->end(); ++i){ 230 //(std::memcpy(retVal.data+n, (const void*)(&(i->size)), sizeof(int)); 231 if( ((*i)->mode & mode) == 0 ){ 232 COUT(5) << "not getting data: " << std::endl; 233 continue; // this variable should only be received 234 } 235 switch((*i)->type){ 236 case DATA: 237 memcpy( (void *)(mem), (void*)((*i)->var), (*i)->size); 238 mem+=(*i)->size; 239 tempsize+=(*i)->size; 240 break; 241 case STRING: 242 memcpy( (void *)(mem), (void *)&((*i)->size), sizeof(int) ); 243 mem+=sizeof(int); 244 const char *data = ( ( *(std::string *) (*i)->var).c_str()); 245 memcpy( mem, (void*)data, (*i)->size); 246 COUT(5) << "synchronisable: char: " << (const char *)(mem) << " data: " << data << " string: " << *(std::string *)((*i)->var) << std::endl; 247 mem+=(*i)->size; 248 tempsize+=(*i)->size + 4; 249 break; 250 } 251 } 252 assert(tempsize==size); 253 return true; 254 } 255 256 /*bool Synchronisable::getData(Bytestream& bs, int mode) 257 { 258 //std::cout << "inside getData" << std::endl; 259 if(mode==0x0) 260 mode=state_; 261 if(classID==0) 262 COUT(3) << "classid 0 " << this->getIdentifier()->getName() << std::endl; 263 this->classID=this->getIdentifier()->getNetworkID(); 264 std::list<synchronisableVariable *>::iterator i; 265 bs << this->getSize(); 266 bs << this->objectID; 267 bs << this->classID; 268 // copy to location 269 for(i=syncList->begin(); i!=syncList->end(); ++i){ 270 if( ((*i)->mode & mode) == 0 ){ 271 COUT(5) << "not getting data: " << std::endl; 272 continue; // this variable should only be received 273 } 274 switch((*i)->type){ 275 case DATA: 276 bs << *(*i)->var; 277 //std::memcpy( (void *)(retVal.data+n), (void*)((*i)->var), (*i)->size); 278 //n+=(*i)->size; 279 break; 280 case STRING: 281 bs << *(String *)((*i)->var); 282 //memcpy( (void *)(retVal.data+n), (void *)&((*i)->size), sizeof(int) ); 283 //n+=sizeof(int); 284 //const char *data = ( ( *(std::string *) (*i)->var).c_str()); 285 //std::memcpy( retVal.data+n, (void*)data, (*i)->size); 286 //COUT(5) << "synchronisable: char: " << (const char *)(retVal.data+n) << " data: " << data << " string: " << *(std::string *)((*i)->var) << std::endl; 287 //n+=(*i)->size; 288 break; 289 } 290 } 291 return true; 292 }*/ 293 294 206 295 /** 207 296 * This function takes a syncData struct and takes it to update the variables … … 247 336 } 248 337 // call the callback function, if defined 249 if(callback) 338 if(callback && (*i)->callback) 339 (*i)->callback->call(); 340 } 341 return true; 342 } 343 344 /** 345 * This function takes a syncData struct and takes it to update the variables 346 * @param vars data of the variables 347 * @return true/false 348 */ 349 bool Synchronisable::updateData(unsigned char*& mem, int mode){ 350 unsigned char *data = mem; 351 if(mode==0x0) 352 mode=state_; 353 std::list<synchronisableVariable *>::iterator i; 354 if(syncList->empty()){ 355 COUT(4) << "Synchronisable::updateData syncList is empty" << std::endl; 356 return false; 357 } 358 359 // start extract header 360 unsigned int objectID, classID, size; 361 size = *(int *)mem; 362 mem+=sizeof(size); 363 objectID = *(int *)mem; 364 mem+=sizeof(objectID); 365 classID = *(int *)mem; 366 mem+=sizeof(classID); 367 // stop extract header 368 assert(this->objectID==objectID); 369 assert(this->classID==classID); 370 371 COUT(5) << "Synchronisable: objectID " << objectID << ", classID " << classID << " size: " << size << " synchronising data" << std::endl; 372 for(i=syncList->begin(); i!=syncList->end() && mem <= data+size; i++){ 373 if( ((*i)->mode ^ mode) == 0 ){ 374 COUT(5) << "synchronisable: not updating variable " << std::endl; 375 continue; // this variable should only be set 376 } 377 COUT(5) << "Synchronisable: element size: " << (*i)->size << " type: " << (*i)->type << std::endl; 378 bool callback=false; 379 switch((*i)->type){ 380 case DATA: 381 if((*i)->callback) // check whether this variable changed (but only if callback was set) 382 if(strncmp((char *)(*i)->var, (char *)mem, (*i)->size)!=0) 383 callback=true; 384 memcpy((void*)(*i)->var, mem, (*i)->size); 385 mem+=(*i)->size; 386 break; 387 case STRING: 388 (*i)->size = *(int *)mem; 389 COUT(5) << "string size: " << (*i)->size << std::endl; 390 mem+=sizeof(int); 391 if((*i)->callback) // check whether this string changed 392 if( *(std::string *)((*i)->var) != std::string((char *)mem) ) 393 callback=true; 394 *((std::string *)((*i)->var)) = std::string((const char*)mem); 395 COUT(5) << "synchronisable: char: " << (const char*)mem << " string: " << std::string((const char*)mem) << std::endl; 396 mem += (*i)->size; 397 break; 398 } 399 // call the callback function, if defined 400 if(callback && (*i)->callback) 250 401 (*i)->callback->call(); 251 402 } … … 280 431 } 281 432 433 /** 434 * This function returns the total amount of bytes needed by getData to save the whole content of the variables 435 * @return amount of bytes 436 */ 437 int Synchronisable::getSize2(int mode){ 438 return 3*sizeof(unsigned int) + getSize( mode ); 439 } 440 441 bool Synchronisable::isMyData(unsigned char* mem) 442 { 443 unsigned int objectID, classID, size; 444 size = *(int *)mem; 445 mem+=sizeof(size); 446 objectID = *(int *)mem; 447 mem+=sizeof(objectID); 448 classID = *(int *)mem; 449 mem+=sizeof(classID); 450 451 assert(classID == this->classID); 452 return (objectID == this->objectID); 453 } 454 282 455 void Synchronisable::setBacksync(bool sync){ 283 456 backsync_=sync; -
code/trunk/src/network/Synchronisable.h
r1534 r1735 44 44 45 45 struct syncData{ 46 int length;47 int objectID;48 int classID;46 unsigned int length; 47 unsigned int objectID; 48 unsigned int classID; 49 49 unsigned char *data; 50 50 }; 51 51 52 52 typedef struct synchronisableVariable{ 53 int size;53 unsigned int size; 54 54 int mode; // this determines in which direction the variable gets synchronised 55 55 void *var; … … 69 69 70 70 virtual ~Synchronisable(); 71 int objectID;72 int classID;71 unsigned int objectID; 72 unsigned int classID; 73 73 74 74 void registerVar(void *var, int size, variableType t, int mode=1, NetworkCallbackBase *cb=0); 75 75 // syncData getData(); 76 76 syncData getData(unsigned char *mem, int mode=0x0); 77 bool getData2(unsigned char*& men, int mode=0x0); 78 //bool getData(Bytestream& bs, int mode=0x0); 77 79 int getSize(int mode=0x0); 80 int getSize2(int mode=0x0); 78 81 bool updateData(syncData vars, int mode=0x0); 82 bool updateData(unsigned char*& mem, int mode=0x0); 83 bool isMyData(unsigned char* mem); 79 84 void setBacksync(bool sync); 80 85 bool getBacksync(); … … 82 87 virtual bool create(); 83 88 static void setClient(bool b); 89 90 static bool fabricate(unsigned char*& mem, int mode=0x0); 84 91 protected: 85 92 Synchronisable(); -
code/trunk/src/orxonox/Orxonox.cc
r1625 r1735 138 138 GraphicsEngine::getSingleton().destroy(); 139 139 140 if ( network::Client::getSingleton())141 network::Client::destroySingleton();140 if (client_g) 141 delete client_g; 142 142 if (server_g) 143 delete network::Server::getSingleton();143 delete server_g; 144 144 } 145 145 … … 363 363 COUT(0) << "Loading level in server mode" << std::endl; 364 364 365 //server_g = new network::Server(serverPort_); 366 server_g = network::Server::createSingleton(serverPort_); 367 365 server_g = new network::Server(serverPort_); 366 COUT(0) << "Loading scene in server mode" << std::endl; 368 367 if (!loadScene()) 369 368 return false; … … 382 381 383 382 if (serverIp_.compare("") == 0) 384 client_g = ne twork::Client::createSingleton();383 client_g = new network::Client(); 385 384 else 386 385 387 client_g = ne twork::Client::createSingleton(serverIp_, serverPort_);386 client_g = new network::Client(serverIp_, serverPort_); 388 387 389 388 if(!client_g->establishConnection()) … … 525 524 526 525 if (mode_ == CLIENT) 527 network::Client::getSingleton()->closeConnection();526 client_g->closeConnection(); 528 527 else if (mode_ == SERVER) 529 528 server_g->close(); -
code/trunk/src/orxonox/objects/Ambient.h
r1625 r1735 38 38 namespace orxonox 39 39 { 40 class _OrxonoxExport Ambient : public BaseObject, network::Synchronisable40 class _OrxonoxExport Ambient : public BaseObject, public network::Synchronisable 41 41 { 42 42 public: -
code/trunk/src/orxonox/objects/SpaceShip.cc
r1625 r1735 43 43 #include "core/XMLPort.h" 44 44 #include "core/ConsoleCommand.h" 45 46 #include "network/Client.h" 45 #include "network/Host.h" 47 46 48 47 #include "tools/ParticleInterface.h" … … 80 79 return *it; 81 80 } 82 return NULL;81 return 0; 83 82 } 84 83 … … 165 164 bool SpaceShip::create(){ 166 165 if(!myShip_){ 167 if(network::Client::getSingleton() && objectID == network::Client::getSingleton()->getShipID()) 166 if(network::Host::running()) 167 COUT(3) << "this id: " << this->objectID << " myShipID: " << network::Host::getShipID() << std::endl; 168 if(network::Host::running() && objectID == network::Host::getShipID()) 168 169 myShip_=true; 169 170 else 170 171 this->setRadarObjectColour(this->getProjectileColour()); 171 172 } 172 if(Model::create()) 173 this->init(); 174 else 175 return false; 173 assert(Model::create()); 174 this->init(); 176 175 return true; 177 176 } … … 276 275 // END of testing crosshair 277 276 } 277 // END of testing crosshair 278 278 279 279 createCamera(); … … 320 320 void SpaceShip::setCamera(const std::string& camera) 321 321 { 322 myShip_=true; // TODO: this is only a hack323 322 camName_=camera; 324 323 // change camera attributes here, if you want to ;) … … 326 325 327 326 void SpaceShip::getFocus(){ 328 COUT(4) << "requesting focus" << std::endl; 329 if(network::Client::getSingleton()==0 || network::Client::getSingleton()->getShipID()==objectID) 327 COUT(3) << "requesting focus" << std::endl; 328 //if(!network::Host::running() || network::Host::getShipID()==objectID) 329 if(myShip_) 330 330 CameraHandler::getInstance()->requestFocus(cam_); 331 331 … … 339 339 // COUT(4) << "begin camera creation" << std::endl; 340 340 this->camNode_ = this->getNode()->createChildSceneNode(camName_); 341 COUT( 4) << "position: (this)" << this->getNode()->getPosition() << std::endl;341 COUT(3) << "position: (this)" << this->getNode()->getPosition() << std::endl; 342 342 this->camNode_->setPosition(Vector3(-25,0,5)); 343 343 // Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,-1,0)); … … 349 349 cam_->setTargetNode(this->getNode()); 350 350 // cam->setPosition(Vector3(0,-350,0)); 351 // Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,0,1)); 352 // Quaternion q2 = Quaternion(Radian(Degree(90)),Vector3(0,1,0)); 351 353 Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,-1,0)); 352 354 Quaternion q2 = Quaternion(Radian(Degree(90)),Vector3(1,0,0)); 353 this->camNode_->setOrientation(q2*q1); 354 if(network::Client::getSingleton()!=0 && network::Client::getSingleton()->getShipID()==objectID){ 355 356 this->camNode_->setOrientation(q2*q1); 357 //if(!network::Host::running() || network::Host::getShipID()==objectID){ //TODO: check this 358 if(myShip_){ 359 COUT(3) << "requesting focus for camera" << std::endl; 355 360 this->setBacksync(true); 356 CameraHandler::getInstance()->requestFocus(cam_); 357 } 361 //CameraHandler::getInstance()->requestFocus(cam_); 362 if(this->isExactlyA(Class(SpaceShip))){ 363 getFocus(); 364 COUT(3) << "getting focus for obj id: " << objectID << std::endl; 365 }else 366 COUT(3) << "not getting focus (not exactly spaceship) for obj id: " << objectID << std::endl; 367 }else 368 COUT(3) << "not getting focus (not my ship) for obj id: " << objectID << std::endl; 358 369 } 359 370 … … 392 403 XMLPortParamLoadOnly(SpaceShip, "rotDamp", setRotDamp, xmlelement, mode); 393 404 405 myShip_=true; //TODO: this is a hack 394 406 SpaceShip::create(); 395 if (this->isExactlyA(Class(SpaceShip)))396 getFocus(); 407 /*if (this->isExactlyA(Class(SpaceShip))) 408 getFocus();*/ 397 409 } 398 410 -
code/trunk/src/util/UtilPrereqs.h
r1625 r1735 61 61 //----------------------------------------------------------------------- 62 62 class ArgReader; 63 class Convert; 63 64 class MultiTypePrimitive; 64 65 class MultiTypeString; … … 67 68 class String2Number; 68 69 class SubString; 69 70 70 #endif /* _UtilPrereqs_H__ */ -
code/trunk/visual_studio/base_properties.vsprops
r1631 r1735 8 8 <Tool 9 9 Name="VCCLCompilerTool" 10 AdditionalIncludeDirectories=""$(RootDir)";"$(RootDir)src";"$(RootDir)src\orxonox";"$(RootDir)src\tolua";"$(RootDir)src\ois";"$(LibDir)ogre-1.4. 8\OgreMain\include";"$(LibDir)boost-1.35.0";"$(LibDir)enet-1.2\include";"$(LibDir)libogg-1.1.3\include";"$(LibDir)libvorbis-1.2.0\include";"$(LibDir)lua-5.1.3\src";"$(LibDir)openal-1.1\include";"$(LibDir)openal-1.1\alut\include";"$(LibDir)tcl-8.5.\generic";"$(LibDir)zlib-1.2.3""10 AdditionalIncludeDirectories=""$(RootDir)";"$(RootDir)src";"$(RootDir)src\orxonox";"$(RootDir)src\tolua";"$(RootDir)src\ois";"$(LibDir)ogre-1.4.9\OgreMain\include";"$(LibDir)boost-1.35.0";"$(LibDir)enet-1.2\include";"$(LibDir)libogg-1.1.3\include";"$(LibDir)libvorbis-1.2.0\include";"$(LibDir)lua-5.1.3\src";"$(LibDir)openal-1.1\include";"$(LibDir)openal-1.1\alut\include";"$(LibDir)tcl-8.5.\generic";"$(LibDir)zlib-1.2.3"" 11 11 PreprocessorDefinitions="WIN32;__WIN32__;_WIN32;BOOST_ALL_DYN_LINK;OIS_DYNAMIC_LIB; ZLIB_WINAPI" 12 12 WarningLevel="3" -
code/trunk/visual_studio/vc8/network.vcproj
r1567 r1735 147 147 </File> 148 148 <File 149 RelativePath="..\..\src\network\dummyclient.cc" 150 > 151 <FileConfiguration 152 Name="Debug|Win32" 153 ExcludedFromBuild="true" 154 > 155 <Tool 156 Name="VCCLCompilerTool" 157 /> 158 </FileConfiguration> 159 <FileConfiguration 160 Name="Release|Win32" 161 ExcludedFromBuild="true" 162 > 163 <Tool 164 Name="VCCLCompilerTool" 165 /> 166 </FileConfiguration> 167 </File> 168 <File 169 RelativePath="..\..\src\network\dummyclient2.cc" 170 > 171 <FileConfiguration 172 Name="Debug|Win32" 173 ExcludedFromBuild="true" 174 > 175 <Tool 176 Name="VCCLCompilerTool" 177 /> 178 </FileConfiguration> 179 <FileConfiguration 180 Name="Release|Win32" 181 ExcludedFromBuild="true" 182 > 183 <Tool 184 Name="VCCLCompilerTool" 185 /> 186 </FileConfiguration> 187 </File> 188 <File 189 RelativePath="..\..\src\network\dummyclient3.cc" 190 > 191 <FileConfiguration 192 Name="Debug|Win32" 193 ExcludedFromBuild="true" 194 > 195 <Tool 196 Name="VCCLCompilerTool" 197 /> 198 </FileConfiguration> 199 <FileConfiguration 200 Name="Release|Win32" 201 ExcludedFromBuild="true" 202 > 203 <Tool 204 Name="VCCLCompilerTool" 205 /> 206 </FileConfiguration> 207 </File> 208 <File 209 RelativePath="..\..\src\network\dummyserver.cc" 210 > 211 <FileConfiguration 212 Name="Debug|Win32" 213 ExcludedFromBuild="true" 214 > 215 <Tool 216 Name="VCCLCompilerTool" 217 /> 218 </FileConfiguration> 219 <FileConfiguration 220 Name="Release|Win32" 221 ExcludedFromBuild="true" 222 > 223 <Tool 224 Name="VCCLCompilerTool" 225 /> 226 </FileConfiguration> 227 </File> 228 <File 229 RelativePath="..\..\src\network\dummyserver3.cc" 230 > 231 <FileConfiguration 232 Name="Debug|Win32" 233 ExcludedFromBuild="true" 234 > 235 <Tool 236 Name="VCCLCompilerTool" 237 /> 238 </FileConfiguration> 239 <FileConfiguration 240 Name="Release|Win32" 241 ExcludedFromBuild="true" 242 > 243 <Tool 244 Name="VCCLCompilerTool" 245 /> 246 </FileConfiguration> 247 </File> 248 <File 249 RelativePath="..\..\src\network\GameStateClient.cc" 250 > 251 </File> 252 <File 253 RelativePath="..\..\src\network\GameStateManager.cc" 149 RelativePath="..\..\src\network\GamestateClient.cc" 150 > 151 </File> 152 <File 153 RelativePath="..\..\src\network\GamestateHandler.cc" 154 > 155 </File> 156 <File 157 RelativePath="..\..\src\network\GamestateManager.cc" 158 > 159 </File> 160 <File 161 RelativePath="..\..\src\network\Host.cc" 254 162 > 255 163 </File> … … 259 167 </File> 260 168 <File 261 RelativePath="..\..\src\network\PacketDecoder.cc"262 >263 </File>264 <File265 RelativePath="..\..\src\network\PacketGenerator.cc"266 >267 </File>268 <File269 169 RelativePath="..\..\src\network\Server.cc" 270 170 > … … 274 174 > 275 175 </File> 176 <Filter 177 Name="packet" 178 > 179 <File 180 RelativePath="..\..\src\network\packet\Acknowledgement.cc" 181 > 182 </File> 183 <File 184 RelativePath="..\..\src\network\packet\Chat.cc" 185 > 186 </File> 187 <File 188 RelativePath="..\..\src\network\packet\ClassID.cc" 189 > 190 </File> 191 <File 192 RelativePath="..\..\src\network\packet\Gamestate.cc" 193 > 194 </File> 195 <File 196 RelativePath="..\..\src\network\packet\Packet.cc" 197 > 198 </File> 199 <File 200 RelativePath="..\..\src\network\packet\Welcome.cc" 201 > 202 </File> 203 </Filter> 276 204 </Filter> 277 205 <Filter … … 297 225 </File> 298 226 <File 299 RelativePath="..\..\src\network\GameStateClient.h" 300 > 301 </File> 302 <File 303 RelativePath="..\..\src\network\GameStateManager.h" 227 RelativePath="..\..\src\network\GamestateClient.h" 228 > 229 </File> 230 <File 231 RelativePath="..\..\src\network\GamestateHandler.h" 232 > 233 </File> 234 <File 235 RelativePath="..\..\src\network\GamestateManager.h" 236 > 237 </File> 238 <File 239 RelativePath="..\..\src\network\Host.h" 240 > 241 </File> 242 <File 243 RelativePath="..\..\src\network\NetworkCallback.h" 304 244 > 305 245 </File> … … 313 253 </File> 314 254 <File 315 RelativePath="..\..\src\network\PacketManager.h"316 >317 </File>318 <File319 RelativePath="..\..\src\network\PacketTypes.h"320 >321 </File>322 <File323 255 RelativePath="..\..\src\network\Server.h" 324 256 > … … 328 260 > 329 261 </File> 262 <Filter 263 Name="packet" 264 > 265 <File 266 RelativePath="..\..\src\network\packet\Acknowledgement.h" 267 > 268 </File> 269 <File 270 RelativePath="..\..\src\network\packet\Chat.h" 271 > 272 </File> 273 <File 274 RelativePath="..\..\src\network\packet\ClassID.h" 275 > 276 </File> 277 <File 278 RelativePath="..\..\src\network\packet\Gamestate.h" 279 > 280 </File> 281 <File 282 RelativePath="..\..\src\network\packet\Packet.h" 283 > 284 </File> 285 <File 286 RelativePath="..\..\src\network\packet\Welcome.h" 287 > 288 </File> 289 </Filter> 330 290 </Filter> 331 291 </Files> -
code/trunk/visual_studio/vc8/util.vcproj
r1625 r1735 153 153 </File> 154 154 <File 155 RelativePath="..\..\src\util\Bytestream.cc" 156 > 157 </File> 158 <File 155 159 RelativePath="..\..\src\util\Clipboard.cc" 156 160 > … … 195 199 </File> 196 200 <File 201 RelativePath="..\..\src\util\Bytestream.h" 202 > 203 </File> 204 <File 197 205 RelativePath="..\..\src\util\Clipboard.h" 198 206 >
Note: See TracChangeset
for help on using the changeset viewer.