Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 6, 2006, 6:19:30 PM (18 years ago)
Author:
rennerc
Message:

some more entities should sync now

File:
1 edited

Legend:

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

    r6414 r6419  
    2323#include "network_stream.h"
    2424#include "converter.h"
     25
    2526#include "p_node.h"
     27
    2628
    2729/* include your own header */
     
    392394  //PRINTF(0)("SendEntityList: n = %d\n", networkStream->getSyncCount()-2 );
    393395
     396  int n = 0;
     397
    394398  while ( it != e )
    395399  {
     
    404408    if ( !writeToClientBuffer( outBuffer[userID], (int)((*it)->getOwner()) ) )
    405409      return;
     410
     411
     412    PRINTF(0)("id = %x %s %s\n", (int)((*it)->getLeafClassID()), (*it)->getClassName(), (*it)->getName());
     413
     414
     415    /*if ( (*it)->isA(CL_WORLD_ENTITY) )
     416    {
     417      n = dynamic_cast<WorldEntity*>((*it))->readState( outBuffer[userID].buffer, outBuffer[userID].maxLength-outBuffer[userID].length );
     418      if ( n = 0 )
     419      {
     420        PRINTF(2)("n = 0\n");
     421      }
     422      outBuffer[userID].length += n;
     423  }*/
    406424
    407425    it++;
     
    437455 * @param owner: owner of this synchronizealbe
    438456 */
    439 void NetworkGameManager::doCreateEntity( ClassID classID, int uniqueID, int owner )
     457BaseObject* NetworkGameManager::doCreateEntity( ClassID classID, int uniqueID, int owner )
    440458{
    441459  BaseObject * b = Factory::fabricate( classID );
     
    444462  {
    445463    PRINTF(1)("Could not fabricate Object with classID %x\n", classID);
    446     return;
     464    return NULL;
    447465  }
    448466
     
    456474      s->setIsOutOfSync( true );
    457475    PRINTF(0)("Fabricated %s with id %d\n", s->getClassName(), s->getUniqueID());
     476    return b;
    458477  }
    459478  else
     
    462481    delete b;
    463482  }
     483  return NULL;
    464484}
    465485
     
    696716    i += Converter::byteArrayToInt( &data[i], &owner );
    697717
     718    PRINTF(0)("before fabricate\n");
    698719    if ( classID != CL_NETWORK_GAME_MANAGER && classID != CL_HANDSHAKE )
    699       doCreateEntity( (ClassID)classID, uniqueID, owner );
    700 
    701   }
     720    {
     721      BaseObject* b = doCreateEntity( (ClassID)classID, uniqueID, owner );
     722
     723      /*if ( b != NULL )
     724      {
     725        if ( b->isA(CL_WORLD_ENTITY) )
     726        {
     727          int n = dynamic_cast<WorldEntity*>(b)->writeState( data, length, sender );
     728
     729          i += n;
     730        }
     731    }*/
     732    }
     733
     734  }
     735
    702736  PNode::getNullParent()->debugNode( 0 );
     737
    703738  return true;
    704739}
Note: See TracChangeset for help on using the changeset viewer.