Changeset 3202
- Timestamp:
- Jun 21, 2009, 12:27:19 AM (15 years ago)
- Location:
- code/branches/netp5/src
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/netp5/src/network/Client.cc
r3198 r3202 50 50 #include "FunctionCallManager.h" 51 51 52 // #include "packet/Acknowledgement.h"53 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 { 90 75 } 91 76 92 77 Client::~Client(){ 93 if (isConnected)78 if ( ClientConnection::isConnected() ) 94 79 closeConnection(); 95 80 } … … 101 86 bool Client::establishConnection(){ 102 87 Synchronisable::setClient(true); 103 isConnected=client_connection.createConnection(); 104 if(!isConnected) 105 COUT(1) << "could not create connection laber" << std::endl; 106 return isConnected; 88 return ClientConnection::establishConnection(); 107 89 } 108 90 … … 112 94 */ 113 95 bool Client::closeConnection(){ 114 isConnected=false; 115 return client_connection.closeConnection(); 96 return ClientConnection::closeConnection(); 116 97 } 117 98 118 99 bool Client::queuePacket(ENetPacket *packet, int clientID){ 119 return client_connection.addPacket(packet); 100 bool b = ClientConnection::addPacket(packet); 101 assert(b); 102 return b; 120 103 } 121 104 … … 143 126 //this steers our network frequency 144 127 timeSinceLastUpdate_+=time.getDeltaTime(); 145 if(timeSinceLastUpdate_>=NETWORK_PERIOD){ 128 if(timeSinceLastUpdate_>=NETWORK_PERIOD) 129 { 146 130 timeSinceLastUpdate_ -= static_cast<unsigned int>( timeSinceLastUpdate_ / NETWORK_PERIOD ) * NETWORK_PERIOD; 147 131 // COUT(3) << "."; 148 if(client_connection.isConnected() && isSynched_){ 132 if ( isConnected() && isSynched_ ) 133 { 149 134 COUT(4) << "popping partial gamestate: " << std::endl; 150 135 packet::Gamestate *gs = gamestate.getGamestate(); … … 159 144 } 160 145 } 146 sendPackets(); // flush the enet queue 161 147 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 } 148 Connection::processQueue(); 173 149 if(gamestate.processGamestates()) 174 150 { -
code/branches/netp5/src/network/Client.h
r3084 r3202 61 61 * 62 62 */ 63 class _NetworkExport Client : public Host {63 class _NetworkExport Client : public Host, public ClientConnection{ 64 64 public: 65 65 Client(); 66 66 Client(const std::string& address, int port); 67 Client(const char *address, int port);68 67 ~Client(); 69 68 … … 74 73 virtual bool chat(const std::string& message); 75 74 virtual bool broadcast(const std::string& message) { return false; } 76 //bool sendChat(packet::Chat *chat);77 75 78 76 void update(const Clock& time); … … 82 80 virtual bool isServer_(){return false;} 83 81 84 ClientConnection client_connection;85 82 GamestateClient gamestate; 86 bool isConnected;87 83 bool isSynched_; 88 84 -
code/branches/netp5/src/network/ClientConnection.cc
r3198 r3202 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 42 #include <enet/enet.h>43 31 #include <iostream> 44 32 #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 33 50 #include "util/Sleep.h"51 34 #include "util/Debug.h" 52 35 53 36 namespace orxonox 54 37 { 55 //static boost::thread_group network_threads; 38 const unsigned int NETWORK_CLIENT_WAIT_TIME = 1; 39 const unsigned int NETWORK_CLIENT_CONNECTION_TIMEOUT = 3000; //millisecs 40 const unsigned int NETWORK_CLIENT_MAX_CONNECTIONS = 5; 41 const unsigned int NETWORK_CLIENT_CHANNELS = 2; 56 42 57 static boost::recursive_mutex enet_mutex_g;58 43 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; 44 ClientConnection::ClientConnection(): 45 server_(NULL), 46 established_(false) 47 { 48 this->serverAddress_ = new ENetAddress(); 49 //set standard address and port 50 enet_address_set_host(this->serverAddress_, "127.0.0.1"); 51 serverAddress_->port = NETWORK_PORT; 82 52 } 83 53 84 54 ClientConnection::~ClientConnection(){ 85 if( established)55 if(this->established_) 86 56 closeConnection(); 87 delete serverAddress; // surely was created57 delete this->serverAddress_; // surely was created 88 58 } 89 59 90 ENetEvent *ClientConnection::getEvent(){ 91 if(!buffer.isEmpty()) 92 return buffer.pop(); 93 else 94 return NULL; 95 } 96 97 bool ClientConnection::queueEmpty() { 98 return buffer.isEmpty(); 99 } 100 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; 60 bool ClientConnection::establishConnection() 61 { 62 ENetEvent event; 63 64 this->host_ = enet_host_create(NULL, NETWORK_CLIENT_MAX_CONNECTIONS, 0, 0); 65 if ( this->host_ == NULL ) 66 { 67 COUT(2) << "ClientConnection: host_ == NULL" << std::endl; 68 // error handling 122 69 return false; 123 70 } 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; 71 this->server_ = enet_host_connect(this->host_, serverAddress_, NETWORK_CLIENT_CHANNELS); 72 if ( this->server_==NULL ) 144 73 { 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 74 COUT(2) << "ClientConnection: server == NULL" << std::endl; 244 75 // error handling … … 246 77 } 247 78 // 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; 79 for( unsigned int i=0; i<NETWORK_CLIENT_CONNECTION_TIMEOUT/NETWORK_CLIENT_WAIT_TIME; i++ ) 80 { 81 if( enet_host_service(this->host_, &event, NETWORK_CLIENT_WAIT_TIME)>=0 && event.type == ENET_EVENT_TYPE_CONNECT ) 82 { 83 this->established_=true; 251 84 return true; 252 85 } 253 86 } 254 COUT(2) << "ClientConnection: enet_host_service < 0 or event.type != ENET_EVENT_TYPE_CONNECT # EVENT:" << event.type << std::endl; 87 COUT(1) << "Could not connect to server" << endl; 88 } 89 90 bool ClientConnection::closeConnection() { 91 ENetEvent event; 92 93 if ( !this->established_ ) 94 return true; 95 this->established_ = false; 96 enet_peer_disconnect(this->server_, 0); 97 for( unsigned int i=0; i<NETWORK_CLIENT_CONNECTION_TIMEOUT/NETWORK_CLIENT_WAIT_TIME; i++) 98 { 99 if ( enet_host_service(this->host_, &event, NETWORK_CLIENT_WAIT_TIME) >= 0 ) 100 { 101 switch (event.type) 102 { 103 case ENET_EVENT_TYPE_NONE: 104 case ENET_EVENT_TYPE_CONNECT: 105 break; 106 case ENET_EVENT_TYPE_RECEIVE: 107 enet_packet_destroy(event.packet); 108 break; 109 case ENET_EVENT_TYPE_DISCONNECT: 110 COUT(4) << "received disconnect confirmation from server" << endl; 111 return true; 112 } 113 } 114 } 115 enet_peer_reset( this->server_ ); 255 116 return false; 256 117 } 257 118 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); 119 120 bool ClientConnection::addPacket(ENetPacket *packet) { 121 assert( this->server_ ); 122 assert( packet ); 123 return Connection::addPacket( packet, this->server_ ); 124 } 125 126 void ClientConnection::addClient(ENetEvent* event) 127 { 128 assert(0); 129 } 130 void ClientConnection::disconnectPeer(ENetEvent* event) 131 { 132 this->established_=false; 133 COUT(1) << "Received disconnect Packet from Server!" << endl; 134 // server closed the connection 263 135 } 264 136 -
code/branches/netp5/src/network/ClientConnection.h
r3084 r3202 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 32 #include <string> 33 43 34 #include "NetworkPrereqs.h" 44 45 #include <string> 46 #include "PacketBuffer.h" 47 48 namespace boost { class thread; } 35 #include "Connection.h" 49 36 50 37 namespace orxonox 51 38 { 52 39 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{ 40 class _NetworkExport ClientConnection: public Connection{ 61 41 public: 62 ClientConnection(int port, const std::string& address); 63 ClientConnection(int port, const char* address); 42 ClientConnection(); 64 43 ~ClientConnection(); 44 45 void setServerAddress( const std::string& serverAddress ){ enet_address_set_host (this->serverAddress_, serverAddress.c_str()); } 46 void setPort( unsigned int port ){ this->serverAddress_->port = port; } 47 65 48 ENetEvent *getEvent(); 66 49 // check wheter the packet queue is empty 67 50 bool queueEmpty(); 68 51 // create a new listener thread 69 bool createConnection();70 bool closeConnection();52 virtual bool establishConnection(); 53 virtual bool closeConnection(); 71 54 // add a packet to queue for the server 72 55 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(); } 56 inline bool isConnected(){ return this->established_; } 80 57 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(); 58 virtual void addClient(ENetEvent* event); 59 virtual void disconnectPeer(ENetEvent* event); 60 87 61 bool disconnectConnection(); 88 PacketBuffer buffer;89 62 // enet stuff 90 ENetHost *client; 91 ENetAddress *serverAddress; 92 // quit-variable (communication with threads) 93 bool quit_; 94 bool established; 63 ENetAddress *serverAddress_; 64 bool established_; 95 65 // clientlist 96 ENetPeer *server; 97 boost::thread *receiverThread_; 66 ENetPeer *server_; 98 67 }; 99 68 -
code/branches/netp5/src/network/Connection.cc
r3201 r3202 31 31 #include <iostream> 32 32 #include <cassert> 33 #include <OgreTimer.h> 33 34 34 35 #include "util/Debug.h" … … 48 49 assert(instance_==0); 49 50 Connection::instance_=this; 51 enet_initialize(); 52 atexit(enet_deinitialize); 50 53 } 51 54 … … 72 75 73 76 assert(this->host_); 77 Ogre::Timer timer; 74 78 75 if(enet_host_service( this->host_, &event, NETWORK_WAIT_TIMEOUT ) > 0 )79 while( timer.getMilliseconds()<NETWORK_MAX_QUEUE_PROCESS_TIME && enet_host_service( this->host_, &event, NETWORK_WAIT_TIMEOUT ) > 0 ) 76 80 { 77 81 switch(event.type){ … … 81 85 break; 82 86 case ENET_EVENT_TYPE_DISCONNECT: 83 disconnect Client( &event );87 disconnectPeer( &event ); 84 88 break; 85 89 case ENET_EVENT_TYPE_RECEIVE: -
code/branches/netp5/src/network/Connection.h
r3201 r3202 53 53 const int NETWORK_PORT = 55556; 54 54 const int NETWORK_MAX_CONNECTIONS = 50; 55 const int NETWORK_WAIT_TIMEOUT = 1;55 const int NETWORK_WAIT_TIMEOUT = 0; 56 56 const int NETWORK_DEFAULT_CHANNEL = 0; 57 58 // struct _NetworkExport ClientList{ 59 // ENetEvent *event; 60 // int ID; 61 // ClientList *next; 62 // }; 57 const int NETWORK_MAX_QUEUE_PROCESS_TIME = 5; 63 58 64 59 class _NetworkExport Connection{ … … 79 74 void processQueue(); 80 75 virtual void addClient(ENetEvent* event)=0; 81 virtual void disconnect Client(ENetEvent* event)=0;76 virtual void disconnectPeer(ENetEvent* event)=0; 82 77 virtual bool processPacket(ENetEvent* event){ packet::Packet *p = packet::Packet::createPacket(event->packet, event->peer); return p->process(); } 83 78 -
code/branches/netp5/src/network/Server.cc
r3201 r3202 144 144 */ 145 145 void Server::update(const Clock& time) { 146 ServerConnection::processQueue();146 Connection::processQueue(); 147 147 gamestates_->processGamestates(); 148 148 //this steers our network frequency 149 149 timeSinceLastUpdate_+=time.getDeltaTime(); 150 if(timeSinceLastUpdate_>=NETWORK_PERIOD){ 150 if(timeSinceLastUpdate_>=NETWORK_PERIOD) 151 { 151 152 timeSinceLastUpdate_ -= static_cast<unsigned int>( timeSinceLastUpdate_ / NETWORK_PERIOD ) * NETWORK_PERIOD; 152 153 updateGamestate(); 153 154 FunctionCallManager::sendCalls(); 154 155 } 156 sendPackets(); // flush the enet queue 155 157 } 156 158 -
code/branches/netp5/src/network/ServerConnection.cc
r3201 r3202 53 53 54 54 bool ServerConnection::openListener() { 55 enet_initialize();56 atexit(enet_deinitialize);57 55 this->host_ = enet_host_create(this->bindAddress_, NETWORK_MAX_CONNECTIONS, 0, 0); 58 56 if ( this->host_ == NULL ) … … 91 89 void ServerConnection::disconnectClient(ClientInformation *client) 92 90 { 93 disconnectPeer( client->getPeer() );91 Connection::disconnectPeer( client->getPeer() ); 94 92 delete client; 95 93 } 96 94 97 void ServerConnection::disconnect Client( ENetEvent* event )95 void ServerConnection::disconnectPeer( ENetEvent* event ) 98 96 { 99 97 COUT(4) << "removing client from list" << std::endl; … … 115 113 ClientInformation *temp = ClientInformation::getBegin(); 116 114 while(temp!=0){ 117 disconnectPeer( temp->getPeer());115 disconnectPeer( &event ); 118 116 temp = temp->next(); 119 117 } -
code/branches/netp5/src/network/ServerConnection.h
r3201 r3202 60 60 static bool addPacketAll(ENetPacket *packet); 61 61 virtual void disconnectClient(ClientInformation *client); 62 void disconnect Client( ENetEvent* event );62 void disconnectPeer( ENetEvent* event ); 63 63 void disconnectClient(int clientID); 64 64 protected: -
code/branches/netp5/src/network/packet/FunctionCalls.cc
r3084 r3202 66 66 67 67 bool FunctionCalls::process(){ 68 printf("process function calls\n"); 68 69 assert(isDataENetAllocated()); 69 70 uint8_t* temp = data_+sizeof(uint32_t); //skip packetid -
code/branches/netp5/src/network/packet/Packet.cc
r3097 r3202 32 32 #include <cassert> 33 33 #include <enet/enet.h> 34 #include <boost/bind.hpp> 35 #include <boost/thread/recursive_mutex.hpp> 36 37 #include "network/ConnectionManager.h" 34 38 35 #include "network/ClientInformation.h" 39 36 … … 58 55 std::map<size_t, Packet *> Packet::packetMap_; 59 56 //! Static mutex for any packetMap_ access 60 static boost::recursive_mutex packetMap_mutex_g;61 57 62 58 Packet::Packet(){ … … 142 138 // Assures we don't create a packet and destroy it right after in another thread 143 139 // without having a reference in the packetMap_ 144 boost::recursive_mutex::scoped_lock lock(packetMap_mutex_g);145 140 packetMap_[(size_t)(void*)enetPacket_] = this; 146 141 } … … 228 223 */ 229 224 void Packet::deletePacket(ENetPacket *enetPacket){ 230 boost::recursive_mutex::scoped_lock lock(packetMap_mutex_g);231 225 // Get our Packet from a gloabal map with all Packets created in the send() method of Packet. 232 226 std::map<size_t, Packet*>::iterator it = packetMap_.find((size_t)enetPacket); -
code/branches/netp5/src/orxonox/objects/worldentities/pawns/Pawn.cc
r3196 r3202 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/branches/netp5/src/orxonox/objects/worldentities/pawns/Pawn.h
r3196 r3202 137 137 138 138 WeaponSystem* weaponSystem_; 139 unsigned int fire_;140 unsigned int firehack_;141 139 bool bReload_; 142 140
Note: See TracChangeset
for help on using the changeset viewer.