Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6424 in orxonox.OLD for trunk/src/lib


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

Location:
trunk/src/lib
Files:
6 edited
3 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/Makefile.am

    r6074 r6424  
    3636                        lang/base_object.cc \
    3737                        lang/class_list.cc \
     38                        data/data_tank.cc \
    3839                        util/substring.cc \
    3940                        util/color.cc \
     
    4748noinst_HEADERS =        coord/p_node.h \
    4849                        lang/base_object.h \
     50                        data/data_tank.h \
    4951                        graphics/render2D/element_2d.h \
    5052                        graphics/render2D/render_2d.h \
     
    7072          particles \
    7173          collision_detection \
    72           network \
     74                network \
    7375          parser \
    7476          shell \
  • trunk/src/lib/coord/p_node.cc

    r6341 r6424  
    2929
    3030#include "synchronizeable.h"
     31
     32#include "shell_command.h"
     33SHELL_COMMAND(debugNode, PNode, debugNodeSC);
    3134
    3235using namespace std;
     
    152155  }
    153156}
     157
     158
     159/**
     160 *  init the pnode to a well definied state
     161 *
     162 * this function actualy only updates the PNode tree
     163 */
     164void PNode::init()
     165{
     166  /* just update all aboslute positions via timestep 0.001ms */
     167  this->updateNode(0.001f);
     168  this->updateNode(0.001f);
     169}
     170
    154171
    155172/**
  • trunk/src/lib/coord/p_node.h

    r6341 r6424  
    7878
    7979  void loadParams(const TiXmlElement* root);
     80
     81  void init();
    8082
    8183  // ACTIVATION //
     
    172174  // DEBUG //
    173175  void countChildNodes(int& nodes) const;
     176  void debugNodeSC (unsigned int depth = 1, unsigned int level = 0) { this->debugNode(depth, level); };
    174177  void debugNode (unsigned int depth = 1, unsigned int level = 0) const;
    175178  void debugDraw(unsigned int depth = 1, float size = 1.0, const Vector& color = Vector(1, 0, 0), unsigned int level = 0) const;
  • 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}
  • trunk/src/lib/network/network_game_manager.h

    r6341 r6424  
    7575
    7676    void createEntity( ClassID classID, int owner = 0 );
    77     BaseObject* createEntity( TiXmlElement* element);
     77    BaseObject* createEntity(const TiXmlElement* element);
    7878    void removeEntity( int uniqueID );
    7979    void sendYouAre( int uniqueID, int userID );
     
    9494    void executeRequestSync( int uniqueID, int user );
    9595
    96     void doCreateEntity(ClassID classID, int uniqueID, int owner);
     96    BaseObject* doCreateEntity(ClassID classID, int uniqueID, int owner);
    9797    void doRemoveEntity(int uniqueID);
    9898    void doRequestSync(int uniqueID, int userID);
  • trunk/src/lib/network/synchronizeable.cc

    r6341 r6424  
    3636  this->networkStream = NULL;
    3737  this->setRequestedSync( false );
     38  this->setIsOutOfSync( !(this->isServer()) );
    3839}
    3940
Note: See TracChangeset for help on using the changeset viewer.