Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1709


Ignore:
Timestamp:
Sep 4, 2008, 10:47:04 PM (16 years ago)
Author:
scheusso
Message:

fixed messing up with enet

Location:
code/branches/network/src/network
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network/src/network/Server.cc

    r1705 r1709  
    265265        COUT(3) << "Server: packet with client id (cid): " << cid << " not sended: " << temp->getFailures() << std::endl;
    266266        temp->addFailure();
    267         /*if(temp->getFailures() > 0 )
    268           disconnectClient(temp);*/
    269       //std::cout << "added gamestate" << std::endl;
    270267      }else
    271268        temp->resetFailures();
  • code/branches/network/src/network/packet/Packet.cc

    r1705 r1709  
    99#include "Chat.h"
    1010#include "ClassID.h"
     11#include "Gamestate.h"
    1112#include "network/Host.h"
    1213#include "core/CoreIncludes.h"
     
    3940  clientID_ = ClientInformation::findClient(&peer->address)->getID();
    4041  packetContent_ = createPacketContent(packet);
    41   delete packet;
     42  enet_packet_destroy(packet);
    4243  delete peer;
    4344}
     
    8889    case ENUM::Gamestate:
    8990      // TODO: remove brackets
    90       // packetContent_ = new Gamestate( data );
     91      packetContent_ = new Gamestate( data, true, clientID_ );
    9192      break;
    9293    default:
  • code/branches/network/src/network/packet/Packet.h

    r1705 r1709  
    6060    Packet(PacketContent *content);
    6161    Packet(ENetPacket *packet, ENetPeer *peer);
    62     ~Packet();
     62    virtual ~Packet();
    6363   
    6464    int getClientID(){ return clientID_; }
  • code/branches/network/src/network/packet/Welcome.cc

    r1705 r1709  
    11#include "Welcome.h"
    22#include "Packet.h"
     3#include <assert.h>
    34
    45namespace network {
     
    1415{
    1516  flags_ = flags_ | PACKET_FLAGS_CLASSID;
     17  assert(getSize());
    1618  data_=new unsigned char[ getSize() ];
    17   if(!data_)
    18     return;
     19  assert(data_);
    1920  *(packet::ENUM::Type *)&data_[ _PACKETID ] = packet::ENUM::Welcome;
    2021  *(unsigned int *)&data_[ _CLIENTID ] = clientID;
  • code/branches/network/src/network/packet/Welcome.h

    r1705 r1709  
    4242  Welcome( unsigned int clientID, unsigned int shipID );
    4343  Welcome( unsigned char* data, int clientID );
    44   ~Welcome();
     44  virtual ~Welcome();
    4545 
    4646  unsigned char *getData();
Note: See TracChangeset for help on using the changeset viewer.