[Orxonox-commit 677] r3209 - in branches/netp5/src/network: . packet synchronisable
rgrieder at orxonox.net
rgrieder at orxonox.net
Tue Jun 23 02:12:45 CEST 2009
Author: rgrieder
Date: 2009-06-23 02:12:44 +0200 (Tue, 23 Jun 2009)
New Revision: 3209
Modified:
branches/netp5/src/network/ChatListener.cc
branches/netp5/src/network/ChatListener.h
branches/netp5/src/network/Client.cc
branches/netp5/src/network/Client.h
branches/netp5/src/network/ClientConnection.cc
branches/netp5/src/network/ClientConnection.h
branches/netp5/src/network/ClientConnectionListener.cc
branches/netp5/src/network/ClientConnectionListener.h
branches/netp5/src/network/ClientInformation.cc
branches/netp5/src/network/Connection.cc
branches/netp5/src/network/Connection.h
branches/netp5/src/network/FunctionCallManager.h
branches/netp5/src/network/GamestateClient.cc
branches/netp5/src/network/GamestateClient.h
branches/netp5/src/network/GamestateHandler.cc
branches/netp5/src/network/GamestateHandler.h
branches/netp5/src/network/GamestateManager.cc
branches/netp5/src/network/GamestateManager.h
branches/netp5/src/network/Host.cc
branches/netp5/src/network/Host.h
branches/netp5/src/network/NetworkFunction.cc
branches/netp5/src/network/NetworkFunction.h
branches/netp5/src/network/NetworkPrereqs.h
branches/netp5/src/network/PacketBuffer.cc
branches/netp5/src/network/Server.cc
branches/netp5/src/network/Server.h
branches/netp5/src/network/ServerConnection.cc
branches/netp5/src/network/ServerConnection.h
branches/netp5/src/network/TrafficControl.cc
branches/netp5/src/network/TrafficControl.h
branches/netp5/src/network/packet/Acknowledgement.cc
branches/netp5/src/network/packet/Acknowledgement.h
branches/netp5/src/network/packet/Chat.cc
branches/netp5/src/network/packet/Chat.h
branches/netp5/src/network/packet/ClassID.cc
branches/netp5/src/network/packet/ClassID.h
branches/netp5/src/network/packet/DeleteObjects.cc
branches/netp5/src/network/packet/DeleteObjects.h
branches/netp5/src/network/packet/FunctionCalls.cc
branches/netp5/src/network/packet/FunctionCalls.h
branches/netp5/src/network/packet/FunctionIDs.cc
branches/netp5/src/network/packet/FunctionIDs.h
branches/netp5/src/network/packet/Gamestate.cc
branches/netp5/src/network/packet/Gamestate.h
branches/netp5/src/network/packet/Packet.cc
branches/netp5/src/network/packet/Packet.h
branches/netp5/src/network/packet/Welcome.cc
branches/netp5/src/network/packet/Welcome.h
branches/netp5/src/network/synchronisable/NetworkCallback.h
branches/netp5/src/network/synchronisable/NetworkCallbackManager.cc
branches/netp5/src/network/synchronisable/NetworkCallbackManager.h
branches/netp5/src/network/synchronisable/Synchronisable.cc
branches/netp5/src/network/synchronisable/Synchronisable.h
branches/netp5/src/network/synchronisable/SynchronisableSpecialisations.cc
branches/netp5/src/network/synchronisable/SynchronisableVariable.cc
branches/netp5/src/network/synchronisable/SynchronisableVariable.h
Log:
Cleanup in network plus a few dependency reductions (no enet-function inlines, using enum PacketFlag instead of the enet version)
Modified: branches/netp5/src/network/ChatListener.cc
===================================================================
--- branches/netp5/src/network/ChatListener.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/ChatListener.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -27,7 +27,6 @@
*/
#include "ChatListener.h"
-
#include "core/CoreIncludes.h"
namespace orxonox
Modified: branches/netp5/src/network/ChatListener.h
===================================================================
--- branches/netp5/src/network/ChatListener.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/ChatListener.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -30,8 +30,6 @@
#define _NETWORK_ChatListener__
#include "NetworkPrereqs.h"
-
-#include "ClientInformation.h"
#include "core/OrxonoxClass.h"
namespace orxonox
Modified: branches/netp5/src/network/Client.cc
===================================================================
--- branches/netp5/src/network/Client.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/Client.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -38,15 +38,15 @@
//
//
+#include "Client.h"
+
#include <cassert>
-#include <enet/enet.h>
-#include "Client.h"
-#include "Host.h"
+#include "util/Debug.h"
+#include "core/Clock.h"
#include "synchronisable/Synchronisable.h"
-#include "core/Clock.h"
-#include "core/CoreIncludes.h"
-#include "packet/Packet.h"
+#include "packet/Chat.h"
+#include "packet/Gamestate.h"
#include "FunctionCallManager.h"
namespace orxonox
Modified: branches/netp5/src/network/Client.h
===================================================================
--- branches/netp5/src/network/Client.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/Client.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -44,13 +44,10 @@
#include "NetworkPrereqs.h"
#include <string>
-
-#include "Host.h"
-#include "packet/Chat.h"
#include "ClientConnection.h"
#include "GamestateClient.h"
+#include "Host.h"
-
namespace orxonox
{
/**
Modified: branches/netp5/src/network/ClientConnection.cc
===================================================================
--- branches/netp5/src/network/ClientConnection.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/ClientConnection.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -28,9 +28,8 @@
#include "ClientConnection.h"
-#include <iostream>
#include <cassert>
-
+#include <enet/enet.h>
#include "util/Debug.h"
namespace orxonox
@@ -42,8 +41,8 @@
ClientConnection::ClientConnection():
- server_(NULL),
- established_(false)
+ established_(false),
+ server_(NULL)
{
this->serverAddress_ = new ENetAddress();
//set standard address and port
@@ -57,6 +56,14 @@
delete this->serverAddress_; // surely was created
}
+ void ClientConnection::setServerAddress( const std::string& serverAddress ) {
+ enet_address_set_host (this->serverAddress_, serverAddress.c_str());
+ }
+
+ void ClientConnection::setPort( unsigned int port ) {
+ this->serverAddress_->port = port;
+ }
+
bool ClientConnection::establishConnection()
{
ENetEvent event;
Modified: branches/netp5/src/network/ClientConnection.h
===================================================================
--- branches/netp5/src/network/ClientConnection.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/ClientConnection.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -29,8 +29,6 @@
#ifndef _ClientConnection_H__
#define _ClientConnection_H__
-#include <string>
-
#include "NetworkPrereqs.h"
#include "Connection.h"
@@ -40,10 +38,10 @@
class _NetworkExport ClientConnection: public Connection{
public:
ClientConnection();
- ~ClientConnection();
+ virtual ~ClientConnection();
- void setServerAddress( const std::string& serverAddress ){ enet_address_set_host (this->serverAddress_, serverAddress.c_str()); }
- void setPort( unsigned int port ){ this->serverAddress_->port = port; }
+ void setServerAddress( const std::string& serverAddress );
+ void setPort( unsigned int port );
ENetEvent *getEvent();
// check wheter the packet queue is empty
@@ -67,12 +65,6 @@
};
-
-
-
-
-
-
}
#endif /* _ClientConnection_H__ */
Modified: branches/netp5/src/network/ClientConnectionListener.cc
===================================================================
--- branches/netp5/src/network/ClientConnectionListener.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/ClientConnectionListener.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -27,8 +27,10 @@
*/
#include "ClientConnectionListener.h"
+
#include "core/CoreIncludes.h"
#include "core/GameMode.h"
+#include "ClientInformation.h"
namespace orxonox{
Modified: branches/netp5/src/network/ClientConnectionListener.h
===================================================================
--- branches/netp5/src/network/ClientConnectionListener.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/ClientConnectionListener.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -1,8 +1,35 @@
-#ifndef _NETWORK_CLIENTCONNECTIONLISTENER__
-#define _NETWORK_CLIENTCONNECTIONLISTENER__
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Oliver Scheuss <scheusso [at] ee.ethz.ch>, (C) 2008
+ * Co-authors:
+ * ...
+ *
+ */
+#ifndef _ClientConnectionListener_H__
+#define _ClientConnectionListener_H__
+
#include "NetworkPrereqs.h"
-#include "ClientInformation.h"
#include "core/OrxonoxClass.h"
namespace orxonox{
@@ -25,4 +52,4 @@
}
-#endif
+#endif /* _ClientConnectionListener_H__ */
Modified: branches/netp5/src/network/ClientInformation.cc
===================================================================
--- branches/netp5/src/network/ClientInformation.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/ClientInformation.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -39,9 +39,7 @@
//
#include "ClientInformation.h"
-
#include <enet/enet.h>
-#include <iostream> //debug
namespace orxonox
{
Modified: branches/netp5/src/network/Connection.cc
===================================================================
--- branches/netp5/src/network/Connection.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/Connection.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -28,17 +28,11 @@
#include "Connection.h"
-#include <iostream>
#include <cassert>
+#include <enet/enet.h>
#include <OgreTimer.h>
+#include "packet/Packet.h"
-#include "util/Debug.h"
-#include "util/Math.h"
-#include "util/Sleep.h"
-#include "ClientInformation.h"
-#include "synchronisable/Synchronisable.h"
-#include "packet/ClassID.h"
-
namespace orxonox
{
Connection *Connection::instance_=0;
@@ -56,6 +50,14 @@
Connection::instance_=0;
}
+ int Connection::service(ENetEvent* event) {
+ return enet_host_service( this->host_, event, NETWORK_WAIT_TIMEOUT );
+ }
+
+ void Connection::disconnectPeer(ENetPeer *peer) {
+ enet_peer_disconnect(peer, 0);
+ }
+
bool Connection::addPacket(ENetPacket *packet, ENetPeer *peer) {
if(enet_peer_send(peer, NETWORK_DEFAULT_CHANNEL, packet)!=0)
return false;
@@ -95,4 +97,9 @@
}
}
+ bool Connection::processPacket(ENetEvent* event) {
+ packet::Packet *p = packet::Packet::createPacket(event->packet, event->peer);
+ return p->process();
+ }
+
}
Modified: branches/netp5/src/network/Connection.h
===================================================================
--- branches/netp5/src/network/Connection.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/Connection.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -42,12 +42,6 @@
#include "NetworkPrereqs.h"
-#include <string>
-#include <map>
-#include <enet/enet.h>
-
-#include "packet/Packet.h"
-
namespace orxonox
{
const unsigned int NETWORK_PORT = 55556;
@@ -58,7 +52,7 @@
class _NetworkExport Connection{
public:
- ~Connection();
+ virtual ~Connection();
static bool addPacket(ENetPacket *packet, ENetPeer *peer);
bool sendPackets();
@@ -68,13 +62,13 @@
Connection();
static Connection* getInstance(){ return Connection::instance_; }
- int service(ENetEvent* event){ return enet_host_service( this->host_, event, NETWORK_WAIT_TIMEOUT ); }
- void disconnectPeer(ENetPeer *peer){ enet_peer_disconnect(peer, 0); }
+ int service(ENetEvent* event);
+ void disconnectPeer(ENetPeer *peer);
void processQueue();
virtual void addClient(ENetEvent* event)=0;
virtual void disconnectPeer(ENetEvent* event)=0;
- virtual bool processPacket(ENetEvent* event){ packet::Packet *p = packet::Packet::createPacket(event->packet, event->peer); return p->process(); }
+ virtual bool processPacket(ENetEvent* event);
ENetHost *host_;
private:
Modified: branches/netp5/src/network/FunctionCallManager.h
===================================================================
--- branches/netp5/src/network/FunctionCallManager.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/FunctionCallManager.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -1,19 +1,44 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Oliver Scheuss <scheusso [at] ee.ethz.ch>, (C) 2008
+ * Co-authors:
+ * ...
+ *
+ */
-#ifndef NETWORKFUNCTIONCALLMANAGER_H
-#define NETWORKFUNCTIONCALLMANAGER_H
+#ifndef _FunctionCallManager_H__
+#define _FunctionCallManager_H__
#include "NetworkPrereqs.h"
-#include "packet/FunctionCalls.h"
+
#include <map>
+#include "util/UtilPrereqs.h"
-
namespace orxonox {
/**
@author
*/
-class MultiType;
-
class _NetworkExport FunctionCallManager
{
public:
@@ -41,4 +66,4 @@
} //namespace orxonox
-#endif
+#endif /* _FunctionCallManager_H__ */
Modified: branches/netp5/src/network/GamestateClient.cc
===================================================================
--- branches/netp5/src/network/GamestateClient.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/GamestateClient.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -28,14 +28,12 @@
#include "GamestateClient.h"
-#include <cassert>
-#include <zlib.h>
-
-#include "core/CoreIncludes.h"
-#include "core/BaseObject.h"
+#include "util/Debug.h"
+#include "core/ObjectList.h"
#include "synchronisable/Synchronisable.h"
#include "synchronisable/NetworkCallbackManager.h"
#include "packet/Acknowledgement.h"
+#include "packet/Gamestate.h"
namespace orxonox
Modified: branches/netp5/src/network/GamestateClient.h
===================================================================
--- branches/netp5/src/network/GamestateClient.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/GamestateClient.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -40,11 +40,10 @@
#ifndef _GamestateClient_H__
#define _GamestateClient_H__
-#include <map>
-//
#include "NetworkPrereqs.h"
+
+#include <map>
#include "core/CorePrereqs.h"
-#include "packet/Gamestate.h"
#include "GamestateHandler.h"
const unsigned int GAMESTATEID_INITIAL = (unsigned int)-1;
Modified: branches/netp5/src/network/GamestateHandler.cc
===================================================================
--- branches/netp5/src/network/GamestateHandler.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/GamestateHandler.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -1,7 +1,33 @@
-#include <cassert>
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Oliver Scheuss <scheusso [at] ee.ethz.ch>, (C) 2008
+ * Co-authors:
+ * ...
+ *
+ */
#include "GamestateHandler.h"
-#include "packet/Packet.h"
+#include <cassert>
namespace orxonox {
Modified: branches/netp5/src/network/GamestateHandler.h
===================================================================
--- branches/netp5/src/network/GamestateHandler.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/GamestateHandler.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -25,13 +25,11 @@
* ...
*
*/
-#ifndef NETWORKGAMESTATEHANDLER_H
-#define NETWORKGAMESTATEHANDLER_H
-#include <string>
+#ifndef _GamestateHandler_H__
+#define _GamestateHandler_H__
#include "NetworkPrereqs.h"
-#include "packet/Chat.h"
namespace orxonox {
@@ -57,4 +55,4 @@
}
-#endif
+#endif /* _GamestateHandler_H__ */
Modified: branches/netp5/src/network/GamestateManager.cc
===================================================================
--- branches/netp5/src/network/GamestateManager.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/GamestateManager.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -40,17 +40,14 @@
#include "GamestateManager.h"
-#include <utility>
-#include <iostream>
-#include <zlib.h>
#include <cassert>
-#include "core/CoreIncludes.h"
-#include "core/BaseObject.h"
+#include "util/Debug.h"
#include "ClientInformation.h"
-#include "synchronisable/Synchronisable.h"
-#include "synchronisable/NetworkCallbackManager.h"
#include "packet/Acknowledgement.h"
+#include "packet/Gamestate.h"
+#include "synchronisable/NetworkCallbackManager.h"
+#include "TrafficControl.h"
namespace orxonox
{
Modified: branches/netp5/src/network/GamestateManager.h
===================================================================
--- branches/netp5/src/network/GamestateManager.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/GamestateManager.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -41,16 +41,14 @@
#define _GamestateManager_H__
#include "NetworkPrereqs.h"
-#include "GamestateHandler.h"
-#include "TrafficControl.h"
+
#include <map>
+#include "GamestateHandler.h"
-#include "packet/Gamestate.h"
-
namespace orxonox
{
- const int KEEP_GAMESTATES = 10;
+ const int KEEP_GAMESTATES = 10;
/**
* This Class implements a manager for gamestates:
Modified: branches/netp5/src/network/Host.cc
===================================================================
--- branches/netp5/src/network/Host.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/Host.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -26,11 +26,13 @@
*
*/
+#include "Host.h"
+
#include <cassert>
+#include <string>
-#include "Host.h"
#include "core/ConsoleCommand.h"
-#include "packet/Packet.h"
+#include "core/ObjectList.h"
#include "ChatListener.h"
namespace orxonox {
Modified: branches/netp5/src/network/Host.h
===================================================================
--- branches/netp5/src/network/Host.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/Host.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -25,13 +25,11 @@
* ...
*
*/
-#ifndef NETWORKHOST_H
-#define NETWORKHOST_H
-#include <string>
+#ifndef _NETWORK_Host_H__
+#define _NETWORK_Host_H__
#include "NetworkPrereqs.h"
-#include "packet/Chat.h"
namespace orxonox {
@@ -85,4 +83,4 @@
}
-#endif
+#endif /* _NETWORK_Host_H__ */
Modified: branches/netp5/src/network/NetworkFunction.cc
===================================================================
--- branches/netp5/src/network/NetworkFunction.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/NetworkFunction.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -27,8 +27,7 @@
*/
#include "NetworkFunction.h"
-#include <string>
-#include "synchronisable/Synchronisable.h"
+#include "core/CoreIncludes.h"
namespace orxonox
{
@@ -41,7 +40,7 @@
std::map<NetworkFunctionPointer, NetworkMemberFunctionBase*> NetworkMemberFunctionBase::functorMap_;
std::map<uint32_t, NetworkMemberFunctionBase*> NetworkMemberFunctionBase::idMap_;
- NetworkFunctionBase::NetworkFunctionBase(std::string name)
+ NetworkFunctionBase::NetworkFunctionBase(const std::string& name)
{
RegisterRootObject(NetworkFunctionBase);
@@ -57,7 +56,7 @@
- NetworkFunctionStatic::NetworkFunctionStatic(FunctorStatic* functor, std::string name, const NetworkFunctionPointer& p):
+ NetworkFunctionStatic::NetworkFunctionStatic(FunctorStatic* functor, const std::string& name, const NetworkFunctionPointer& p):
NetworkFunctionBase(name)
{
RegisterObject(NetworkFunctionStatic);
@@ -74,7 +73,7 @@
- NetworkMemberFunctionBase::NetworkMemberFunctionBase(std::string name, const NetworkFunctionPointer& p):
+ NetworkMemberFunctionBase::NetworkMemberFunctionBase(const std::string& name, const NetworkFunctionPointer& p):
NetworkFunctionBase(name)
{
RegisterObject(NetworkMemberFunctionBase);
Modified: branches/netp5/src/network/NetworkFunction.h
===================================================================
--- branches/netp5/src/network/NetworkFunction.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/NetworkFunction.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -26,23 +26,21 @@
*
*/
-#ifndef NETWORKFUNCTION_H
-#define NETWORKFUNCTION_H
+#ifndef _NetworkFunction_H__
+#define _NetworkFunction_H__
#include "NetworkPrereqs.h"
-#include "core/OrxonoxClass.h"
-#include <string>
-#include <map>
#include <cassert>
+#include <map>
+#include <string>
#include <boost/preprocessor/cat.hpp>
-#include "util/MultiType.h"
+
+#include "core/OrxonoxClass.h"
#include "core/Functor.h"
-#include "synchronisable/Synchronisable.h"
-#include "OrxonoxConfig.h"
#include "FunctionCallManager.h"
+#include "synchronisable/Synchronisable.h"
-
namespace orxonox
{
@@ -71,15 +69,15 @@
class _NetworkExport NetworkFunctionBase: virtual public OrxonoxClass {
public:
- NetworkFunctionBase(std::string name);
+ NetworkFunctionBase(const std::string& name);
~NetworkFunctionBase();
virtual void setNetworkID(uint32_t id) { this->networkID_ = id; }
inline uint32_t getNetworkID() const { return this->networkID_; }
- inline std::string getName() const { return name_; }
+ inline const std::string& getName() const { return name_; }
static inline bool isStatic( uint32_t networkID ) { return isStaticMap_[networkID]; }
- static inline void setNetworkID(std::string name, uint32_t id){ assert( nameMap_.find(name)!=nameMap_.end() ); nameMap_[name]->setNetworkID(id); }
+ static inline void setNetworkID(const std::string& name, uint32_t id){ assert( nameMap_.find(name)!=nameMap_.end() ); nameMap_[name]->setNetworkID(id); }
protected:
static std::map<uint32_t, bool> isStaticMap_;
@@ -94,7 +92,7 @@
class _NetworkExport NetworkFunctionStatic: public NetworkFunctionBase {
public:
- NetworkFunctionStatic(FunctorStatic* functor, std::string name, const NetworkFunctionPointer& p);
+ NetworkFunctionStatic(FunctorStatic* functor, const std::string& name, const NetworkFunctionPointer& p);
~NetworkFunctionStatic();
inline void call(){ (*this->functor_)(); }
@@ -120,7 +118,7 @@
class _NetworkExport NetworkMemberFunctionBase: public NetworkFunctionBase {
public:
- NetworkMemberFunctionBase(std::string name, const NetworkFunctionPointer& p);
+ NetworkMemberFunctionBase(const std::string& name, const NetworkFunctionPointer& p);
~NetworkMemberFunctionBase();
virtual void setNetworkID( uint32_t id ){ NetworkFunctionBase::setNetworkID( id ); idMap_[id] = this; }
@@ -144,7 +142,7 @@
template <class T> class NetworkMemberFunction: public NetworkMemberFunctionBase {
public:
- NetworkMemberFunction(FunctorMember<T>* functor, std::string name, const NetworkFunctionPointer& p);
+ NetworkMemberFunction(FunctorMember<T>* functor, const std::string& name, const NetworkFunctionPointer& p);
~NetworkMemberFunction();
inline void call(uint32_t objectID)
@@ -182,7 +180,7 @@
FunctorMember<T>* functor_;
};
-template <class T> NetworkMemberFunction<T>::NetworkMemberFunction(FunctorMember<T>* functor, std::string name, const NetworkFunctionPointer& p):
+template <class T> NetworkMemberFunction<T>::NetworkMemberFunction(FunctorMember<T>* functor, const std::string& name, const NetworkFunctionPointer& p):
NetworkMemberFunctionBase(name, p), functor_(functor)
{
}
@@ -200,7 +198,7 @@
// *((uint32_t*)destptr+i) = p2>>32*i;
}
-template<class T> inline void* registerStaticNetworkFunctionFct( T ptr, std::string name )
+template<class T> inline void* registerStaticNetworkFunctionFct( T ptr, const std::string& name )
{
NetworkFunctionPointer destptr;
copyPtr( ptr, destptr );
@@ -208,7 +206,7 @@
return 0;
}
-template<class T, class PT> inline void* registerMemberNetworkFunctionFct( PT ptr, std::string name )
+template<class T, class PT> inline void* registerMemberNetworkFunctionFct( PT ptr, const std::string& name )
{
NetworkFunctionPointer destptr;
copyPtr( ptr, destptr );
@@ -238,4 +236,4 @@
}
-#endif
+#endif /* _NetworkFunction_H__ */
Modified: branches/netp5/src/network/NetworkPrereqs.h
===================================================================
--- branches/netp5/src/network/NetworkPrereqs.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/NetworkPrereqs.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -113,6 +113,7 @@
struct PacketEnvelope;
struct QueueItem;
struct syncData;
+ class TrafficControl;
class obj;
class objInfo;
@@ -128,6 +129,16 @@
class Packet;
class Welcome;
}
+
+ namespace PacketFlag
+ {
+ enum Enum
+ {
+ Reliable = 1,
+ Unsequence = 2,
+ NoAllocate = 4
+ };
+ }
}
#endif /* _NetworkPrereqs_H__ */
Modified: branches/netp5/src/network/PacketBuffer.cc
===================================================================
--- branches/netp5/src/network/PacketBuffer.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/PacketBuffer.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -32,12 +32,7 @@
#include "PacketBuffer.h"
-#include <enet/enet.h>
-#include <iostream>
-#include <queue>
-#include <string>
-#include <boost/bind.hpp>
-#include <boost/thread/mutex.hpp>
+//#include <iostream>
#include <boost/thread/recursive_mutex.hpp>
namespace orxonox
Modified: branches/netp5/src/network/Server.cc
===================================================================
--- branches/netp5/src/network/Server.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/Server.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -41,29 +41,23 @@
#include "Server.h"
#include <enet/enet.h>
-#include <iostream>
#include <cassert>
+#include <string>
-
-// #include "ConnectionManager.h"
-#include "ClientConnectionListener.h"
-#include "GamestateManager.h"
-#include "ClientInformation.h"
-#include "util/Sleep.h"
+#include "util/Debug.h"
#include "core/Clock.h"
-#include "core/ConsoleCommand.h"
-#include "core/CoreIncludes.h"
+#include "core/ObjectList.h"
#include "packet/Chat.h"
-#include "packet/Packet.h"
-#include "packet/Welcome.h"
-#include "packet/DeleteObjects.h"
#include "packet/ClassID.h"
-#include "util/Convert.h"
+#include "packet/DeleteObjects.h"
+#include "packet/FunctionIDs.h"
+#include "packet/Gamestate.h"
+#include "packet/Welcome.h"
#include "ChatListener.h"
+#include "ClientInformation.h"
#include "FunctionCallManager.h"
-#include "packet/FunctionIDs.h"
+#include "GamestateManager.h"
-
namespace orxonox
{
const unsigned int MAX_FAILURES = 20;
Modified: branches/netp5/src/network/Server.h
===================================================================
--- branches/netp5/src/network/Server.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/Server.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -31,11 +31,9 @@
#include "NetworkPrereqs.h"
-#include <string>
-
+#include "core/CorePrereqs.h"
#include "Host.h"
#include "ServerConnection.h"
-#include "GamestateManager.h"
namespace orxonox
{
Modified: branches/netp5/src/network/ServerConnection.cc
===================================================================
--- branches/netp5/src/network/ServerConnection.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/ServerConnection.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -29,11 +29,12 @@
#include "ServerConnection.h"
#include <cassert>
+#include <string>
+#include <enet/enet.h>
+#include "util/Debug.h"
#include "ClientInformation.h"
-#include "core/CoreIncludes.h"
-
namespace orxonox
{
@@ -51,6 +52,14 @@
delete this->bindAddress_;
}
+ void ServerConnection::setBindAddress( const std::string& bindAddress ) {
+ enet_address_set_host (this->bindAddress_, bindAddress.c_str());
+ }
+
+ void ServerConnection::setPort( unsigned int port ) {
+ this->bindAddress_->port = port;
+ }
+
bool ServerConnection::openListener() {
this->host_ = enet_host_create(this->bindAddress_, NETWORK_MAX_CONNECTIONS, 0, 0);
if ( this->host_ == NULL )
Modified: branches/netp5/src/network/ServerConnection.h
===================================================================
--- branches/netp5/src/network/ServerConnection.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/ServerConnection.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -41,7 +41,6 @@
#define _ServerConnection_H__
#include "NetworkPrereqs.h"
-
#include "Connection.h"
namespace orxonox
@@ -51,8 +50,8 @@
public:
~ServerConnection();
- void setBindAddress( const std::string& bindAddress ){ enet_address_set_host (this->bindAddress_, bindAddress.c_str()); }
- void setPort( unsigned int port ){ this->bindAddress_->port = port; }
+ void setBindAddress( const std::string& bindAddress );
+ void setPort( unsigned int port );
bool openListener();
bool closeListener();
Modified: branches/netp5/src/network/TrafficControl.cc
===================================================================
--- branches/netp5/src/network/TrafficControl.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/TrafficControl.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -28,13 +28,13 @@
#include "TrafficControl.h"
-#include "synchronisable/Synchronisable.h"
+#include <cassert>
+#include <boost/bind.hpp>
+
#include "core/CoreIncludes.h"
#include "core/ConfigValueIncludes.h"
+#include "synchronisable/Synchronisable.h"
-#include <cassert>
-#include <boost/bind.hpp>
-
namespace orxonox {
static const unsigned int SCHED_PRIORITY_OFFSET = (unsigned int)-1;
Modified: branches/netp5/src/network/TrafficControl.h
===================================================================
--- branches/netp5/src/network/TrafficControl.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/TrafficControl.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -24,18 +24,15 @@
* Co-authors:
* ...
*
+
*/
-#ifndef NETWORK_TRAFFICCONTROL_H
-#define NETWORK_TRAFFICCONTROL_H
+#ifndef _TrafficControl_H__
+#define _TrafficControl_H__
#include "NetworkPrereqs.h"
-#include <string>
#include <list>
#include <map>
-#include <utility>
-#include <algorithm>
-#include "core/OrxonoxClass.h"
#include "network/ClientConnectionListener.h"
namespace orxonox {
@@ -142,5 +139,4 @@
}
-#endif
-
+#endif /* _TrafficControl_H__ */
Modified: branches/netp5/src/network/packet/Acknowledgement.cc
===================================================================
--- branches/netp5/src/network/packet/Acknowledgement.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/packet/Acknowledgement.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -26,11 +26,10 @@
*
*/
-
#include "Acknowledgement.h"
-#include "network/Host.h"
+
+#include "util/Debug.h"
#include "network/GamestateHandler.h"
-#include "core/CoreIncludes.h"
namespace orxonox {
namespace packet {
Modified: branches/netp5/src/network/packet/Acknowledgement.h
===================================================================
--- branches/netp5/src/network/packet/Acknowledgement.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/packet/Acknowledgement.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -25,15 +25,15 @@
* ...
*
*/
-#ifndef NETWORKACKNOLEDGEMENT_H
-#define NETWORKACKNOLEDGEMENT_H
-#include "../NetworkPrereqs.h"
+#ifndef _Acknowledgement_H__
+#define _Acknowledgement_H__
+
+#include "network/NetworkPrereqs.h"
#include "Packet.h"
+namespace orxonox {
const unsigned int ACKID_NACK = 0;
-
-namespace orxonox {
namespace packet {
/**
@author
@@ -55,4 +55,4 @@
} //namespace packet
} //namespace orxonox
-#endif
+#endif /* _Acknowledgement_H__ */
Modified: branches/netp5/src/network/packet/Chat.cc
===================================================================
--- branches/netp5/src/network/packet/Chat.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/packet/Chat.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -28,20 +28,19 @@
#include "Chat.h"
-#include <enet/enet.h>
-#include <cassert>
+#include <string>
#include "network/Host.h"
namespace orxonox {
namespace packet {
-#define PACKET_FLAGS_CHAT ENET_PACKET_FLAG_RELIABLE
+#define PACKET_FLAGS_CHAT PacketFlag::Reliable
#define _PACKETID 0
const int _PLAYERID = _PACKETID + sizeof(ENUM::Type);
#define _MESSAGELENGTH _PLAYERID + sizeof(uint32_t)
#define _MESSAGE _MESSAGELENGTH + sizeof(uint32_t)
-Chat::Chat( std::string message, unsigned int playerID )
+Chat::Chat( const std::string& message, unsigned int playerID )
: Packet()
{
flags_ = flags_ | PACKET_FLAGS_CHAT;
Modified: branches/netp5/src/network/packet/Chat.h
===================================================================
--- branches/netp5/src/network/packet/Chat.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/packet/Chat.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -1,12 +1,35 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Oliver Scheuss <scheusso [at] ee.ethz.ch>
+ * Co-authors:
+ * ...
+ *
+ */
-#ifndef NETWORKCHAT_H
-#define NETWORKCHAT_H
+#ifndef _NETWORK_Chat_H__
+#define _NETWORK_Chat_H__
-#include "../NetworkPrereqs.h"
-
-#include <string>
-#include <cstring>
-
+#include "network/NetworkPrereqs.h"
#include "Packet.h"
namespace orxonox {
@@ -17,7 +40,7 @@
class _NetworkExport Chat : public Packet
{
public:
- Chat( std::string message, unsigned int playerID );
+ Chat( const std::string& message, unsigned int playerID );
Chat( uint8_t* data, unsigned int clientID );
~Chat();
@@ -34,4 +57,4 @@
} //namespace packet
} //namespace orxonox
-#endif
+#endif /* _NETWORK_Chat_H__ */
Modified: branches/netp5/src/network/packet/ClassID.cc
===================================================================
--- branches/netp5/src/network/packet/ClassID.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/packet/ClassID.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -26,23 +26,20 @@
*
*/
-
-
#include "ClassID.h"
-#include <enet/enet.h>
-#include "core/CoreIncludes.h"
-#include "core/Factory.h"
-#include <cstring>
-#include <string>
+
#include <cassert>
#include <map>
#include <queue>
+#include <string>
+#include "core/CoreIncludes.h"
+
namespace orxonox {
namespace packet {
-#define PACKET_FLAGS_CLASSID ENET_PACKET_FLAG_RELIABLE
+#define PACKET_FLAGS_CLASSID PacketFlag::Reliable
#define _PACKETID 0
Modified: branches/netp5/src/network/packet/ClassID.h
===================================================================
--- branches/netp5/src/network/packet/ClassID.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/packet/ClassID.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -25,13 +25,11 @@
* ...
*
*/
-#ifndef NETWORKCLASSID_H
-#define NETWORKCLASSID_H
-#include "../NetworkPrereqs.h"
+#ifndef _NETWORK_ClassID_H__
+#define _NETWORK_ClassID_H__
-#include <string>
-
+#include "network/NetworkPrereqs.h"
#include "Packet.h"
namespace orxonox {
@@ -57,4 +55,4 @@
} //namespace packet
} //namespace orxonox
-#endif
+#endif /* _NETWORK_ClassID_H__ */
Modified: branches/netp5/src/network/packet/DeleteObjects.cc
===================================================================
--- branches/netp5/src/network/packet/DeleteObjects.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/packet/DeleteObjects.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -28,15 +28,15 @@
#include "DeleteObjects.h"
-#include <enet/enet.h>
+
+#include <cassert>
+#include "util/Debug.h"
#include "network/synchronisable/Synchronisable.h"
-#include "core/CoreIncludes.h"
-#include <cassert>
namespace orxonox {
namespace packet {
-#define PACKET_FLAG_DELETE ENET_PACKET_FLAG_RELIABLE
+#define PACKET_FLAG_DELETE PacketFlag::Reliable
#define _PACKETID 0
#define _QUANTITY _PACKETID + sizeof(ENUM::Type)
#define _OBJECTIDS _QUANTITY + sizeof(uint32_t)
Modified: branches/netp5/src/network/packet/DeleteObjects.h
===================================================================
--- branches/netp5/src/network/packet/DeleteObjects.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/packet/DeleteObjects.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -25,14 +25,12 @@
* ...
*
*/
-#ifndef NETWORKPACKETDELETEOBJECTS_H
-#define NETWORKPACKETDELETEOBJECTS_H
+#ifndef _DeleteObjects_H__
+#define _DeleteObjects_H__
-#include "../NetworkPrereqs.h"
-
+#include "network/NetworkPrereqs.h"
#include "Packet.h"
-
namespace orxonox {
namespace packet {
/**
@@ -56,4 +54,4 @@
} //namespace packet
} //namespace orxonox
-#endif
+#endif /* _DeleteObjects_H__ */
Modified: branches/netp5/src/network/packet/FunctionCalls.cc
===================================================================
--- branches/netp5/src/network/packet/FunctionCalls.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/packet/FunctionCalls.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -28,17 +28,14 @@
#include "FunctionCalls.h"
-#include <enet/enet.h>
#include <cassert>
-#include <cstring>
-#include "network/Host.h"
-#include "network/NetworkFunction.h"
#include "util/MultiType.h"
+#include "network/NetworkFunction.h"
namespace orxonox {
namespace packet {
-#define PACKET_FLAGS_FUNCTIONCALLS ENET_PACKET_FLAG_RELIABLE
+#define PACKET_FLAGS_FUNCTIONCALLS PacketFlag::Reliable
#define _PACKETID 0
const unsigned int FUNCTIONCALLS_MEM_ALLOCATION = 1000;
Modified: branches/netp5/src/network/packet/FunctionCalls.h
===================================================================
--- branches/netp5/src/network/packet/FunctionCalls.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/packet/FunctionCalls.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -1,19 +1,42 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Oliver Scheuss <scheusso [at] ee.ethz.ch>
+ * Co-authors:
+ * ...
+ *
+ */
-#ifndef NETWORKFUNCTIONCALLS_H
-#define NETWORKFUNCTIONCALLS_H
+#ifndef _FunctionCalls_H__
+#define _FunctionCalls_H__
-#include "../NetworkPrereqs.h"
+#include "network/NetworkPrereqs.h"
-#include <string>
-#include <cstring>
-
+#include <cassert>
+#include "util/UtilPrereqs.h"
#include "Packet.h"
-#include <cassert>
namespace orxonox {
-class MultiType;
-
namespace packet {
/**
@author
@@ -43,4 +66,4 @@
} //namespace packet
} //namespace orxonox
-#endif
+#endif /* _FunctionCalls_H__ */
Modified: branches/netp5/src/network/packet/FunctionIDs.cc
===================================================================
--- branches/netp5/src/network/packet/FunctionIDs.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/packet/FunctionIDs.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -26,21 +26,21 @@
*
*/
+#include "FunctionIDs.h"
-
-#include "FunctionIDs.h"
-#include "network/NetworkFunction.h"
-#include <enet/enet.h>
-#include "core/CoreIncludes.h"
-#include <string>
#include <cassert>
#include <queue>
+#include <string>
+#include "util/Debug.h"
+#include "core/ObjectList.h"
+#include "network/NetworkFunction.h"
+
namespace orxonox {
namespace packet {
-#define PACKET_FLAGS_FUNCTIONIDS ENET_PACKET_FLAG_RELIABLE
+#define PACKET_FLAGS_FUNCTIONIDS PacketFlag::Reliable
#define _PACKETID 0
Modified: branches/netp5/src/network/packet/FunctionIDs.h
===================================================================
--- branches/netp5/src/network/packet/FunctionIDs.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/packet/FunctionIDs.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -25,13 +25,11 @@
* ...
*
*/
-#ifndef NETWORKFUNCTIONIDS_H
-#define NETWORKFUNCTIONIDS_H
-#include "../NetworkPrereqs.h"
+#ifndef _FunctionIDs_H__
+#define _FunctionIDs_H__
-#include <string>
-
+#include "network/NetworkPrereqs.h"
#include "Packet.h"
namespace orxonox {
@@ -57,4 +55,4 @@
} //namespace packet
} //namespace orxonox
-#endif
+#endif /* _FunctionIDs_H__ */
Modified: branches/netp5/src/network/packet/Gamestate.cc
===================================================================
--- branches/netp5/src/network/packet/Gamestate.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/packet/Gamestate.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -27,25 +27,22 @@
*/
#include "Gamestate.h"
-#include <enet/enet.h>
+
#include <zlib.h>
-#include <cassert>
-#include "../GamestateHandler.h"
-#include "../synchronisable/Synchronisable.h"
-#include "../TrafficControl.h"
+
+#include "util/Debug.h"
#include "core/GameMode.h"
-#include "core/CoreIncludes.h"
+#include "core/ObjectList.h"
+#include "network/synchronisable/Synchronisable.h"
+#include "network/GamestateHandler.h"
-
-
-
namespace orxonox {
namespace packet {
#define GAMESTATE_START(data) (data + GamestateHeader::getSize())
-#define PACKET_FLAG_GAMESTATE ENET_PACKET_FLAG_RELIABLE
+#define PACKET_FLAG_GAMESTATE PacketFlag::Reliable
Gamestate::Gamestate()
Modified: branches/netp5/src/network/packet/Gamestate.h
===================================================================
--- branches/netp5/src/network/packet/Gamestate.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/packet/Gamestate.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -27,20 +27,17 @@
*/
-#ifndef NETWORK_PACKETGAMESTATE_H
-#define NETWORK_PACKETGAMESTATE_H
+#ifndef _Gamestate_H__
+#define _Gamestate_H__
#include "network/NetworkPrereqs.h"
-#include "Packet.h"
-#include "network/TrafficControl.h"
-#include <string.h>
-#include <map>
-#include <vector>
#include <cassert>
-#ifndef NDEBUG
+#include <list>
+
#include "util/CRC32.h"
-#endif
+#include "network/TrafficControl.h"
+#include "Packet.h"
namespace orxonox {
@@ -137,4 +134,4 @@
}
-#endif
+#endif /* _Gamestate_H__ */
Modified: branches/netp5/src/network/packet/Packet.cc
===================================================================
--- branches/netp5/src/network/packet/Packet.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/packet/Packet.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -31,25 +31,30 @@
#include <cassert>
#include <enet/enet.h>
+#include <boost/static_assert.hpp>
-#include "network/ClientInformation.h"
-
+#include "util/Debug.h"
#include "Acknowledgement.h"
-#include "DeleteObjects.h"
#include "Chat.h"
#include "ClassID.h"
+#include "DeleteObjects.h"
#include "FunctionCalls.h"
#include "FunctionIDs.h"
#include "Gamestate.h"
#include "Welcome.h"
#include "network/Host.h"
-#include "core/CoreIncludes.h"
+#include "network/ClientInformation.h"
namespace orxonox{
namespace packet{
-#define PACKET_FLAG_DEFAULT ENET_PACKET_FLAG_NO_ALLOCATE
+// Make sure we assume the right values
+BOOST_STATIC_ASSERT(static_cast<int>(PacketFlag::Reliable) == static_cast<int>(ENET_PACKET_FLAG_RELIABLE));
+BOOST_STATIC_ASSERT(static_cast<int>(PacketFlag::Unsequence) == static_cast<int>(ENET_PACKET_FLAG_UNSEQUENCED));
+BOOST_STATIC_ASSERT(static_cast<int>(PacketFlag::NoAllocate) == static_cast<int>(ENET_PACKET_FLAG_NO_ALLOCATE));
+
+#define PACKET_FLAG_DEFAULT PacketFlag::NoAllocate
#define _PACKETID 0
std::map<size_t, Packet *> Packet::packetMap_;
@@ -102,7 +107,7 @@
// In this case ENet allocated data_ and will destroy it.
}
else if (this->data_) {
- // This destructor was probably called as a consequence to ENet executing our callback.
+ // This destructor was probably called as a consequence of ENet executing our callback.
// It simply serves us to be able to deallocate the packet content (data_) ourselves since
// we have created it in the first place.
delete[] this->data_;
Modified: branches/netp5/src/network/packet/Packet.h
===================================================================
--- branches/netp5/src/network/packet/Packet.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/packet/Packet.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -25,11 +25,10 @@
* ...
*
*/
-#ifndef NETWORKPACKET_H
-#define NETWORKPACKET_H
+#ifndef _NETWORK_Packet_H__
+#define _NETWORK_Packet_H__
#include "network/NetworkPrereqs.h"
-
#include <map>
namespace orxonox {
@@ -101,4 +100,4 @@
} //namespace orxonox
-#endif
+#endif /* _NETWORK_Packet_H__ */
Modified: branches/netp5/src/network/packet/Welcome.cc
===================================================================
--- branches/netp5/src/network/packet/Welcome.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/packet/Welcome.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -28,18 +28,17 @@
*
*/
-
#include "Welcome.h"
-#include <enet/enet.h>
+
#include <cassert>
+#include "util/Debug.h"
#include "network/Host.h"
#include "network/synchronisable/Synchronisable.h"
-#include "core/CoreIncludes.h"
namespace orxonox {
namespace packet {
-#define PACKET_FLAGS_CLASSID ENET_PACKET_FLAG_RELIABLE
+#define PACKET_FLAGS_CLASSID PacketFlag::Reliable
#define _PACKETID 0
#define _CLIENTID _PACKETID + sizeof(ENUM::Type)
#define _ENDIANTEST _CLIENTID + sizeof(uint32_t)
Modified: branches/netp5/src/network/packet/Welcome.h
===================================================================
--- branches/netp5/src/network/packet/Welcome.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/packet/Welcome.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -25,11 +25,10 @@
* ...
*
*/
-#ifndef NETWORKWELCOME_H
-#define NETWORKWELCOME_H
+#ifndef _NETWORK_Welcome_H__
+#define _NETWORK_Welcome_H__
-#include "../NetworkPrereqs.h"
-
+#include "network/NetworkPrereqs.h"
#include "Packet.h"
namespace orxonox {
@@ -55,4 +54,4 @@
} //namespace packet
} //namespace orxonox
-#endif
+#endif /* _NETWORK_Welcome_H__ */
Modified: branches/netp5/src/network/synchronisable/NetworkCallback.h
===================================================================
--- branches/netp5/src/network/synchronisable/NetworkCallback.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/synchronisable/NetworkCallback.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -27,8 +27,8 @@
*/
-#ifndef _NETWORK_CALLBACK__
-#define _NETWORK_CALLBACK__
+#ifndef _NetworkCallback_H__
+#define _NetworkCallback_H__
#include "network/NetworkPrereqs.h"
#include "NetworkCallbackManager.h"
@@ -60,4 +60,4 @@
}
-#endif
+#endif /* _NetworkCallback_H__ */
Modified: branches/netp5/src/network/synchronisable/NetworkCallbackManager.cc
===================================================================
--- branches/netp5/src/network/synchronisable/NetworkCallbackManager.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/synchronisable/NetworkCallbackManager.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -26,7 +26,6 @@
*
*/
-
#include "NetworkCallbackManager.h"
#include "NetworkCallback.h"
Modified: branches/netp5/src/network/synchronisable/NetworkCallbackManager.h
===================================================================
--- branches/netp5/src/network/synchronisable/NetworkCallbackManager.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/synchronisable/NetworkCallbackManager.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -27,10 +27,11 @@
*/
-#ifndef _NETWORK_CALLBACKMANAGER__
-#define _NETWORK_CALLBACKMANAGER__
+#ifndef _NetworkCallbackManager_H__
+#define _NetworkCallbackManager_H__
#include "network/NetworkPrereqs.h"
+
#include <set>
#include <queue>
@@ -51,4 +52,4 @@
}
-#endif
+#endif /* _NetworkCallbackManager_H__ */
Modified: branches/netp5/src/network/synchronisable/Synchronisable.cc
===================================================================
--- branches/netp5/src/network/synchronisable/Synchronisable.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/synchronisable/Synchronisable.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -30,16 +30,10 @@
#include "Synchronisable.h"
-#include <cstring>
-#include <string>
-#include <iostream>
-#include <cassert>
-
#include "core/CoreIncludes.h"
#include "core/BaseObject.h"
-// #include "core/Identifier.h"
-
#include "network/Host.h"
+
namespace orxonox
{
Modified: branches/netp5/src/network/synchronisable/Synchronisable.h
===================================================================
--- branches/netp5/src/network/synchronisable/Synchronisable.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/synchronisable/Synchronisable.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -31,17 +31,15 @@
#include "network/NetworkPrereqs.h"
-#include <list>
+#include <cassert>
#include <vector>
#include <map>
#include <queue>
-#include <cassert>
-#include <string>
-#include "util/Math.h"
+
#include "util/mbool.h"
#include "core/OrxonoxClass.h"
-#include "NetworkCallback.h"
#include "SynchronisableVariable.h"
+#include "NetworkCallback.h"
/*#define REGISTERDATA(varname, ...) \
registerVariable((void*)&varname, sizeof(varname), DATA, __VA_ARGS__)
Modified: branches/netp5/src/network/synchronisable/SynchronisableSpecialisations.cc
===================================================================
--- branches/netp5/src/network/synchronisable/SynchronisableSpecialisations.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/synchronisable/SynchronisableSpecialisations.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -27,8 +27,10 @@
*
*/
-#include "network/synchronisable/Synchronisable.h"
#include <string>
+#include "util/Math.h"
+#include "Synchronisable.h"
+#include "SynchronisableVariable.h"
// ================ template spezialisation
Modified: branches/netp5/src/network/synchronisable/SynchronisableVariable.cc
===================================================================
--- branches/netp5/src/network/synchronisable/SynchronisableVariable.cc 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/synchronisable/SynchronisableVariable.cc 2009-06-23 00:12:44 UTC (rev 3209)
@@ -28,7 +28,6 @@
#include "SynchronisableVariable.h"
-
namespace orxonox{
uint8_t SynchronisableVariableBase::state_ = 0;
Modified: branches/netp5/src/network/synchronisable/SynchronisableVariable.h
===================================================================
--- branches/netp5/src/network/synchronisable/SynchronisableVariable.h 2009-06-22 22:51:43 UTC (rev 3208)
+++ branches/netp5/src/network/synchronisable/SynchronisableVariable.h 2009-06-23 00:12:44 UTC (rev 3209)
@@ -27,18 +27,14 @@
*/
-#ifndef _NETWORK_SYNCHRONISABLEVARIABLE__
-#define _NETWORK_SYNCHRONISABLEVARIABLE__
+#ifndef _SynchronisableVariable_H__
+#define _SynchronisableVariable_H__
#include "network/NetworkPrereqs.h"
-#include <string>
#include <cassert>
#include "util/Serialise.h"
-#include "core/Core.h"
-#include "core/CoreIncludes.h"
#include "core/GameMode.h"
-#include "network/synchronisable/NetworkCallback.h"
#include "network/synchronisable/NetworkCallbackManager.h"
namespace orxonox{
@@ -252,4 +248,4 @@
}
-#endif
+#endif /* _SynchronisableVariable_H__ */
More information about the Orxonox-commit
mailing list