Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6257 in orxonox.OLD


Ignore:
Timestamp:
Dec 21, 2005, 11:58:57 PM (18 years ago)
Author:
rennerc
Message:

class_id.h: changed CL_ENTITY_MANAGER to CL_NETWORK_GAME_MANAGER
base_object: added realClassID which can be used with factory
network_game_manager: fixed some bugs again, can now spawn entities over network :D

Location:
branches/network/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/defs/class_id.h

    r6139 r6257  
    238238  CL_CONNECTION_MONITOR         =    0x00000b05,
    239239  CL_HANDSHAKE                  =    0x00000b06,
    240   CL_ENTITY_MANAGER             =    0x00000b07,
     240  CL_NETWORK_GAME_MANAGER       =    0x00000b07,
    241241
    242242
  • branches/network/src/lib/lang/base_object.cc

    r6077 r6257  
    7575  this->classID |= (long)classID;
    7676  this->className = className;
     77  this->realClassID = classID;
    7778
    7879  ClassList::addToClassList(this, classID, className);
  • branches/network/src/lib/lang/base_object.h

    r6077 r6257  
    3434  /** @returns the classID of the corresponding Object */
    3535  inline int getClassID() const { return this->classID; };
     36  inline int getRealClassID() const { return this->realClassID; };
    3637
    3738  bool isA (ClassID classID) const;
     
    4950    const char*        className;        //!< the name of the class
    5051    long               classID;          //!< this is the id from the class_id.h enumeration
     52    long               realClassID;      //!< classID which can be used with factory
    5153    char*              objectName;       //!< The name of this object
    5254};
  • branches/network/src/lib/network/network_game_manager.cc

    r6256 r6257  
    4141
    4242  /* set the class id for the base object */
    43   this->setClassID(CL_ENTITY_MANAGER, "EntityManager");
     43  this->setClassID(CL_NETWORK_GAME_MANAGER, "EntityManager");
    4444
    4545  allOutBuffer.length = 0;
     
    145145  for ( int i = 0; i<outBuffer.size(); i++ )
    146146  {
     147    *reciever = i;
    147148    if ( outBuffer[i].length>0 )
    148149    {
    149150      int nbytes = outBuffer[i].length;
     151      outBuffer[i].length = 0;
    150152
    151153      if ( nbytes > maxLength )
     
    160162  }
    161163
     164  *reciever = 0;
    162165  int nbytes = allOutBuffer.length;
     166  allOutBuffer.length = 0;
    163167
    164168  if ( nbytes <=0 )
     
    360364    return;
    361365
    362   if ( !writeToClientBuffer( outBuffer[userID], networkStream->getSyncCount() ) )
    363     return;
    364 
    365   PRINTF(0)("SendEntityList: n = %d\n", networkStream->getSyncCount());
     366  // -2 because you must not send network_game_manager and handshake
     367  if ( !writeToClientBuffer( outBuffer[userID], networkStream->getSyncCount()-2 ) )
     368    return;
     369
     370  PRINTF(0)("SendEntityList: n = %d\n", networkStream->getSyncCount()-2 );
    366371
    367372  while ( it != e )
    368373  {
    369     if ( !writeToClientBuffer( outBuffer[userID], (*it)->getClassID() ) )
    370       return;
    371 
    372     PRINTF(0)("SendEntityList: ClassID = %x\n", (*it)->getClassID());
    373 
    374     if ( !writeToClientBuffer( outBuffer[userID], (*it)->getUniqueID() ) )
    375       return;
    376 
    377     if ( !writeToClientBuffer( outBuffer[userID], (*it)->getOwner() ) )
    378       return;
     374    if ( (*it)->getRealClassID() != CL_NETWORK_GAME_MANAGER && (*it)->getRealClassID() != CL_HANDSHAKE )
     375    {
     376
     377      if ( !writeToClientBuffer( outBuffer[userID], (*it)->getRealClassID() ) )
     378        return;
     379
     380      PRINTF(0)("SendEntityList: ClassID = %x\n", (*it)->getRealClassID());
     381
     382      if ( !writeToClientBuffer( outBuffer[userID], (*it)->getUniqueID() ) )
     383        return;
     384
     385      if ( !writeToClientBuffer( outBuffer[userID], (*it)->getOwner() ) )
     386        return;
     387    }
    379388
    380389    it++;
Note: See TracChangeset for help on using the changeset viewer.