Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 21, 2005, 7:26:49 PM (18 years ago)
Author:
rennerc
Message:

network_socket: can now send more than 255 bytes
network_game_manager: fixed some bugs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/lib/network/network_game_manager.cc

    r6250 r6256  
    7373  byte b;
    7474
    75   while ( i<length )
     75  while ( i<length-1 )
    7676  {
    7777    b = data[i++];
     78
     79    PRINTF(0)("WriteBytes: b = %d\n", b);
    7880
    7981    if ( isServer() )
     
    9294      }
    9395    }
    94 
    95     if ( !isServer() )
     96    else
    9697    {
    9798      if ( b == CREATE_ENTITY )
     
    362363    return;
    363364
     365  PRINTF(0)("SendEntityList: n = %d\n", networkStream->getSyncCount());
     366
    364367  while ( it != e )
    365368  {
    366369    if ( !writeToClientBuffer( outBuffer[userID], (*it)->getClassID() ) )
    367370      return;
     371
     372    PRINTF(0)("SendEntityList: ClassID = %x\n", (*it)->getClassID());
    368373
    369374    if ( !writeToClientBuffer( outBuffer[userID], (*it)->getUniqueID() ) )
     
    409414  if ( !b )
    410415  {
    411     PRINTF(1)("Could not fabricate Object with classID %d\n", classID);
    412     return;
     416    PRINTF(1)("Could not fabricate Object with classID %x\n", classID);
     417    return;
     418  }
     419  else
     420  {
     421    PRINTF(0)("Fabricated entity: %s\n", b->getClassName());
    413422  }
    414423
     
    422431  else
    423432  {
    424     PRINTF(1)("Class with ID %d is not a synchronizeable!", (int)classID);
     433    PRINTF(1)("Class with ID %x is not a synchronizeable!", (int)classID);
    425434    delete b;
    426435  }
     
    549558  }
    550559  int classID;
    551   i += Converter::byteArrayToInt( data, &classID );
     560  i += Converter::byteArrayToInt( &data[i], &classID );
    552561
    553562  createEntity( (ClassID)classID );
     
    564573  }
    565574  int uniqueID;
    566   i += Converter::byteArrayToInt( data, &uniqueID );
     575  i += Converter::byteArrayToInt( &data[i], &uniqueID );
    567576
    568577  removeEntity( uniqueID );
     
    579588  }
    580589  int classID;
    581   i += Converter::byteArrayToInt( data, &classID );
     590  i += Converter::byteArrayToInt( &data[i], &classID );
    582591
    583592  if ( INTSIZE > length-i )
     
    587596  }
    588597  int uniqueID;
    589   i += Converter::byteArrayToInt( data, &uniqueID );
     598  i += Converter::byteArrayToInt( &data[i], &uniqueID );
    590599
    591600  if ( INTSIZE > length-i )
     
    595604  }
    596605  int owner;
    597   i += Converter::byteArrayToInt( data, &owner );
     606  i += Converter::byteArrayToInt( &data[i], &owner );
    598607
    599608  doCreateEntity( (ClassID)classID, uniqueID, owner );
     
    610619  }
    611620  int uniqueID;
    612   i += Converter::byteArrayToInt( data, &uniqueID );
     621  i += Converter::byteArrayToInt( &data[i], &uniqueID );
    613622
    614623  doRemoveEntity( uniqueID );
     
    624633    return false;
    625634  }
     635
     636  PRINTF(0)("HandleCreateEntityList:  data[i..i+3] = %d %d %d %d\n", data[i], data[i+1], data[i+2], data[i+3]);
     637
    626638  int n;
    627   i += Converter::byteArrayToInt( data, &n );
     639  i += Converter::byteArrayToInt( &data[i], &n );
     640
     641
     642  PRINTF(0)("HandleCreateEntityList: n = %d\n", n);
    628643
    629644  int classID, uniqueID, owner;
     
    637652      return false;
    638653    }
    639     i += Converter::byteArrayToInt( data, &classID );
     654    i += Converter::byteArrayToInt( &data[i], &classID );
    640655
    641656    if ( INTSIZE > length-i )
     
    644659      return false;
    645660    }
    646     i += Converter::byteArrayToInt( data, &uniqueID );
     661    i += Converter::byteArrayToInt( &data[i], &uniqueID );
    647662
    648663    if ( INTSIZE > length-i )
     
    651666      return false;
    652667    }
    653     i += Converter::byteArrayToInt( data, &owner );
     668    i += Converter::byteArrayToInt( &data[i], &owner );
    654669
    655670    doCreateEntity( (ClassID)classID, uniqueID, owner );
     
    667682  }
    668683  int n;
    669   i += Converter::byteArrayToInt( data, &n );
     684  i += Converter::byteArrayToInt( &data[i], &n );
    670685
    671686  int uniqueID;
     
    679694      return false;
    680695    }
    681     i += Converter::byteArrayToInt( data, &uniqueID );
     696    i += Converter::byteArrayToInt( &data[i], &uniqueID );
    682697
    683698    doRemoveEntity( uniqueID );
     
    696711
    697712  int uniqueID;
    698   i += Converter::byteArrayToInt( data, &uniqueID );
     713  i += Converter::byteArrayToInt( &data[i], &uniqueID );
    699714
    700715  doYouAre( uniqueID );
     
    711726  }
    712727  int uniqueID;
    713   i += Converter::byteArrayToInt( data, &uniqueID );
     728  i += Converter::byteArrayToInt( &data[i], &uniqueID );
    714729
    715730  doRequestSync( uniqueID, sender );
     
    733748bool NetworkGameManager::writeToClientBuffer( clientBuffer & cb, int i )
    734749{
    735   int n = Converter::intToByteArray( i, cb.buffer, cb.maxLength-cb.length );
     750  int n = Converter::intToByteArray( i, cb.buffer+cb.length, cb.maxLength-cb.length );
    736751  cb.length += n;
    737752
Note: See TracChangeset for help on using the changeset viewer.