Changeset 3214
- Timestamp:
- Jun 23, 2009, 6:02:25 PM (16 years ago)
- Location:
- code/trunk/src
- Files:
-
- 4 added
- 2 deleted
- 62 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/core/Core.cc
r3196 r3214 47 47 # endif 48 48 # include <windows.h> 49 # undef min 50 # undef max 49 51 #elif defined(ORXONOX_PLATFORM_APPLE) 50 52 # include <sys/param.h> -
code/trunk/src/core/CorePrecompiledHeaders.h
r3196 r3214 35 35 #include "CorePrereqs.h" 36 36 37 #include <cassert> 37 38 #include <fstream> 38 39 #include <iostream> 39 40 #include <list> 41 #include <locale> 40 42 #include <map> 43 #include <queue> 41 44 #include <set> 42 45 #include <sstream> 46 #include <stack> 43 47 #include <string> 44 48 #include <vector> … … 47 51 #ifdef ORXONOX_COMPILER_MSVC 48 52 49 #define WIN32_LEAN_AND_MEAN 50 #include <windows.h> 53 #include <OgreMath.h> 54 #include <OgreVector2.h> 55 #include <OgreVector3.h> 56 #include <OgreVector4.h> 57 #include <OgreQuaternion.h> 58 #include <OgreColourValue.h> 59 60 #include <boost/shared_ptr.hpp> // 12 61 #include <boost/preprocessor/cat.hpp> // 12 62 // Included by both filesystem and thread but still relatively small 63 #include <boost/iterator/iterator_facade.hpp> // 10 64 65 // Just in case some header included windows.h 66 #undef min 51 67 #undef max 52 #undef min53 54 #include <ois/OISKeyboard.h>55 #include <ois/OISMouse.h>56 #include <ois/OISJoyStick.h>57 #include <tinyxml/ticpp.h>58 // Included by both filesystem and thread but still relatively small59 #include <boost/iterator/iterator_facade.hpp>60 68 61 69 #endif /* ORXONOX_COMPILER_MSVC */ 62 70 63 71 64 #include "util/Convert.h"65 72 #include "util/Debug.h" 66 #include "util/Exception.h"67 73 #include "util/Math.h" 68 #include "util/mbool.h"69 74 #include "util/MultiType.h" 70 #include "util/OrxAssert.h"71 #include "util/OrxEnum.h"72 #include "util/String.h"73 75 #include "util/SubString.h" 74 76 -
code/trunk/src/network/CMakeLists.txt
r3196 r3214 24 24 ClientInformation.cc 25 25 ClientConnectionListener.cc 26 Connection Manager.cc26 Connection.cc 27 27 FunctionCallManager.cc 28 28 GamestateManager.cc … … 33 33 PacketBuffer.cc 34 34 Server.cc 35 ServerConnection.cc 35 36 TrafficControl.cc 36 37 ) -
code/trunk/src/network/ChatListener.cc
r2896 r3214 28 28 29 29 #include "ChatListener.h" 30 31 30 #include "core/CoreIncludes.h" 32 31 -
code/trunk/src/network/ChatListener.h
r2171 r3214 31 31 32 32 #include "NetworkPrereqs.h" 33 34 #include "ClientInformation.h"35 33 #include "core/OrxonoxClass.h" 36 34 -
code/trunk/src/network/Client.cc
r3198 r3214 39 39 // 40 40 41 #include "Client.h" 42 41 43 #include <cassert> 42 #include <enet/enet.h>43 44 44 #include " Client.h"45 #include " Host.h"45 #include "util/Debug.h" 46 #include "core/Clock.h" 46 47 #include "synchronisable/Synchronisable.h" 47 #include "core/Clock.h" 48 #include "core/CoreIncludes.h" 49 #include "packet/Packet.h" 48 #include "packet/Chat.h" 49 #include "packet/Gamestate.h" 50 50 #include "FunctionCallManager.h" 51 52 // #include "packet/Acknowledgement.h"53 51 54 52 namespace orxonox 55 53 { 56 // SetConsoleCommandShortcut(Client, chat);57 54 58 55 … … 61 58 * initializes the address and the port to default localhost:NETWORK_PORT 62 59 */ 63 Client::Client(): client_connection(NETWORK_PORT,"127.0.0.1"){ 64 // set server address to localhost 65 isConnected=false; 66 isSynched_=false; 67 gameStateFailure_=false; 60 Client::Client(): 61 isSynched_(false), 62 gameStateFailure_(false) 63 { 68 64 } 69 65 … … 73 69 * @param port port of the application on the server 74 70 */ 75 Client::Client(const std::string& address, int port) : client_connection(port, address){ 76 isConnected=false; 77 isSynched_=false; 78 gameStateFailure_=false; 79 } 80 81 /** 82 * Constructor for the Client class 83 * @param address the server address 84 * @param port port of the application on the server 85 */ 86 Client::Client(const char *address, int port) : client_connection(port, address){ 87 isConnected=false; 88 isSynched_=false; 89 gameStateFailure_=false; 71 Client::Client(const std::string& address, int port): 72 isSynched_(false), 73 gameStateFailure_(false) 74 { 75 setPort( port ); 76 setServerAddress( address ); 90 77 } 91 78 92 79 Client::~Client(){ 93 if (isConnected)80 if ( ClientConnection::isConnected() ) 94 81 closeConnection(); 95 82 } … … 101 88 bool Client::establishConnection(){ 102 89 Synchronisable::setClient(true); 103 isConnected=client_connection.createConnection(); 104 if(!isConnected) 105 COUT(1) << "could not create connection laber" << std::endl; 106 return isConnected; 90 return ClientConnection::establishConnection(); 107 91 } 108 92 … … 112 96 */ 113 97 bool Client::closeConnection(){ 114 isConnected=false; 115 return client_connection.closeConnection(); 98 return ClientConnection::closeConnection(); 116 99 } 117 100 118 101 bool Client::queuePacket(ENetPacket *packet, int clientID){ 119 return client_connection.addPacket(packet); 102 bool b = ClientConnection::addPacket(packet); 103 assert(b); 104 return b; 120 105 } 121 106 … … 143 128 //this steers our network frequency 144 129 timeSinceLastUpdate_+=time.getDeltaTime(); 145 if(timeSinceLastUpdate_>=NETWORK_PERIOD){ 130 if(timeSinceLastUpdate_>=NETWORK_PERIOD) 131 { 146 132 timeSinceLastUpdate_ -= static_cast<unsigned int>( timeSinceLastUpdate_ / NETWORK_PERIOD ) * NETWORK_PERIOD; 147 133 // COUT(3) << "."; 148 if(client_connection.isConnected() && isSynched_){ 134 if ( isConnected() && isSynched_ ) 135 { 149 136 COUT(4) << "popping partial gamestate: " << std::endl; 150 137 packet::Gamestate *gs = gamestate.getGamestate(); … … 159 146 } 160 147 } 148 sendPackets(); // flush the enet queue 161 149 162 ENetEvent *event; 163 // stop if the packet queue is empty 164 while(!(client_connection.queueEmpty())){ 165 event = client_connection.getEvent(); 166 COUT(5) << "tick packet size " << event->packet->dataLength << std::endl; 167 packet::Packet *packet = packet::Packet::createPacket(event->packet, event->peer); 168 // note: packet commits suicide here except for the GameState. That is then deleted by a GamestateHandler 169 bool b = packet->process(); 170 assert(b); 171 delete event; 172 } 150 Connection::processQueue(); 173 151 if(gamestate.processGamestates()) 174 152 { -
code/trunk/src/network/Client.h
r3084 r3214 45 45 46 46 #include <string> 47 48 #include "Host.h"49 #include "packet/Chat.h"50 47 #include "ClientConnection.h" 51 48 #include "GamestateClient.h" 52 49 #include "Host.h" 53 50 54 51 namespace orxonox … … 61 58 * 62 59 */ 63 class _NetworkExport Client : public Host {60 class _NetworkExport Client : public Host, public ClientConnection{ 64 61 public: 65 62 Client(); 66 63 Client(const std::string& address, int port); 67 Client(const char *address, int port);68 64 ~Client(); 69 65 … … 74 70 virtual bool chat(const std::string& message); 75 71 virtual bool broadcast(const std::string& message) { return false; } 76 //bool sendChat(packet::Chat *chat);77 72 78 73 void update(const Clock& time); … … 82 77 virtual bool isServer_(){return false;} 83 78 84 ClientConnection client_connection;85 79 GamestateClient gamestate; 86 bool isConnected;87 80 bool isSynched_; 88 81 -
code/trunk/src/network/ClientConnection.cc
r3198 r3214 27 27 */ 28 28 29 //30 // C++ Interface: ClientConnection31 //32 // Description: The Class ClientConnection manages the servers conenctions to the clients.33 // each connection is provided by a new process. communication between master process and34 // connection processes is provided by ...35 //36 //37 // Author: Oliver Scheuss38 //39 40 29 #include "ClientConnection.h" 41 30 31 #include <cassert> 42 32 #include <enet/enet.h> 43 #include <iostream>44 #include <cassert>45 // boost.thread library for multithreading support46 #include <boost/thread/thread.hpp>47 #include <boost/bind.hpp>48 #include <boost/thread/recursive_mutex.hpp>49 50 #include "util/Sleep.h"51 33 #include "util/Debug.h" 52 34 53 35 namespace orxonox 54 36 { 55 //static boost::thread_group network_threads; 37 const unsigned int NETWORK_CLIENT_WAIT_TIME = 1; 38 const unsigned int NETWORK_CLIENT_CONNECTION_TIMEOUT = 3000; //millisecs 39 const unsigned int NETWORK_CLIENT_MAX_CONNECTIONS = 5; 40 const unsigned int NETWORK_CLIENT_CHANNELS = 2; 56 41 57 static boost::recursive_mutex enet_mutex_g;58 42 59 ClientConnection::ClientConnection(int port, const std::string& address) { 60 quit_=false; 61 server=NULL; 62 serverAddress = new ENetAddress(); 63 enet_address_set_host(serverAddress, address.c_str()); 64 serverAddress->port = port; 65 established=false; 66 } 67 68 ClientConnection::ClientConnection(int port, const char *address) { 69 quit_=false; 70 server=NULL; 71 serverAddress = new ENetAddress(); 72 enet_address_set_host(serverAddress, address); 73 serverAddress->port = port; 74 established=false; 75 } 76 77 bool ClientConnection::waitEstablished(int milisec) { 78 for(int i=0; i<=milisec && !established; i++) 79 msleep(1); 80 81 return established; 43 ClientConnection::ClientConnection(): 44 established_(false), 45 server_(NULL) 46 { 47 this->serverAddress_ = new ENetAddress(); 48 //set standard address and port 49 enet_address_set_host(this->serverAddress_, "127.0.0.1"); 50 serverAddress_->port = NETWORK_PORT; 82 51 } 83 52 84 53 ClientConnection::~ClientConnection(){ 85 if( established)54 if(this->established_) 86 55 closeConnection(); 87 delete serverAddress; // surely was created56 delete this->serverAddress_; // surely was created 88 57 } 89 58 90 ENetEvent *ClientConnection::getEvent(){ 91 if(!buffer.isEmpty()) 92 return buffer.pop(); 93 else 94 return NULL; 59 void ClientConnection::setServerAddress( const std::string& serverAddress ) { 60 enet_address_set_host (this->serverAddress_, serverAddress.c_str()); 95 61 } 96 62 97 bool ClientConnection::queueEmpty() {98 return buffer.isEmpty();63 void ClientConnection::setPort( unsigned int port ) { 64 this->serverAddress_->port = port; 99 65 } 100 66 101 bool ClientConnection::createConnection() { 102 receiverThread_ = new boost::thread(boost::bind(&ClientConnection::receiverThread, this)); 103 //network_threads.create_thread(boost::bind(boost::mem_fn(&ClientConnection::receiverThread), this)); 104 // wait 10 seconds for the connection to be established 105 return waitEstablished(NETWORK_CLIENT_CONNECT_TIMEOUT); 106 } 107 108 bool ClientConnection::closeConnection() { 109 quit_=true; 110 //network_threads.join_all(); 111 receiverThread_->join(); 112 established=false; 113 return true; 114 } 115 116 117 bool ClientConnection::addPacket(ENetPacket *packet) { 118 if(server==NULL) 119 return false; 120 if(packet==NULL){ 121 COUT(3) << "Cl.con: addpacket: invalid packet" << std::endl; 67 bool ClientConnection::establishConnection() 68 { 69 ENetEvent event; 70 71 this->host_ = enet_host_create(NULL, NETWORK_CLIENT_MAX_CONNECTIONS, 0, 0); 72 if ( this->host_ == NULL ) 73 { 74 COUT(2) << "ClientConnection: host_ == NULL" << std::endl; 75 // error handling 122 76 return false; 123 77 } 124 boost::recursive_mutex::scoped_lock lock(enet_mutex_g); 125 if(enet_peer_send(server, 0, packet)<0) 126 return false; 127 else 128 return true; 129 } 130 131 bool ClientConnection::sendPackets() { 132 if(server==NULL) 133 return false; 134 boost::recursive_mutex::scoped_lock lock(enet_mutex_g); 135 enet_host_flush(client); 136 lock.unlock(); 137 return true; 138 } 139 140 void ClientConnection::receiverThread() { 141 // what about some error-handling here ? 142 atexit(enet_deinitialize); 143 ENetEvent *event; 78 this->server_ = enet_host_connect(this->host_, serverAddress_, NETWORK_CLIENT_CHANNELS); 79 if ( this->server_==NULL ) 144 80 { 145 boost::recursive_mutex::scoped_lock lock(enet_mutex_g);146 enet_initialize();147 client = enet_host_create(NULL, NETWORK_CLIENT_MAX_CONNECTIONS, 0, 0);148 lock.unlock();149 }150 if(client==NULL) {151 COUT(2) << "ClientConnection: could not create client host" << std::endl;152 // add some error handling here ==========================153 quit_=true;154 }155 //connect to the server156 if(!establishConnection()){157 COUT(2) << "clientConn: receiver thread: could not establishConnection" << std::endl;158 quit_=true;159 return;160 }161 event = new ENetEvent;162 //main loop163 while(!quit_){164 //std::cout << "connection loop" << std::endl;165 {166 boost::recursive_mutex::scoped_lock lock(enet_mutex_g);167 if(enet_host_service(client, event, NETWORK_CLIENT_WAIT_TIME)<0){168 // we should never reach this point169 // assert(0);170 printf("ClientConnection: ENet returned with an error!\n");171 // quit_=true;172 continue;173 // add some error handling here ========================174 }175 lock.unlock();176 }177 switch(event->type){178 // log handling ================179 case ENET_EVENT_TYPE_CONNECT:180 break;181 case ENET_EVENT_TYPE_RECEIVE:182 //COUT(5) << "Cl.Con: receiver-Thread while loop: got new packet" << std::endl;183 if ( !processData(event) ) COUT(2) << "Current packet was not pushed to packetBuffer -> ev ongoing SegFault" << std::endl;184 //COUT(5) << "Cl.Con: processed Data in receiver-thread while loop" << std::endl;185 event = new ENetEvent;186 break;187 case ENET_EVENT_TYPE_DISCONNECT:188 quit_=true;189 printf("Received disconnect Packet from Server!\n");190 // server closed the connection191 return;192 break;193 case ENET_EVENT_TYPE_NONE:194 //receiverThread_->yield();195 msleep(1);196 break;197 }198 }199 delete event;200 // now disconnect201 202 if(!disconnectConnection())203 {204 printf("could not disconnect properly\n");205 // if disconnecting failed destroy conn.206 boost::recursive_mutex::scoped_lock lock(enet_mutex_g);207 enet_peer_reset(server);208 }209 else210 printf("properly disconnected\n");211 return;212 }213 214 bool ClientConnection::disconnectConnection() {215 ENetEvent event;216 if(this->quit_)217 return true;218 boost::recursive_mutex::scoped_lock lock(enet_mutex_g);219 enet_peer_disconnect(server, 0);220 while(enet_host_service(client, &event, NETWORK_CLIENT_WAIT_TIME) >= 0){221 switch (event.type)222 {223 case ENET_EVENT_TYPE_NONE:224 case ENET_EVENT_TYPE_CONNECT:225 case ENET_EVENT_TYPE_RECEIVE:226 enet_packet_destroy(event.packet);227 break;228 case ENET_EVENT_TYPE_DISCONNECT:229 printf("received disconnect confirmation from server");230 return true;231 }232 }233 enet_peer_reset(server);234 return false;235 }236 237 bool ClientConnection::establishConnection() {238 ENetEvent event;239 // connect to peer (server is type ENetPeer*)240 boost::recursive_mutex::scoped_lock lock(enet_mutex_g);241 server = enet_host_connect(client, serverAddress, NETWORK_CLIENT_CHANNELS);242 if(server==NULL) {243 81 COUT(2) << "ClientConnection: server == NULL" << std::endl; 244 82 // error handling … … 246 84 } 247 85 // handshake 248 while(enet_host_service(client, &event, NETWORK_CLIENT_WAIT_TIME)>=0 && !quit_){ 249 if( event.type == ENET_EVENT_TYPE_CONNECT ){ 250 established=true; 86 for( unsigned int i=0; i<NETWORK_CLIENT_CONNECTION_TIMEOUT/NETWORK_CLIENT_WAIT_TIME; i++ ) 87 { 88 if( enet_host_service(this->host_, &event, NETWORK_CLIENT_WAIT_TIME)>=0 && event.type == ENET_EVENT_TYPE_CONNECT ) 89 { 90 this->established_=true; 251 91 return true; 252 92 } 253 93 } 254 COUT( 2) << "ClientConnection: enet_host_service < 0 or event.type != ENET_EVENT_TYPE_CONNECT # EVENT:" << event.type << std::endl;94 COUT(1) << "Could not connect to server" << endl; 255 95 return false; 256 96 } 257 97 258 bool ClientConnection::processData(ENetEvent *event) { 259 COUT(5) << "Cl.Con: got packet, pushing to queue" << std::endl; 260 // just add packet to the buffer 261 // this can be extended with some preprocessing 262 return buffer.push(event); 98 bool ClientConnection::closeConnection() { 99 ENetEvent event; 100 101 if ( !this->established_ ) 102 return true; 103 this->established_ = false; 104 enet_peer_disconnect(this->server_, 0); 105 for( unsigned int i=0; i<NETWORK_CLIENT_CONNECTION_TIMEOUT/NETWORK_CLIENT_WAIT_TIME; i++) 106 { 107 if ( enet_host_service(this->host_, &event, NETWORK_CLIENT_WAIT_TIME) >= 0 ) 108 { 109 switch (event.type) 110 { 111 case ENET_EVENT_TYPE_NONE: 112 case ENET_EVENT_TYPE_CONNECT: 113 break; 114 case ENET_EVENT_TYPE_RECEIVE: 115 enet_packet_destroy(event.packet); 116 break; 117 case ENET_EVENT_TYPE_DISCONNECT: 118 COUT(4) << "received disconnect confirmation from server" << endl; 119 return true; 120 } 121 } 122 } 123 enet_peer_reset( this->server_ ); 124 return false; 125 } 126 127 128 bool ClientConnection::addPacket(ENetPacket *packet) { 129 assert( this->server_ ); 130 assert( packet ); 131 return Connection::addPacket( packet, this->server_ ); 132 } 133 134 void ClientConnection::addClient(ENetEvent* event) 135 { 136 assert(0); 137 } 138 void ClientConnection::disconnectPeer(ENetEvent* event) 139 { 140 this->established_=false; 141 COUT(1) << "Received disconnect Packet from Server!" << endl; 142 // server closed the connection 263 143 } 264 144 -
code/trunk/src/network/ClientConnection.h
r3084 r3214 26 26 * 27 27 */ 28 29 // 30 // C++ Interface: ClientConnection 31 // 32 // Description: 33 // 34 // 35 // Author: Oliver Scheuss, (C) 2007 36 // 37 // Copyright: See COPYING file that comes with this distribution 38 // 39 // 28 40 29 #ifndef _ClientConnection_H__ 41 30 #define _ClientConnection_H__ 42 31 43 32 #include "NetworkPrereqs.h" 44 45 #include <string> 46 #include "PacketBuffer.h" 47 48 namespace boost { class thread; } 33 #include "Connection.h" 49 34 50 35 namespace orxonox 51 36 { 52 37 53 const int NETWORK_PORT = 55556; 54 const int NETWORK_CLIENT_MAX_CONNECTIONS = 5; 55 const int NETWORK_CLIENT_WAIT_TIME = 10; 56 const int NETWORK_CLIENT_CONNECT_TIMEOUT = 3000; // miliseconds 57 const int NETWORK_CLIENT_CHANNELS = 2; 58 59 60 class _NetworkExport ClientConnection{ 38 class _NetworkExport ClientConnection: public Connection{ 61 39 public: 62 ClientConnection(int port, const std::string& address); 63 ClientConnection(int port, const char* address); 64 ~ClientConnection(); 40 ClientConnection(); 41 virtual ~ClientConnection(); 42 43 void setServerAddress( const std::string& serverAddress ); 44 void setPort( unsigned int port ); 45 65 46 ENetEvent *getEvent(); 66 47 // check wheter the packet queue is empty 67 48 bool queueEmpty(); 68 49 // create a new listener thread 69 bool createConnection();70 bool closeConnection();50 virtual bool establishConnection(); 51 virtual bool closeConnection(); 71 52 // add a packet to queue for the server 72 53 bool addPacket(ENetPacket *packet); 73 // send out all queued packets 74 bool sendPackets(); 75 // send out all queued packets and save result in event 76 //bool sendPackets(ENetEvent *event); 77 bool waitEstablished(int milisec); 78 inline bool isConnected(){return established;} 79 inline bool checkConnection(){ return !quit_ && isConnected(); } 54 inline bool isConnected(){ return this->established_; } 80 55 private: 81 ClientConnection(const ClientConnection& copy); // not used 82 bool processData(ENetEvent *event); 83 // implementation of the listener 84 void receiverThread(); //thread2 85 //packetbuffer 86 bool establishConnection(); 56 virtual void addClient(ENetEvent* event); 57 virtual void disconnectPeer(ENetEvent* event); 58 87 59 bool disconnectConnection(); 88 PacketBuffer buffer;89 60 // enet stuff 90 ENetHost *client; 91 ENetAddress *serverAddress; 92 // quit-variable (communication with threads) 93 bool quit_; 94 bool established; 61 ENetAddress *serverAddress_; 62 bool established_; 95 63 // clientlist 96 ENetPeer *server; 97 boost::thread *receiverThread_; 64 ENetPeer *server_; 98 65 }; 99 100 101 102 103 104 105 66 106 67 -
code/trunk/src/network/ClientConnectionListener.cc
r2896 r3214 28 28 29 29 #include "ClientConnectionListener.h" 30 30 31 #include "core/CoreIncludes.h" 31 32 #include "core/GameMode.h" 33 #include "ClientInformation.h" 32 34 33 35 namespace orxonox{ -
code/trunk/src/network/ClientConnectionListener.h
r2171 r3214 1 #ifndef _NETWORK_CLIENTCONNECTIONLISTENER__ 2 #define _NETWORK_CLIENTCONNECTIONLISTENER__ 1 /* 2 * ORXONOX - the hottest 3D action shooter ever to exist 3 * > www.orxonox.net < 4 * 5 * 6 * License notice: 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 2 11 * of the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 * 22 * Author: 23 * Oliver Scheuss <scheusso [at] ee.ethz.ch>, (C) 2008 24 * Co-authors: 25 * ... 26 * 27 */ 28 29 #ifndef _ClientConnectionListener_H__ 30 #define _ClientConnectionListener_H__ 3 31 4 32 #include "NetworkPrereqs.h" 5 #include "ClientInformation.h"6 33 #include "core/OrxonoxClass.h" 7 34 … … 26 53 27 54 28 #endif 55 #endif /* _ClientConnectionListener_H__ */ -
code/trunk/src/network/ClientInformation.cc
r2773 r3214 40 40 41 41 #include "ClientInformation.h" 42 43 42 #include <enet/enet.h> 44 #include <iostream> //debug45 43 46 44 namespace orxonox -
code/trunk/src/network/FunctionCallManager.h
r3084 r3214 1 /* 2 * ORXONOX - the hottest 3D action shooter ever to exist 3 * > www.orxonox.net < 4 * 5 * 6 * License notice: 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 2 11 * of the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 * 22 * Author: 23 * Oliver Scheuss <scheusso [at] ee.ethz.ch>, (C) 2008 24 * Co-authors: 25 * ... 26 * 27 */ 1 28 2 #ifndef NETWORKFUNCTIONCALLMANAGER_H3 #define NETWORKFUNCTIONCALLMANAGER_H29 #ifndef _FunctionCallManager_H__ 30 #define _FunctionCallManager_H__ 4 31 5 32 #include "NetworkPrereqs.h" 6 #include "packet/FunctionCalls.h" 33 7 34 #include <map> 8 35 #include "util/UtilPrereqs.h" 9 36 10 37 namespace orxonox { … … 12 39 @author 13 40 */ 14 15 class MultiType;16 41 17 42 class _NetworkExport FunctionCallManager … … 42 67 } //namespace orxonox 43 68 44 #endif 69 #endif /* _FunctionCallManager_H__ */ -
code/trunk/src/network/GamestateClient.cc
r3196 r3214 29 29 #include "GamestateClient.h" 30 30 31 #include <cassert> 32 #include <zlib.h> 33 34 #include "core/CoreIncludes.h" 35 #include "core/BaseObject.h" 31 #include "util/Debug.h" 32 #include "core/ObjectList.h" 36 33 #include "synchronisable/Synchronisable.h" 37 34 #include "synchronisable/NetworkCallbackManager.h" 38 35 #include "packet/Acknowledgement.h" 36 #include "packet/Gamestate.h" 39 37 40 38 -
code/trunk/src/network/GamestateClient.h
r2171 r3214 41 41 #define _GamestateClient_H__ 42 42 43 #include "NetworkPrereqs.h" 44 43 45 #include <map> 44 //45 #include "NetworkPrereqs.h"46 46 #include "core/CorePrereqs.h" 47 #include "packet/Gamestate.h"48 47 #include "GamestateHandler.h" 49 48 -
code/trunk/src/network/GamestateHandler.cc
r2773 r3214 1 #include <cassert> 1 /* 2 * ORXONOX - the hottest 3D action shooter ever to exist 3 * > www.orxonox.net < 4 * 5 * 6 * License notice: 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 2 11 * of the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 * 22 * Author: 23 * Oliver Scheuss <scheusso [at] ee.ethz.ch>, (C) 2008 24 * Co-authors: 25 * ... 26 * 27 */ 2 28 3 29 #include "GamestateHandler.h" 4 #include "packet/Packet.h"30 #include <cassert> 5 31 6 32 namespace orxonox { -
code/trunk/src/network/GamestateHandler.h
r2171 r3214 26 26 * 27 27 */ 28 #ifndef NETWORKGAMESTATEHANDLER_H29 #define NETWORKGAMESTATEHANDLER_H30 28 31 #include <string> 29 #ifndef _GamestateHandler_H__ 30 #define _GamestateHandler_H__ 32 31 33 32 #include "NetworkPrereqs.h" 34 #include "packet/Chat.h"35 33 36 34 namespace orxonox { … … 58 56 } 59 57 60 #endif 58 #endif /* _GamestateHandler_H__ */ -
code/trunk/src/network/GamestateManager.cc
r3198 r3214 41 41 #include "GamestateManager.h" 42 42 43 #include <utility>44 #include <iostream>45 #include <zlib.h>46 43 #include <cassert> 47 44 48 #include "core/CoreIncludes.h" 49 #include "core/BaseObject.h" 45 #include "util/Debug.h" 50 46 #include "ClientInformation.h" 51 #include "synchronisable/Synchronisable.h" 47 #include "packet/Acknowledgement.h" 48 #include "packet/Gamestate.h" 52 49 #include "synchronisable/NetworkCallbackManager.h" 53 #include " packet/Acknowledgement.h"50 #include "TrafficControl.h" 54 51 55 52 namespace orxonox -
code/trunk/src/network/GamestateManager.h
r3084 r3214 42 42 43 43 #include "NetworkPrereqs.h" 44 45 #include <map> 44 46 #include "GamestateHandler.h" 45 #include "TrafficControl.h"46 #include <map>47 48 #include "packet/Gamestate.h"49 47 50 48 namespace orxonox 51 49 { 52 50 53 51 const int KEEP_GAMESTATES = 10; 54 52 55 53 /** -
code/trunk/src/network/Host.cc
r3095 r3214 27 27 */ 28 28 29 #include "Host.h" 30 29 31 #include <cassert> 32 #include <string> 30 33 31 #include "Host.h"32 34 #include "core/ConsoleCommand.h" 33 #include " packet/Packet.h"35 #include "core/ObjectList.h" 34 36 #include "ChatListener.h" 35 37 -
code/trunk/src/network/Host.h
r3196 r3214 26 26 * 27 27 */ 28 #ifndef NETWORKHOST_H29 #define NETWORKHOST_H30 28 31 #include <string> 29 #ifndef _NETWORK_Host_H__ 30 #define _NETWORK_Host_H__ 32 31 33 32 #include "NetworkPrereqs.h" 34 #include "packet/Chat.h"35 33 36 34 namespace orxonox { … … 86 84 } 87 85 88 #endif 86 #endif /* _NETWORK_Host_H__ */ -
code/trunk/src/network/NetworkFunction.cc
r3084 r3214 28 28 29 29 #include "NetworkFunction.h" 30 #include <string> 31 #include "synchronisable/Synchronisable.h" 30 #include "core/CoreIncludes.h" 32 31 33 32 namespace orxonox … … 42 41 std::map<uint32_t, NetworkMemberFunctionBase*> NetworkMemberFunctionBase::idMap_; 43 42 44 NetworkFunctionBase::NetworkFunctionBase( std::stringname)43 NetworkFunctionBase::NetworkFunctionBase(const std::string& name) 45 44 { 46 45 RegisterRootObject(NetworkFunctionBase); … … 58 57 59 58 60 NetworkFunctionStatic::NetworkFunctionStatic(FunctorStatic* functor, std::stringname, const NetworkFunctionPointer& p):59 NetworkFunctionStatic::NetworkFunctionStatic(FunctorStatic* functor, const std::string& name, const NetworkFunctionPointer& p): 61 60 NetworkFunctionBase(name) 62 61 { … … 75 74 76 75 77 NetworkMemberFunctionBase::NetworkMemberFunctionBase( std::stringname, const NetworkFunctionPointer& p):76 NetworkMemberFunctionBase::NetworkMemberFunctionBase(const std::string& name, const NetworkFunctionPointer& p): 78 77 NetworkFunctionBase(name) 79 78 { -
code/trunk/src/network/NetworkFunction.h
r3196 r3214 27 27 */ 28 28 29 #ifndef NETWORKFUNCTION_H30 #define NETWORKFUNCTION_H29 #ifndef _NetworkFunction_H__ 30 #define _NetworkFunction_H__ 31 31 32 32 #include "NetworkPrereqs.h" 33 34 #include <cassert> 35 #include <cstring> 36 #include <map> 37 #include <string> 38 #include <boost/preprocessor/cat.hpp> 39 33 40 #include "core/OrxonoxClass.h" 34 35 #include <string>36 #include <map>37 #include <cassert>38 #include <boost/preprocessor/cat.hpp>39 #include "util/MultiType.h"40 41 #include "core/Functor.h" 42 #include "FunctionCallManager.h" 41 43 #include "synchronisable/Synchronisable.h" 42 #include "OrxonoxConfig.h"43 #include "FunctionCallManager.h"44 45 44 46 45 namespace orxonox … … 72 71 class _NetworkExport NetworkFunctionBase: virtual public OrxonoxClass { 73 72 public: 74 NetworkFunctionBase( std::stringname);73 NetworkFunctionBase(const std::string& name); 75 74 ~NetworkFunctionBase(); 76 75 77 inline voidsetNetworkID(uint32_t id) { this->networkID_ = id; }76 virtual void setNetworkID(uint32_t id) { this->networkID_ = id; } 78 77 inline uint32_t getNetworkID() const { return this->networkID_; } 79 inline std::string getName() const{ return name_; }78 inline const std::string& getName() const { return name_; } 80 79 static inline bool isStatic( uint32_t networkID ) { return isStaticMap_[networkID]; } 81 80 82 static inline void setNetworkID( std::stringname, uint32_t id){ assert( nameMap_.find(name)!=nameMap_.end() ); nameMap_[name]->setNetworkID(id); }81 static inline void setNetworkID(const std::string& name, uint32_t id){ assert( nameMap_.find(name)!=nameMap_.end() ); nameMap_[name]->setNetworkID(id); } 83 82 84 83 protected: … … 95 94 class _NetworkExport NetworkFunctionStatic: public NetworkFunctionBase { 96 95 public: 97 NetworkFunctionStatic(FunctorStatic* functor, std::stringname, const NetworkFunctionPointer& p);96 NetworkFunctionStatic(FunctorStatic* functor, const std::string& name, const NetworkFunctionPointer& p); 98 97 ~NetworkFunctionStatic(); 99 98 … … 105 104 inline void call(const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5){ (*this->functor_)(mt1, mt2, mt3, mt4, mt5); } 106 105 106 virtual void setNetworkID( uint32_t id ){ NetworkFunctionBase::setNetworkID( id ); idMap_[id] = this; } 107 107 static inline NetworkFunctionStatic* getNetworkFunction( uint32_t id){ assert( idMap_.find(id)!=idMap_.end() ); return idMap_[id]; } 108 108 static NetworkFunctionStatic* getFunction( uint32_t id ){ assert( idMap_.find(id) != idMap_.end() ); return idMap_[id]; } … … 120 120 class _NetworkExport NetworkMemberFunctionBase: public NetworkFunctionBase { 121 121 public: 122 NetworkMemberFunctionBase( std::stringname, const NetworkFunctionPointer& p);122 NetworkMemberFunctionBase(const std::string& name, const NetworkFunctionPointer& p); 123 123 ~NetworkMemberFunctionBase(); 124 124 125 virtual void setNetworkID( uint32_t id ){ NetworkFunctionBase::setNetworkID( id ); idMap_[id] = this; } 125 126 static inline NetworkMemberFunctionBase* getNetworkFunction( uint32_t id){ assert( idMap_.find(id)!=idMap_.end() ); return idMap_[id]; } 126 127 static NetworkMemberFunctionBase* getFunction( uint32_t id ){ assert( idMap_.find(id) != idMap_.end() ); return idMap_[id]; } … … 143 144 template <class T> class NetworkMemberFunction: public NetworkMemberFunctionBase { 144 145 public: 145 NetworkMemberFunction(FunctorMember<T>* functor, std::stringname, const NetworkFunctionPointer& p);146 NetworkMemberFunction(FunctorMember<T>* functor, const std::string& name, const NetworkFunctionPointer& p); 146 147 ~NetworkMemberFunction(); 147 148 … … 181 182 }; 182 183 183 template <class T> NetworkMemberFunction<T>::NetworkMemberFunction(FunctorMember<T>* functor, std::stringname, const NetworkFunctionPointer& p):184 template <class T> NetworkMemberFunction<T>::NetworkMemberFunction(FunctorMember<T>* functor, const std::string& name, const NetworkFunctionPointer& p): 184 185 NetworkMemberFunctionBase(name, p), functor_(functor) 185 186 { … … 199 200 } 200 201 201 template<class T> inline void* registerStaticNetworkFunctionFct( T ptr, std::stringname )202 template<class T> inline void* registerStaticNetworkFunctionFct( T ptr, const std::string& name ) 202 203 { 203 204 NetworkFunctionPointer destptr; … … 207 208 } 208 209 209 template<class T, class PT> inline void* registerMemberNetworkFunctionFct( PT ptr, std::stringname )210 template<class T, class PT> inline void* registerMemberNetworkFunctionFct( PT ptr, const std::string& name ) 210 211 { 211 212 NetworkFunctionPointer destptr; … … 237 238 } 238 239 239 #endif 240 #endif /* _NetworkFunction_H__ */ -
code/trunk/src/network/NetworkPrecompiledHeaders.h
r3196 r3214 35 35 #include "NetworkPrereqs.h" 36 36 37 #include <cassert> 37 38 #include <fstream> 38 39 #include <iostream> 39 40 #include <list> 40 41 #include <map> 42 #include <queue> 41 43 #include <set> 42 44 #include <sstream> … … 47 49 #ifdef ORXONOX_COMPILER_MSVC 48 50 51 #include <OgreMath.h> 52 #include <OgreVector2.h> 53 #include <OgreVector3.h> 54 #include <OgreVector4.h> 55 #include <OgreQuaternion.h> 56 #include <OgreColourValue.h> 57 49 58 #define WIN32_LEAN_AND_MEAN 50 59 #include <enet/enet.h> … … 52 61 #undef min 53 62 54 // Too larg PCH file if you include this and only 10% faster55 //#include <boost/thread/recursive_mutex.hpp>56 57 #include "util/CRC32.h"58 63 #include "util/Debug.h" 59 #include "util/Math.h" 60 #include "util/mbool.h" 61 #include "util/MultiType.h" 62 #include "util/String.h" 63 64 #include "core/Core.h" 65 #include "core/CoreIncludes.h" 66 #include "core/Functor.h" 67 #include "core/GameMode.h" 64 #include "core/Identifier.h" 68 65 69 66 #endif /* ORXONOX_COMPILER_MSVC */ -
code/trunk/src/network/NetworkPrereqs.h
r3084 r3214 89 89 class ClientFrameListener; 90 90 class ClientInformation; 91 class Connection Manager;91 class Connection; 92 92 class FunctionCallManager; 93 93 class GamestateClient; … … 104 104 class PacketBuffer; 105 105 class Server; 106 class ServerConnection; 106 107 class ServerFrameListener; 107 108 class Synchronisable; … … 113 114 struct QueueItem; 114 115 struct syncData; 116 class TrafficControl; 115 117 class obj; 116 118 class objInfo; … … 127 129 class Packet; 128 130 class Welcome; 131 132 namespace PacketFlag 133 { 134 enum Enum 135 { 136 Reliable = 1, 137 Unsequence = 2, 138 NoAllocate = 4 139 }; 140 } 129 141 } 130 142 } -
code/trunk/src/network/PacketBuffer.cc
r2773 r3214 33 33 #include "PacketBuffer.h" 34 34 35 #include <enet/enet.h> 36 #include <iostream> 37 #include <queue> 38 #include <string> 39 #include <boost/bind.hpp> 40 #include <boost/thread/mutex.hpp> 35 //#include <iostream> 41 36 #include <boost/thread/recursive_mutex.hpp> 42 37 -
code/trunk/src/network/Server.cc
r3198 r3214 42 42 43 43 #include <enet/enet.h> 44 #include <iostream>45 44 #include <cassert> 46 47 48 #include "ConnectionManager.h" 49 #include "ClientConnectionListener.h" 45 #include <string> 46 47 #include "util/Debug.h" 48 #include "core/Clock.h" 49 #include "core/ObjectList.h" 50 #include "packet/Chat.h" 51 #include "packet/ClassID.h" 52 #include "packet/DeleteObjects.h" 53 #include "packet/FunctionIDs.h" 54 #include "packet/Gamestate.h" 55 #include "packet/Welcome.h" 56 #include "ChatListener.h" 57 #include "ClientInformation.h" 58 #include "FunctionCallManager.h" 50 59 #include "GamestateManager.h" 51 #include "ClientInformation.h"52 #include "util/Sleep.h"53 #include "core/Clock.h"54 #include "core/ConsoleCommand.h"55 #include "core/CoreIncludes.h"56 #include "packet/Chat.h"57 #include "packet/Packet.h"58 #include "packet/Welcome.h"59 #include "packet/DeleteObjects.h"60 #include "util/Convert.h"61 #include "ChatListener.h"62 #include "FunctionCallManager.h"63 #include "packet/FunctionIDs.h"64 65 60 66 61 namespace orxonox … … 74 69 Server::Server() { 75 70 timeSinceLastUpdate_=0; 76 connection = new ConnectionManager();77 71 gamestates_ = new GamestateManager(); 78 72 } 79 73 80 74 Server::Server(int port){ 75 this->setPort( port ); 81 76 timeSinceLastUpdate_=0; 82 connection = new ConnectionManager(port);83 77 gamestates_ = new GamestateManager(); 84 78 } … … 90 84 */ 91 85 Server::Server(int port, const std::string& bindAddress) { 86 this->setPort( port ); 87 this->setBindAddress( bindAddress ); 92 88 timeSinceLastUpdate_=0; 93 connection = new ConnectionManager(port, bindAddress);94 89 gamestates_ = new GamestateManager(); 95 90 } 96 91 97 92 /** 98 * Constructor99 * @param port Port to listen on100 * @param bindAddress Address to listen on101 */102 Server::Server(int port, const char *bindAddress) {103 timeSinceLastUpdate_=0;104 connection = new ConnectionManager(port, bindAddress);105 gamestates_ = new GamestateManager();106 }107 108 /**109 93 * @brief Destructor 110 94 */ 111 95 Server::~Server(){ 112 if(connection)113 delete connection;114 96 if(gamestates_) 115 97 delete gamestates_; … … 120 102 */ 121 103 void Server::open() { 122 connection->createListener(); 104 COUT(4) << "opening server" << endl; 105 this->openListener(); 123 106 return; 124 107 } … … 128 111 */ 129 112 void Server::close() { 130 ClientInformation *temp = ClientInformation::getBegin(); 131 ClientInformation *temp2; 132 // disconnect all connected clients 133 while( temp ) 134 { 135 temp2 = temp; 136 temp = temp->next(); 137 disconnectClient( temp2 ); 138 } 139 connection->quitListener(); 113 COUT(4) << "closing server" << endl; 114 this->disconnectClients(); 115 this->closeListener(); 140 116 return; 141 117 } … … 162 138 */ 163 139 void Server::update(const Clock& time) { 164 processQueue();140 Connection::processQueue(); 165 141 gamestates_->processGamestates(); 166 142 //this steers our network frequency 167 143 timeSinceLastUpdate_+=time.getDeltaTime(); 168 if(timeSinceLastUpdate_>=NETWORK_PERIOD){ 144 if(timeSinceLastUpdate_>=NETWORK_PERIOD) 145 { 169 146 timeSinceLastUpdate_ -= static_cast<unsigned int>( timeSinceLastUpdate_ / NETWORK_PERIOD ) * NETWORK_PERIOD; 170 147 updateGamestate(); 171 148 FunctionCallManager::sendCalls(); 172 149 } 150 sendPackets(); // flush the enet queue 173 151 } 174 152 175 153 bool Server::queuePacket(ENetPacket *packet, int clientID){ 176 return connection->addPacket(packet, clientID);154 return ServerConnection::addPacket(packet, clientID); 177 155 } 178 156 … … 191 169 assert(ClientInformation::findClient(clientID)); 192 170 return ClientInformation::findClient(clientID)->getPacketLoss(); 193 }194 195 /**196 * processes all the packets waiting in the queue197 */198 void Server::processQueue() {199 ENetEvent *event;200 while(!connection->queueEmpty()){201 //std::cout << "Client " << clientID << " sent: " << std::endl;202 //clientID here is a reference to grab clientID from ClientInformation203 event = connection->getEvent();204 if(!event)205 continue;206 assert(event->type != ENET_EVENT_TYPE_NONE);207 switch( event->type ) {208 case ENET_EVENT_TYPE_CONNECT:209 COUT(4) << "processing event_Type_connect" << std::endl;210 addClient(event);211 break;212 case ENET_EVENT_TYPE_DISCONNECT:213 if(ClientInformation::findClient(&event->peer->address))214 disconnectClient(event);215 break;216 case ENET_EVENT_TYPE_RECEIVE:217 if(!processPacket(event->packet, event->peer))218 COUT(3) << "processing incoming packet failed" << std::endl;219 break;220 default:221 break;222 }223 delete event;224 //if statement to catch case that packetbuffer is empty225 }226 171 } 227 172 … … 318 263 319 264 320 boolServer::addClient(ENetEvent *event){265 void Server::addClient(ENetEvent *event){ 321 266 static unsigned int newid=1; 322 267 … … 325 270 if(!temp){ 326 271 COUT(2) << "Server: could not add client" << std::endl; 327 return false; 328 } 329 /*if(temp==ClientInformation::getBegin()) { //not good if you use anything else than insertBack 330 newid=1; 331 } 332 else 333 newid=temp->prev()->getID()+1;*/ 272 } 334 273 temp->setID(newid); 335 274 temp->setPeer(event->peer); … … 342 281 } 343 282 344 newid++;283 ++newid; 345 284 346 285 COUT(3) << "Server: added client id: " << temp->getID() << std::endl; 347 returncreateClient(temp->getID());286 createClient(temp->getID()); 348 287 } 349 288 … … 357 296 358 297 // synchronise class ids 359 connection->syncClassid(temp->getID());298 syncClassid(temp->getID()); 360 299 361 300 // now synchronise functionIDs … … 382 321 return true; 383 322 } 384 385 bool Server::disconnectClient(ENetEvent *event){386 COUT(4) << "removing client from list" << std::endl;387 //return removeClient(head_->findClient(&(peer->address))->getID());388 389 //boost::recursive_mutex::scoped_lock lock(head_->mutex_);390 ClientInformation *client = ClientInformation::findClient(&event->peer->address);391 if(!client)392 return false;393 else394 disconnectClient( client );395 return true;396 }397 398 void Server::disconnectClient(int clientID){399 ClientInformation *client = ClientInformation::findClient(clientID);400 if(client)401 disconnectClient(client);402 }403 323 404 void Server::disconnectClient( ClientInformation *client ){405 connection->disconnectClient(client);324 void Server::disconnectClient( ClientInformation *client ){ 325 ServerConnection::disconnectClient( client ); 406 326 gamestates_->removeClient(client); 407 327 // inform all the listeners … … 439 359 } 440 360 361 void Server::syncClassid(unsigned int clientID) { 362 int failures=0; 363 packet::ClassID *classid = new packet::ClassID(); 364 classid->setClientID(clientID); 365 while(!classid->send() && failures < 10){ 366 failures++; 367 } 368 assert(failures<10); 369 COUT(4) << "syncClassid:\tall synchClassID packets have been sent" << std::endl; 370 } 371 441 372 } -
code/trunk/src/network/Server.h
r3084 r3214 32 32 #include "NetworkPrereqs.h" 33 33 34 #include <string> 35 34 #include "core/CorePrereqs.h" 36 35 #include "Host.h" 37 #include " GamestateManager.h"36 #include "ServerConnection.h" 38 37 39 38 namespace orxonox … … 44 43 * It implements all functions necessary for a Server 45 44 */ 46 class _NetworkExport Server : public Host {45 class _NetworkExport Server : public Host, public ServerConnection{ 47 46 public: 48 47 Server(); 49 48 Server(int port); 50 49 Server(int port, const std::string& bindAddress); 51 Server(int port, const char *bindAddress);52 50 ~Server(); 53 51 … … 60 58 double getPacketLoss(unsigned int clientID); 61 59 protected: 62 void processQueue();63 60 void updateGamestate(); 64 61 private: … … 67 64 unsigned int playerID(){return 0;} 68 65 69 booladdClient(ENetEvent *event);66 void addClient(ENetEvent *event); 70 67 bool createClient(int clientID); 71 bool disconnectClient(ENetEvent *event);72 void disconnectClient(int clientID);73 68 void disconnectClient( ClientInformation *client); 74 69 bool processPacket( ENetPacket *packet, ENetPeer *peer ); … … 78 73 virtual bool broadcast(const std::string& message); 79 74 bool sendChat(const std::string& message, unsigned int clientID); 75 void syncClassid(unsigned int clientID); 80 76 81 //void processChat( chat *data, int clientId);82 ConnectionManager *connection;83 77 GamestateManager *gamestates_; 84 78 -
code/trunk/src/network/TrafficControl.cc
r3198 r3214 29 29 #include "TrafficControl.h" 30 30 31 #include "synchronisable/Synchronisable.h" 31 #include <cassert> 32 #include <boost/bind.hpp> 33 32 34 #include "core/CoreIncludes.h" 33 35 #include "core/ConfigValueIncludes.h" 34 35 #include <cassert> 36 #include <boost/bind.hpp> 36 #include "synchronisable/Synchronisable.h" 37 37 38 38 namespace orxonox { -
code/trunk/src/network/TrafficControl.h
r3084 r3214 25 25 * ... 26 26 * 27 27 28 */ 28 #ifndef NETWORK_TRAFFICCONTROL_H29 #define NETWORK_TRAFFICCONTROL_H29 #ifndef _TrafficControl_H__ 30 #define _TrafficControl_H__ 30 31 31 32 #include "NetworkPrereqs.h" 32 33 33 #include <string>34 34 #include <list> 35 35 #include <map> 36 #include <utility>37 #include <algorithm>38 #include "core/OrxonoxClass.h"39 36 #include "network/ClientConnectionListener.h" 40 37 … … 143 140 } 144 141 145 #endif 146 142 #endif /* _TrafficControl_H__ */ -
code/trunk/src/network/packet/Acknowledgement.cc
r3198 r3214 27 27 */ 28 28 29 #include "Acknowledgement.h" 29 30 30 #include "Acknowledgement.h" 31 #include "network/Host.h" 31 #include "util/Debug.h" 32 32 #include "network/GamestateHandler.h" 33 #include "core/CoreIncludes.h"34 33 35 34 namespace orxonox { -
code/trunk/src/network/packet/Acknowledgement.h
r2662 r3214 26 26 * 27 27 */ 28 #ifndef NETWORKACKNOLEDGEMENT_H29 #define NETWORKACKNOLEDGEMENT_H30 28 31 #include "../NetworkPrereqs.h" 29 #ifndef _Acknowledgement_H__ 30 #define _Acknowledgement_H__ 31 32 #include "network/NetworkPrereqs.h" 32 33 #include "Packet.h" 33 34 35 namespace orxonox { 34 36 const unsigned int ACKID_NACK = 0; 35 36 namespace orxonox {37 37 namespace packet { 38 38 /** … … 56 56 } //namespace orxonox 57 57 58 #endif 58 #endif /* _Acknowledgement_H__ */ -
code/trunk/src/network/packet/Chat.cc
r2773 r3214 29 29 #include "Chat.h" 30 30 31 #include < enet/enet.h>32 #include < cassert>31 #include <cstring> 32 #include <string> 33 33 #include "network/Host.h" 34 34 … … 36 36 namespace packet { 37 37 38 #define PACKET_FLAGS_CHAT ENET_PACKET_FLAG_RELIABLE38 #define PACKET_FLAGS_CHAT PacketFlag::Reliable 39 39 #define _PACKETID 0 40 40 const int _PLAYERID = _PACKETID + sizeof(ENUM::Type); … … 42 42 #define _MESSAGE _MESSAGELENGTH + sizeof(uint32_t) 43 43 44 Chat::Chat( std::stringmessage, unsigned int playerID )44 Chat::Chat( const std::string& message, unsigned int playerID ) 45 45 : Packet() 46 46 { -
code/trunk/src/network/packet/Chat.h
r2171 r3214 1 /* 2 * ORXONOX - the hottest 3D action shooter ever to exist 3 * > www.orxonox.net < 4 * 5 * 6 * License notice: 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 2 11 * of the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 * 22 * Author: 23 * Oliver Scheuss <scheusso [at] ee.ethz.ch> 24 * Co-authors: 25 * ... 26 * 27 */ 1 28 2 #ifndef NETWORKCHAT_H3 #define NETWORKCHAT_H29 #ifndef _NETWORK_Chat_H__ 30 #define _NETWORK_Chat_H__ 4 31 5 #include "../NetworkPrereqs.h" 6 7 #include <string> 8 #include <cstring> 9 32 #include "network/NetworkPrereqs.h" 10 33 #include "Packet.h" 11 34 … … 18 41 { 19 42 public: 20 Chat( std::stringmessage, unsigned int playerID );43 Chat( const std::string& message, unsigned int playerID ); 21 44 Chat( uint8_t* data, unsigned int clientID ); 22 45 ~Chat(); … … 35 58 } //namespace orxonox 36 59 37 #endif 60 #endif /* _NETWORK_Chat_H__ */ -
code/trunk/src/network/packet/ClassID.cc
r3084 r3214 27 27 */ 28 28 29 #include "ClassID.h" 29 30 30 31 #include "ClassID.h" 32 #include <enet/enet.h> 33 #include "core/CoreIncludes.h" 34 #include "core/Factory.h" 31 #include <cassert> 32 #include <cstdlib> 35 33 #include <cstring> 36 #include <string>37 #include <cassert>38 34 #include <map> 39 35 #include <queue> 36 #include <string> 37 38 #include "core/CoreIncludes.h" 40 39 41 40 namespace orxonox { … … 43 42 44 43 45 #define PACKET_FLAGS_CLASSID ENET_PACKET_FLAG_RELIABLE44 #define PACKET_FLAGS_CLASSID PacketFlag::Reliable 46 45 #define _PACKETID 0 47 46 -
code/trunk/src/network/packet/ClassID.h
r2759 r3214 26 26 * 27 27 */ 28 #ifndef NETWORKCLASSID_H29 #define NETWORKCLASSID_H30 28 31 #include "../NetworkPrereqs.h" 29 #ifndef _NETWORK_ClassID_H__ 30 #define _NETWORK_ClassID_H__ 32 31 33 #include <string> 34 32 #include "network/NetworkPrereqs.h" 35 33 #include "Packet.h" 36 34 … … 58 56 } //namespace orxonox 59 57 60 #endif 58 #endif /* _NETWORK_ClassID_H__ */ -
code/trunk/src/network/packet/DeleteObjects.cc
r2773 r3214 29 29 30 30 #include "DeleteObjects.h" 31 #include <enet/enet.h> 31 32 #include <cassert> 33 #include "util/Debug.h" 32 34 #include "network/synchronisable/Synchronisable.h" 33 #include "core/CoreIncludes.h"34 #include <cassert>35 35 36 36 namespace orxonox { 37 37 namespace packet { 38 38 39 #define PACKET_FLAG_DELETE ENET_PACKET_FLAG_RELIABLE39 #define PACKET_FLAG_DELETE PacketFlag::Reliable 40 40 #define _PACKETID 0 41 41 #define _QUANTITY _PACKETID + sizeof(ENUM::Type) … … 90 90 Synchronisable::deleteObject( *(uint32_t*)(data_+_OBJECTIDS+i*sizeof(uint32_t)) ); 91 91 } 92 delete this; 92 93 return true; 93 94 } -
code/trunk/src/network/packet/DeleteObjects.h
r2171 r3214 26 26 * 27 27 */ 28 #ifndef NETWORKPACKETDELETEOBJECTS_H29 #define NETWORKPACKETDELETEOBJECTS_H28 #ifndef _DeleteObjects_H__ 29 #define _DeleteObjects_H__ 30 30 31 #include "../NetworkPrereqs.h" 32 31 #include "network/NetworkPrereqs.h" 33 32 #include "Packet.h" 34 35 33 36 34 namespace orxonox { … … 57 55 } //namespace orxonox 58 56 59 #endif 57 #endif /* _DeleteObjects_H__ */ -
code/trunk/src/network/packet/FunctionCalls.cc
r3084 r3214 29 29 #include "FunctionCalls.h" 30 30 31 #include <enet/enet.h>32 31 #include <cassert> 33 32 #include <cstring> 34 #include " network/Host.h"33 #include "util/MultiType.h" 35 34 #include "network/NetworkFunction.h" 36 #include "util/MultiType.h"37 35 38 36 namespace orxonox { 39 37 namespace packet { 40 38 41 #define PACKET_FLAGS_FUNCTIONCALLS ENET_PACKET_FLAG_RELIABLE39 #define PACKET_FLAGS_FUNCTIONCALLS PacketFlag::Reliable 42 40 #define _PACKETID 0 43 41 const unsigned int FUNCTIONCALLS_MEM_ALLOCATION = 1000; -
code/trunk/src/network/packet/FunctionCalls.h
r3084 r3214 1 /* 2 * ORXONOX - the hottest 3D action shooter ever to exist 3 * > www.orxonox.net < 4 * 5 * 6 * License notice: 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 2 11 * of the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 * 22 * Author: 23 * Oliver Scheuss <scheusso [at] ee.ethz.ch> 24 * Co-authors: 25 * ... 26 * 27 */ 1 28 2 #ifndef NETWORKFUNCTIONCALLS_H3 #define NETWORKFUNCTIONCALLS_H29 #ifndef _FunctionCalls_H__ 30 #define _FunctionCalls_H__ 4 31 5 #include " ../NetworkPrereqs.h"32 #include "network/NetworkPrereqs.h" 6 33 7 #include <string> 8 #include <cstring> 9 34 #include <cassert> 35 #include "util/UtilPrereqs.h" 10 36 #include "Packet.h" 11 #include <cassert>12 37 13 38 namespace orxonox { 14 15 class MultiType;16 39 17 40 namespace packet { … … 44 67 } //namespace orxonox 45 68 46 #endif 69 #endif /* _FunctionCalls_H__ */ -
code/trunk/src/network/packet/FunctionIDs.cc
r3084 r3214 27 27 */ 28 28 29 #include "FunctionIDs.h" 29 30 31 #include <cassert> 32 #include <cstring> 33 #include <queue> 34 #include <string> 30 35 31 #include "FunctionIDs.h" 36 #include "util/Debug.h" 37 #include "core/ObjectList.h" 32 38 #include "network/NetworkFunction.h" 33 #include <enet/enet.h>34 #include "core/CoreIncludes.h"35 #include <string>36 #include <cassert>37 #include <queue>38 39 39 40 namespace orxonox { … … 41 42 42 43 43 #define PACKET_FLAGS_FUNCTIONIDS ENET_PACKET_FLAG_RELIABLE44 #define PACKET_FLAGS_FUNCTIONIDS PacketFlag::Reliable 44 45 #define _PACKETID 0 45 46 -
code/trunk/src/network/packet/FunctionIDs.h
r3084 r3214 26 26 * 27 27 */ 28 #ifndef NETWORKFUNCTIONIDS_H29 #define NETWORKFUNCTIONIDS_H30 28 31 #include "../NetworkPrereqs.h" 29 #ifndef _FunctionIDs_H__ 30 #define _FunctionIDs_H__ 32 31 33 #include <string> 34 32 #include "network/NetworkPrereqs.h" 35 33 #include "Packet.h" 36 34 … … 58 56 } //namespace orxonox 59 57 60 #endif 58 #endif /* _FunctionIDs_H__ */ -
code/trunk/src/network/packet/Gamestate.cc
r3198 r3214 28 28 29 29 #include "Gamestate.h" 30 #include <enet/enet.h> 30 31 31 #include <zlib.h> 32 #include <cassert> 33 #include "../GamestateHandler.h" 34 #include "../synchronisable/Synchronisable.h" 35 #include "../TrafficControl.h" 32 33 #include "util/Debug.h" 36 34 #include "core/GameMode.h" 37 #include "core/CoreIncludes.h" 38 39 40 35 #include "core/ObjectList.h" 36 #include "network/synchronisable/Synchronisable.h" 37 #include "network/GamestateHandler.h" 41 38 42 39 namespace orxonox { … … 46 43 #define GAMESTATE_START(data) (data + GamestateHeader::getSize()) 47 44 48 #define PACKET_FLAG_GAMESTATE ENET_PACKET_FLAG_RELIABLE45 #define PACKET_FLAG_GAMESTATE PacketFlag::Reliable 49 46 50 47 -
code/trunk/src/network/packet/Gamestate.h
r3198 r3214 28 28 29 29 30 #ifndef NETWORK_PACKETGAMESTATE_H31 #define NETWORK_PACKETGAMESTATE_H30 #ifndef _Gamestate_H__ 31 #define _Gamestate_H__ 32 32 33 33 #include "network/NetworkPrereqs.h" 34 34 35 #include <cassert> 36 #include <cstring> 37 #include <list> 38 39 #include "util/CRC32.h" 40 #include "network/TrafficControl.h" 35 41 #include "Packet.h" 36 #include "network/TrafficControl.h"37 #include <string.h>38 #include <map>39 #include <vector>40 #include <cassert>41 #ifndef NDEBUG42 #include "util/CRC32.h"43 #endif44 42 45 43 namespace orxonox { … … 138 136 } 139 137 140 #endif 138 #endif /* _Gamestate_H__ */ -
code/trunk/src/network/packet/Packet.cc
r3097 r3214 31 31 32 32 #include <cassert> 33 #include <cstring> 33 34 #include <enet/enet.h> 34 #include <boost/bind.hpp> 35 #include <boost/thread/recursive_mutex.hpp> 36 37 #include "network/ConnectionManager.h" 38 #include "network/ClientInformation.h" 39 35 #include <boost/static_assert.hpp> 36 37 #include "util/Debug.h" 40 38 #include "Acknowledgement.h" 41 #include "DeleteObjects.h"42 39 #include "Chat.h" 43 40 #include "ClassID.h" 41 #include "DeleteObjects.h" 44 42 #include "FunctionCalls.h" 45 43 #include "FunctionIDs.h" … … 47 45 #include "Welcome.h" 48 46 #include "network/Host.h" 49 #include " core/CoreIncludes.h"47 #include "network/ClientInformation.h" 50 48 51 49 namespace orxonox{ … … 53 51 namespace packet{ 54 52 55 #define PACKET_FLAG_DEFAULT ENET_PACKET_FLAG_NO_ALLOCATE 53 // Make sure we assume the right values 54 BOOST_STATIC_ASSERT(static_cast<int>(PacketFlag::Reliable) == static_cast<int>(ENET_PACKET_FLAG_RELIABLE)); 55 BOOST_STATIC_ASSERT(static_cast<int>(PacketFlag::Unsequence) == static_cast<int>(ENET_PACKET_FLAG_UNSEQUENCED)); 56 BOOST_STATIC_ASSERT(static_cast<int>(PacketFlag::NoAllocate) == static_cast<int>(ENET_PACKET_FLAG_NO_ALLOCATE)); 57 58 #define PACKET_FLAG_DEFAULT PacketFlag::NoAllocate 56 59 #define _PACKETID 0 57 60 58 61 std::map<size_t, Packet *> Packet::packetMap_; 59 //! Static mutex for any packetMap_ access60 static boost::recursive_mutex packetMap_mutex_g;61 62 62 63 Packet::Packet(){ … … 108 109 } 109 110 else if (this->data_) { 110 // This destructor was probably called as a consequence toENet executing our callback.111 // This destructor was probably called as a consequence of ENet executing our callback. 111 112 // It simply serves us to be able to deallocate the packet content (data_) ourselves since 112 113 // we have created it in the first place. … … 142 143 // Assures we don't create a packet and destroy it right after in another thread 143 144 // without having a reference in the packetMap_ 144 boost::recursive_mutex::scoped_lock lock(packetMap_mutex_g);145 145 packetMap_[(size_t)(void*)enetPacket_] = this; 146 146 } … … 218 218 // Data was created by ENet 219 219 p->bDataENetAllocated_ = true; 220 p->enetPacket_ = packet; 220 221 221 222 return p; … … 228 229 */ 229 230 void Packet::deletePacket(ENetPacket *enetPacket){ 230 boost::recursive_mutex::scoped_lock lock(packetMap_mutex_g);231 231 // Get our Packet from a gloabal map with all Packets created in the send() method of Packet. 232 232 std::map<size_t, Packet*>::iterator it = packetMap_.find((size_t)enetPacket); … … 236 236 delete it->second; 237 237 packetMap_.erase(it); 238 COUT( 4) << "PacketMap size: " << packetMap_.size() << std::endl;238 COUT(6) << "PacketMap size: " << packetMap_.size() << std::endl; 239 239 } 240 240 -
code/trunk/src/network/packet/Packet.h
r3084 r3214 26 26 * 27 27 */ 28 #ifndef NETWORKPACKET_H29 #define NETWORKPACKET_H28 #ifndef _NETWORK_Packet_H__ 29 #define _NETWORK_Packet_H__ 30 30 31 31 #include "network/NetworkPrereqs.h" 32 33 32 #include <map> 34 33 … … 102 101 } //namespace orxonox 103 102 104 #endif 103 #endif /* _NETWORK_Packet_H__ */ -
code/trunk/src/network/packet/Welcome.cc
r2773 r3214 29 29 */ 30 30 31 #include "Welcome.h" 31 32 32 #include "Welcome.h"33 #include <enet/enet.h>34 33 #include <cassert> 34 #include "util/Debug.h" 35 35 #include "network/Host.h" 36 36 #include "network/synchronisable/Synchronisable.h" 37 #include "core/CoreIncludes.h"38 37 39 38 namespace orxonox { 40 39 namespace packet { 41 40 42 #define PACKET_FLAGS_CLASSID ENET_PACKET_FLAG_RELIABLE41 #define PACKET_FLAGS_CLASSID PacketFlag::Reliable 43 42 #define _PACKETID 0 44 43 #define _CLIENTID _PACKETID + sizeof(ENUM::Type) -
code/trunk/src/network/packet/Welcome.h
r2662 r3214 26 26 * 27 27 */ 28 #ifndef NETWORKWELCOME_H29 #define NETWORKWELCOME_H28 #ifndef _NETWORK_Welcome_H__ 29 #define _NETWORK_Welcome_H__ 30 30 31 #include "../NetworkPrereqs.h" 32 31 #include "network/NetworkPrereqs.h" 33 32 #include "Packet.h" 34 33 … … 56 55 } //namespace orxonox 57 56 58 #endif 57 #endif /* _NETWORK_Welcome_H__ */ -
code/trunk/src/network/synchronisable/NetworkCallback.h
r3068 r3214 28 28 29 29 30 #ifndef _N ETWORK_CALLBACK__31 #define _N ETWORK_CALLBACK__30 #ifndef _NetworkCallback_H__ 31 #define _NetworkCallback_H__ 32 32 33 33 #include "network/NetworkPrereqs.h" … … 61 61 62 62 63 #endif 63 #endif /* _NetworkCallback_H__ */ -
code/trunk/src/network/synchronisable/NetworkCallbackManager.cc
r3084 r3214 27 27 */ 28 28 29 30 29 #include "NetworkCallbackManager.h" 31 30 #include "NetworkCallback.h" -
code/trunk/src/network/synchronisable/NetworkCallbackManager.h
r2662 r3214 28 28 29 29 30 #ifndef _N ETWORK_CALLBACKMANAGER__31 #define _N ETWORK_CALLBACKMANAGER__30 #ifndef _NetworkCallbackManager_H__ 31 #define _NetworkCallbackManager_H__ 32 32 33 33 #include "network/NetworkPrereqs.h" 34 34 35 #include <set> 35 36 #include <queue> … … 52 53 53 54 54 #endif 55 #endif /* _NetworkCallbackManager_H__ */ -
code/trunk/src/network/synchronisable/Synchronisable.cc
r3198 r3214 31 31 #include "Synchronisable.h" 32 32 33 #include <cstring> 34 #include <string> 35 #include <iostream> 36 #include <cassert> 37 33 #include <cstdlib> 38 34 #include "core/CoreIncludes.h" 39 35 #include "core/BaseObject.h" 40 // #include "core/Identifier.h"41 42 36 #include "network/Host.h" 37 43 38 namespace orxonox 44 39 { -
code/trunk/src/network/synchronisable/Synchronisable.h
r3084 r3214 32 32 #include "network/NetworkPrereqs.h" 33 33 34 #include <list> 34 #include <cassert> 35 #include <cstring> 35 36 #include <vector> 36 37 #include <map> 37 38 #include <queue> 38 #include <cassert> 39 #include <string> 40 #include "util/Math.h" 39 41 40 #include "util/mbool.h" 42 41 #include "core/OrxonoxClass.h" 42 #include "SynchronisableVariable.h" 43 43 #include "NetworkCallback.h" 44 #include "SynchronisableVariable.h"45 44 46 45 /*#define REGISTERDATA(varname, ...) \ -
code/trunk/src/network/synchronisable/SynchronisableSpecialisations.cc
r3084 r3214 28 28 */ 29 29 30 #include "network/synchronisable/Synchronisable.h"31 30 #include <string> 31 #include "util/Math.h" 32 #include "Synchronisable.h" 33 #include "SynchronisableVariable.h" 32 34 33 35 // ================ template spezialisation -
code/trunk/src/network/synchronisable/SynchronisableVariable.cc
r3084 r3214 29 29 #include "SynchronisableVariable.h" 30 30 31 32 31 namespace orxonox{ 33 32 -
code/trunk/src/network/synchronisable/SynchronisableVariable.h
r3102 r3214 28 28 29 29 30 #ifndef _ NETWORK_SYNCHRONISABLEVARIABLE__31 #define _ NETWORK_SYNCHRONISABLEVARIABLE__30 #ifndef _SynchronisableVariable_H__ 31 #define _SynchronisableVariable_H__ 32 32 33 33 #include "network/NetworkPrereqs.h" 34 34 35 #include <string>36 35 #include <cassert> 36 #include <cstring> 37 37 #include "util/Serialise.h" 38 #include "core/Core.h"39 #include "core/CoreIncludes.h"40 38 #include "core/GameMode.h" 41 #include "network/synchronisable/NetworkCallback.h"42 39 #include "network/synchronisable/NetworkCallbackManager.h" 43 40 … … 253 250 254 251 255 #endif 252 #endif /* _SynchronisableVariable_H__ */ -
code/trunk/src/orxonox/OrxonoxPrecompiledHeaders.h
r3196 r3214 35 35 #include "OrxonoxPrereqs.h" 36 36 37 #include <cassert> 37 38 #include <deque> 38 39 #include <fstream> … … 84 85 #include "util/Math.h" 85 86 #include "util/OgreForwardRefs.h" 86 #include "util/OrxAssert.h"87 #include "util/String.h"88 87 #include "util/SubString.h" 89 88 -
code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc
r3196 r3214 59 59 PawnManager::touch(); 60 60 this->bAlive_ = true; 61 this->fire_ = 0x0;62 this->firehack_ = 0x0;63 61 this->bReload_ = false; 64 62 … … 122 120 registerVariable(this->health_, variableDirection::toclient); 123 121 registerVariable(this->initialHealth_, variableDirection::toclient); 124 registerVariable(this->fire_, variableDirection::toserver);125 122 registerVariable(this->bReload_, variableDirection::toserver); 126 123 } … … 130 127 SUPER(Pawn, tick, dt); 131 128 132 // if (this->weaponSystem_ && GameMode::isMaster())133 // {134 // for (unsigned int firemode = 0; firemode < WeaponSystem::MAX_FIRE_MODES; firemode++)135 // if (this->fire_ & WeaponSystem::getFiremodeMask(firemode))136 // this->weaponSystem_->fire(firemode);137 //138 // if (this->bReload_)139 // this->weaponSystem_->reload();140 // }141 //142 // this->fire_ = this->firehack_;143 // this->firehack_ = 0x0;144 129 this->bReload_ = false; 145 130 -
code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.h
r3196 r3214 137 137 138 138 WeaponSystem* weaponSystem_; 139 unsigned int fire_;140 unsigned int firehack_;141 139 bool bReload_; 142 140 -
code/trunk/src/util/Clipboard.cc
r3196 r3214 42 42 ///////////// 43 43 44 #ifndef WIN32_LEAN_AND_MEAN 45 # define WIN32_LEAN_AND_MEAN 46 #endif 44 47 #include <windows.h> 48 #undef min 49 #undef max 45 50 #include "Debug.h" 46 51 -
code/trunk/src/util/Math.h
r3196 r3214 47 47 #include <OgreColourValue.h> 48 48 49 // Certain headers might define min and max macros 50 #if defined(max) || defined(min) || defined(sgn) || defined(clamp) || defined(square) || defined(mod) 51 # error An inline math function was overridden by a macro 52 #endif 49 // Certain headers might define unwanted macros... 50 #undef max 51 #undef min 52 #undef sgn 53 #undef clamp 54 #undef sqrt 55 #undef square 56 #undef mod 57 #undef rnd 53 58 54 59 namespace orxonox -
code/trunk/src/util/Sleep.cc
r3196 r3214 37 37 38 38 #ifdef ORXONOX_PLATFORM_WINDOWS 39 #ifndef WIN32_LEAN_AND_MEAN 40 # define WIN32_LEAN_AND_MEAN 41 #endif 39 42 #include <windows.h> 43 #undef min 44 #undef max 40 45 41 46 namespace orxonox
Note: See TracChangeset
for help on using the changeset viewer.