Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 26, 2008, 10:06:36 PM (16 years ago)
Author:
scheusso
Message:

found a bug in gamestate diffing (in some cases the gamestate diffed was
filled with zeros at the end)

File:
1 edited

Legend:

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

    r1360 r1432  
    8989  ENetPacket* command( int dataLength, void *data, int reliable = ENET_PACKET_FLAG_RELIABLE )
    9090  {
     91    if(dataLength==0)
     92      return NULL;
    9193    unsigned char *stream = new unsigned char[dataLength + 2*sizeof(int)];
    9294    if(!stream)
     
    150152    //std::cout << "totalLen " << totalLen << std::endl;
    151153    //unsigned char *data = (unsigned char*)malloc( totalLen ); //allocate the memory for datastream
     154    if(totalLen==0)
     155      return NULL;
    152156    unsigned char *data = new unsigned char[totalLen];
    153157    memcpy( (void*)(data), (const void*)&gid, sizeof( int ) ); //this is the enet id
     
    173177  {
    174178    //unsigned char* data = (unsigned char *)malloc(3*sizeof(int)+classname.length()+1);
     179    if(classname.length()==0)
     180      return NULL;
    175181    unsigned char *data = new unsigned char[3*sizeof(int)+classname.length()+1];
    176182    std::cout << "PacketGenerator: classid: " << classid << ", name: " << classname << std::endl;
Note: See TracChangeset for help on using the changeset viewer.