Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 23, 2009, 2:12:44 AM (16 years ago)
Author:
rgrieder
Message:

Cleanup in network plus a few dependency reductions (no enet-function inlines, using enum PacketFlag instead of the enet version)

Location:
code/branches/netp5/src/network/packet
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • code/branches/netp5/src/network/packet/Acknowledgement.cc

    r3198 r3209  
    2727 */
    2828
     29#include "Acknowledgement.h"
    2930
    30 #include "Acknowledgement.h"
    31 #include "network/Host.h"
     31#include "util/Debug.h"
    3232#include "network/GamestateHandler.h"
    33 #include "core/CoreIncludes.h"
    3433
    3534namespace orxonox {
  • code/branches/netp5/src/network/packet/Acknowledgement.h

    r2662 r3209  
    2626 *
    2727 */
    28 #ifndef NETWORKACKNOLEDGEMENT_H
    29 #define NETWORKACKNOLEDGEMENT_H
    3028
    31 #include "../NetworkPrereqs.h"
     29#ifndef _Acknowledgement_H__
     30#define _Acknowledgement_H__
     31
     32#include "network/NetworkPrereqs.h"
    3233#include "Packet.h"
    3334
     35namespace orxonox {
    3436const unsigned int ACKID_NACK = 0;
    35 
    36 namespace orxonox {
    3737namespace packet {
    3838/**
     
    5656} //namespace orxonox
    5757
    58 #endif
     58#endif /* _Acknowledgement_H__ */
  • code/branches/netp5/src/network/packet/Chat.cc

    r2773 r3209  
    2929#include "Chat.h"
    3030
    31 #include <enet/enet.h>
    32 #include <cassert>
     31#include <string>
    3332#include "network/Host.h"
    3433
     
    3635namespace packet {
    3736 
    38 #define   PACKET_FLAGS_CHAT ENET_PACKET_FLAG_RELIABLE
     37#define   PACKET_FLAGS_CHAT PacketFlag::Reliable
    3938#define   _PACKETID         0
    4039const int _PLAYERID     =   _PACKETID + sizeof(ENUM::Type);
     
    4241#define   _MESSAGE          _MESSAGELENGTH + sizeof(uint32_t)
    4342
    44 Chat::Chat( std::string message, unsigned int playerID )
     43Chat::Chat( const std::string& message, unsigned int playerID )
    4544 : Packet()
    4645{
  • code/branches/netp5/src/network/packet/Chat.h

    r2171 r3209  
     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 */
    128
    2 #ifndef NETWORKCHAT_H
    3 #define NETWORKCHAT_H
     29#ifndef _NETWORK_Chat_H__
     30#define _NETWORK_Chat_H__
    431
    5 #include "../NetworkPrereqs.h"
    6 
    7 #include <string>
    8 #include <cstring>
    9 
     32#include "network/NetworkPrereqs.h"
    1033#include "Packet.h"
    1134
     
    1841{
    1942public:
    20   Chat( std::string message, unsigned int playerID );
     43  Chat( const std::string& message, unsigned int playerID );
    2144  Chat( uint8_t* data, unsigned int clientID );
    2245  ~Chat();
     
    3558} //namespace orxonox
    3659
    37 #endif
     60#endif /* _NETWORK_Chat_H__ */
  • code/branches/netp5/src/network/packet/ClassID.cc

    r3084 r3209  
    2727 */
    2828
     29#include "ClassID.h"
    2930
    30 
    31 #include "ClassID.h"
    32 #include <enet/enet.h>
    33 #include "core/CoreIncludes.h"
    34 #include "core/Factory.h"
    35 #include <cstring>
    36 #include <string>
    3731#include <cassert>
    3832#include <map>
    3933#include <queue>
     34#include <string>
     35
     36#include "core/CoreIncludes.h"
    4037
    4138namespace orxonox {
     
    4340
    4441
    45 #define PACKET_FLAGS_CLASSID  ENET_PACKET_FLAG_RELIABLE
     42#define PACKET_FLAGS_CLASSID  PacketFlag::Reliable
    4643#define _PACKETID             0
    4744
  • code/branches/netp5/src/network/packet/ClassID.h

    r2759 r3209  
    2626 *
    2727 */
    28 #ifndef NETWORKCLASSID_H
    29 #define NETWORKCLASSID_H
    3028
    31 #include "../NetworkPrereqs.h"
     29#ifndef _NETWORK_ClassID_H__
     30#define _NETWORK_ClassID_H__
    3231
    33 #include <string>
    34 
     32#include "network/NetworkPrereqs.h"
    3533#include "Packet.h"
    3634
     
    5856} //namespace orxonox
    5957
    60 #endif
     58#endif /* _NETWORK_ClassID_H__ */
  • code/branches/netp5/src/network/packet/DeleteObjects.cc

    r3208 r3209  
    2929
    3030#include "DeleteObjects.h"
    31 #include <enet/enet.h>
     31
     32#include <cassert>
     33#include "util/Debug.h"
    3234#include "network/synchronisable/Synchronisable.h"
    33 #include "core/CoreIncludes.h"
    34 #include <cassert>
    3535
    3636namespace orxonox {
    3737namespace packet {
    3838
    39 #define PACKET_FLAG_DELETE  ENET_PACKET_FLAG_RELIABLE
     39#define PACKET_FLAG_DELETE  PacketFlag::Reliable
    4040#define _PACKETID           0
    4141#define _QUANTITY           _PACKETID + sizeof(ENUM::Type)
  • code/branches/netp5/src/network/packet/DeleteObjects.h

    r2171 r3209  
    2626 *
    2727 */
    28 #ifndef NETWORKPACKETDELETEOBJECTS_H
    29 #define NETWORKPACKETDELETEOBJECTS_H
     28#ifndef _DeleteObjects_H__
     29#define _DeleteObjects_H__
    3030
    31 #include "../NetworkPrereqs.h"
    32 
     31#include "network/NetworkPrereqs.h"
    3332#include "Packet.h"
    34 
    3533
    3634namespace orxonox {
     
    5755} //namespace orxonox
    5856
    59 #endif
     57#endif /* _DeleteObjects_H__ */
  • code/branches/netp5/src/network/packet/FunctionCalls.cc

    r3208 r3209  
    2929#include "FunctionCalls.h"
    3030
    31 #include <enet/enet.h>
    3231#include <cassert>
    33 #include <cstring>
    34 #include "network/Host.h"
     32#include "util/MultiType.h"
    3533#include "network/NetworkFunction.h"
    36 #include "util/MultiType.h"
    3734
    3835namespace orxonox {
    3936namespace packet {
    4037 
    41 #define   PACKET_FLAGS_FUNCTIONCALLS ENET_PACKET_FLAG_RELIABLE
     38#define   PACKET_FLAGS_FUNCTIONCALLS PacketFlag::Reliable
    4239#define   _PACKETID         0
    4340const unsigned int FUNCTIONCALLS_MEM_ALLOCATION = 1000;
  • code/branches/netp5/src/network/packet/FunctionCalls.h

    r3084 r3209  
     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 */
    128
    2 #ifndef NETWORKFUNCTIONCALLS_H
    3 #define NETWORKFUNCTIONCALLS_H
     29#ifndef _FunctionCalls_H__
     30#define _FunctionCalls_H__
    431
    5 #include "../NetworkPrereqs.h"
     32#include "network/NetworkPrereqs.h"
    633
    7 #include <string>
    8 #include <cstring>
    9 
     34#include <cassert>
     35#include "util/UtilPrereqs.h"
    1036#include "Packet.h"
    11 #include <cassert>
    1237
    1338namespace orxonox {
    14 
    15 class MultiType;
    1639
    1740namespace packet {
     
    4467} //namespace orxonox
    4568
    46 #endif
     69#endif /* _FunctionCalls_H__ */
  • code/branches/netp5/src/network/packet/FunctionIDs.cc

    r3084 r3209  
    2727 */
    2828
     29#include "FunctionIDs.h"
    2930
    30 
    31 #include "FunctionIDs.h"
    32 #include "network/NetworkFunction.h"
    33 #include <enet/enet.h>
    34 #include "core/CoreIncludes.h"
    35 #include <string>
    3631#include <cassert>
    3732#include <queue>
     33#include <string>
     34
     35#include "util/Debug.h"
     36#include "core/ObjectList.h"
     37#include "network/NetworkFunction.h"
    3838
    3939namespace orxonox {
     
    4141
    4242
    43 #define PACKET_FLAGS_FUNCTIONIDS  ENET_PACKET_FLAG_RELIABLE
     43#define PACKET_FLAGS_FUNCTIONIDS  PacketFlag::Reliable
    4444#define _PACKETID                 0
    4545
  • code/branches/netp5/src/network/packet/FunctionIDs.h

    r3084 r3209  
    2626 *
    2727 */
    28 #ifndef NETWORKFUNCTIONIDS_H
    29 #define NETWORKFUNCTIONIDS_H
    3028
    31 #include "../NetworkPrereqs.h"
     29#ifndef _FunctionIDs_H__
     30#define _FunctionIDs_H__
    3231
    33 #include <string>
    34 
     32#include "network/NetworkPrereqs.h"
    3533#include "Packet.h"
    3634
     
    5856} //namespace orxonox
    5957
    60 #endif
     58#endif /* _FunctionIDs_H__ */
  • code/branches/netp5/src/network/packet/Gamestate.cc

    r3198 r3209  
    2828
    2929#include "Gamestate.h"
    30 #include <enet/enet.h>
     30
    3131#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"
    3634#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"
    4138
    4239namespace orxonox {
     
    4643#define GAMESTATE_START(data) (data + GamestateHeader::getSize())
    4744
    48 #define PACKET_FLAG_GAMESTATE  ENET_PACKET_FLAG_RELIABLE
     45#define PACKET_FLAG_GAMESTATE  PacketFlag::Reliable
    4946
    5047
  • code/branches/netp5/src/network/packet/Gamestate.h

    r3198 r3209  
    2828
    2929
    30 #ifndef NETWORK_PACKETGAMESTATE_H
    31 #define NETWORK_PACKETGAMESTATE_H
     30#ifndef _Gamestate_H__
     31#define _Gamestate_H__
    3232
    3333#include "network/NetworkPrereqs.h"
    3434
     35#include <cassert>
     36#include <list>
     37
     38#include "util/CRC32.h"
     39#include "network/TrafficControl.h"
    3540#include "Packet.h"
    36 #include "network/TrafficControl.h"
    37 #include <string.h>
    38 #include <map>
    39 #include <vector>
    40 #include <cassert>
    41 #ifndef NDEBUG
    42 #include "util/CRC32.h"
    43 #endif
    4441
    4542namespace orxonox {
     
    138135}
    139136
    140 #endif
     137#endif /* _Gamestate_H__ */
  • code/branches/netp5/src/network/packet/Packet.cc

    r3208 r3209  
    3232#include <cassert>
    3333#include <enet/enet.h>
    34 
    35 #include "network/ClientInformation.h"
    36 
     34#include <boost/static_assert.hpp>
     35
     36#include "util/Debug.h"
    3737#include "Acknowledgement.h"
    38 #include "DeleteObjects.h"
    3938#include "Chat.h"
    4039#include "ClassID.h"
     40#include "DeleteObjects.h"
    4141#include "FunctionCalls.h"
    4242#include "FunctionIDs.h"
     
    4444#include "Welcome.h"
    4545#include "network/Host.h"
    46 #include "core/CoreIncludes.h"
     46#include "network/ClientInformation.h"
    4747
    4848namespace orxonox{
     
    5050namespace packet{
    5151
    52 #define PACKET_FLAG_DEFAULT ENET_PACKET_FLAG_NO_ALLOCATE
     52// Make sure we assume the right values
     53BOOST_STATIC_ASSERT(static_cast<int>(PacketFlag::Reliable)   == static_cast<int>(ENET_PACKET_FLAG_RELIABLE));
     54BOOST_STATIC_ASSERT(static_cast<int>(PacketFlag::Unsequence) == static_cast<int>(ENET_PACKET_FLAG_UNSEQUENCED));
     55BOOST_STATIC_ASSERT(static_cast<int>(PacketFlag::NoAllocate) == static_cast<int>(ENET_PACKET_FLAG_NO_ALLOCATE));
     56
     57#define PACKET_FLAG_DEFAULT PacketFlag::NoAllocate
    5358#define _PACKETID           0
    5459
     
    103108  }
    104109  else if (this->data_) {
    105     // This destructor was probably called as a consequence to ENet executing our callback.
     110    // This destructor was probably called as a consequence of ENet executing our callback.
    106111    // It simply serves us to be able to deallocate the packet content (data_) ourselves since
    107112    // we have created it in the first place.
  • code/branches/netp5/src/network/packet/Packet.h

    r3084 r3209  
    2626 *
    2727 */
    28 #ifndef NETWORKPACKET_H
    29 #define NETWORKPACKET_H
     28#ifndef _NETWORK_Packet_H__
     29#define _NETWORK_Packet_H__
    3030
    3131#include "network/NetworkPrereqs.h"
    32 
    3332#include <map>
    3433
     
    102101} //namespace orxonox
    103102
    104 #endif
     103#endif /* _NETWORK_Packet_H__ */
  • code/branches/netp5/src/network/packet/Welcome.cc

    r2773 r3209  
    2929 */
    3030
     31#include "Welcome.h"
    3132
    32 #include "Welcome.h"
    33 #include <enet/enet.h>
    3433#include <cassert>
     34#include "util/Debug.h"
    3535#include "network/Host.h"
    3636#include "network/synchronisable/Synchronisable.h"
    37 #include "core/CoreIncludes.h"
    3837
    3938namespace orxonox {
    4039namespace packet {
    4140
    42 #define PACKET_FLAGS_CLASSID  ENET_PACKET_FLAG_RELIABLE
     41#define PACKET_FLAGS_CLASSID  PacketFlag::Reliable
    4342#define _PACKETID             0
    4443#define _CLIENTID             _PACKETID + sizeof(ENUM::Type)
  • code/branches/netp5/src/network/packet/Welcome.h

    r2662 r3209  
    2626 *
    2727 */
    28 #ifndef NETWORKWELCOME_H
    29 #define NETWORKWELCOME_H
     28#ifndef _NETWORK_Welcome_H__
     29#define _NETWORK_Welcome_H__
    3030
    31 #include "../NetworkPrereqs.h"
    32 
     31#include "network/NetworkPrereqs.h"
    3332#include "Packet.h"
    3433
     
    5655} //namespace orxonox
    5756
    58 #endif
     57#endif /* _NETWORK_Welcome_H__ */
Note: See TracChangeset for help on using the changeset viewer.