Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 7, 2006, 11:07:22 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the branche network back to the trunk
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/network . -r 6351:HEAD
no conflicts

File:
1 edited

Legend:

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

    r6341 r6424  
    2323#include "network_stream.h"
    2424#include "converter.h"
     25
     26#include "p_node.h"
     27
    2528
    2629/* include your own header */
     
    237240 * @param classID: The ID of the class of which an entity should be created
    238241 */
    239 BaseObject* NetworkGameManager::createEntity( TiXmlElement* element)
     242BaseObject* NetworkGameManager::createEntity(const TiXmlElement* element)
    240243{
    241244  if ( this->isServer() )
     
    252255    if ( !b )
    253256    {
    254       PRINTF(1)("Could not fabricate Object with classID %x\n", element->Value() );
     257      PRINTF(1)("Could not fabricate Object with className %s\n", element->Value() );
    255258      return NULL;
    256259    }
     
    391394  //PRINTF(0)("SendEntityList: n = %d\n", networkStream->getSyncCount()-2 );
    392395
     396  int n = 0;
     397
    393398  while ( it != e )
    394399  {
     
    403408    if ( !writeToClientBuffer( outBuffer[userID], (int)((*it)->getOwner()) ) )
    404409      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  }*/
    405424
    406425    it++;
     
    436455 * @param owner: owner of this synchronizealbe
    437456 */
    438 void NetworkGameManager::doCreateEntity( ClassID classID, int uniqueID, int owner )
     457BaseObject* NetworkGameManager::doCreateEntity( ClassID classID, int uniqueID, int owner )
    439458{
    440459  BaseObject * b = Factory::fabricate( classID );
     
    443462  {
    444463    PRINTF(1)("Could not fabricate Object with classID %x\n", classID);
    445     return;
     464    return NULL;
    446465  }
    447466
     
    455474      s->setIsOutOfSync( true );
    456475    PRINTF(0)("Fabricated %s with id %d\n", s->getClassName(), s->getUniqueID());
     476    return b;
    457477  }
    458478  else
     
    461481    delete b;
    462482  }
     483  return NULL;
    463484}
    464485
     
    695716    i += Converter::byteArrayToInt( &data[i], &owner );
    696717
     718    PRINTF(0)("before fabricate\n");
    697719    if ( classID != CL_NETWORK_GAME_MANAGER && classID != CL_HANDSHAKE )
    698       doCreateEntity( (ClassID)classID, uniqueID, owner );
    699 
    700   }
     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
    701736  return true;
    702737}
Note: See TracChangeset for help on using the changeset viewer.