Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6337 in orxonox.OLD


Ignore:
Timestamp:
Dec 30, 2005, 1:32:46 AM (18 years ago)
Author:
rennerc
Message:

groundturret now scales correctly on client

Location:
branches/network/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/lib/coord/p_node.cc

    r6336 r6337  
    10161016  SYNCHELP_READ_BEGIN();
    10171017
    1018   char * name;
    1019   SYNCHELP_READ_STRINGM( name );
     1018  SYNCHELP_READ_FKT( BaseObject::writeState );
     1019
     1020  PRINTF(0)("name = %s\n", this->getName());
    10201021
    10211022  char * parentName = NULL;
     
    10361037  SYNCHELP_READ_INT( parentMode );
    10371038  this->setParentMode((PARENT_MODE)parentMode);
    1038 
    1039   if ( strcmp(name, "")==0 )
    1040   {
    1041     this->setName( NULL );
    1042   }
    1043   else
    1044   {
    1045     this->setName( name );
    1046   }
    1047   delete name;
    1048   name = NULL;
    10491039
    10501040  float f1, f2, f3, f4;
     
    10561046  //this->setRelCoor( 10, 0, 0 );
    10571047
    1058   PRINTF(0)("%f %f %f\n", f1, f2, f3);
    1059 
    10601048  SYNCHELP_READ_FLOAT( f1 );
    10611049  SYNCHELP_READ_FLOAT( f2 );
    10621050  SYNCHELP_READ_FLOAT( f3 );
    10631051  //this->setAbsCoor( f1, f2, f3 );
    1064 
    1065   PRINTF(0)("%f %f %f\n", f1, f2, f3);
    10661052
    10671053  SYNCHELP_READ_FLOAT( f1 );
     
    10851071  {
    10861072    SYNCHELP_READ_STRINGM( childName );
     1073    PRINTF(0)("childname = %s\n", childName);
    10871074    addChild( childName );
    10881075    delete childName;
     
    11031090  SYNCHELP_WRITE_BEGIN();
    11041091
    1105   SYNCHELP_WRITE_STRING( this->getName() );
     1092  SYNCHELP_WRITE_FKT( BaseObject::readState );
     1093
     1094  PRINTF(0)("name = %s\n", this->getName());
    11061095
    11071096  if ( this->parent )
     
    11431132  for (std::list<PNode*>::const_iterator it = children.begin(); it!=children.end(); it++)
    11441133  {
     1134    PRINTF(0)("childname = %s\n", (*it)->getName() );
    11451135    SYNCHELP_WRITE_STRING( (*it)->getName() );
    11461136  }
  • branches/network/src/lib/lang/base_object.cc

    r6275 r6337  
    2222#include "compiler.h"
    2323#include "class_list.h"
     24
     25#include "synchronizeable.h"
    2426
    2527using namespace std;
     
    194196      PRINT(0)(" -Weapon-");
    195197    PRINT(0)("\n");
    196 }
    197 }
     198  }
     199}
     200
     201/**
     202 * Writes data from network containing information about the state
     203 * @param data pointer to data
     204 * @param length length of data
     205 * @param sender hostID of sender
     206 */
     207int BaseObject::writeState( const byte * data, int length, int sender )
     208{
     209  SYNCHELP_READ_BEGIN();
     210
     211  if ( objectName )
     212  {
     213    delete[] objectName;
     214    objectName = NULL;
     215  }
     216  SYNCHELP_READ_STRINGM( this->objectName );
     217
     218  return SYNCHELP_READ_N;
     219}
     220
     221/**
     222 * data copied in data will bee sent to another host
     223 * @param data pointer to data
     224 * @param maxLength max length of data
     225 * @return the number of bytes writen
     226 */
     227int BaseObject::readState( byte * data, int maxLength )
     228{
     229  SYNCHELP_WRITE_BEGIN();
     230
     231  SYNCHELP_WRITE_STRING( this->objectName );
     232
     233  return SYNCHELP_WRITE_N;
     234}
  • branches/network/src/lib/lang/base_object.h

    r6275 r6337  
    1515#define NULL     0    //!< NULL
    1616#endif
     17
     18#include "stdincl.h"
    1719
    1820class TiXmlElement;
     
    4446  bool operator==(ClassID classID) { return this->isA(classID); };
    4547
     48  int       writeState(const byte* data, int length, int sender);
     49  int       readState(byte* data, int maxLength );
    4650 protected:
    4751  void setClassID(ClassID classID, const char* className);
  • branches/network/src/world_entities/world_entity.cc

    r6331 r6337  
    121121
    122122    PRINTF(4)("fetching %s\n", fileName);
     123    this->scaling = scaling;
    123124    if (scaling == 1.0)
    124125      this->setModel((Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN), modelNumber);
     
    343344
    344345  SYNCHELP_READ_STRINGM( modelFileName );
     346  SYNCHELP_READ_FLOAT( scaling );
    345347  //check if modelFileName is relative to datadir or absolute
    346348  if ( strstr(modelFileName, ResourceManager::getInstance()->getDataDir()) )
    347349  {
    348     loadModel( modelFileName+strlen(ResourceManager::getInstance()->getDataDir()) );
     350    loadModel( modelFileName+strlen(ResourceManager::getInstance()->getDataDir()), scaling );
    349351  }
    350352  else
    351353  {
    352     loadModel( modelFileName );
     354    loadModel( modelFileName, scaling );
    353355  }
    354356  delete[] modelFileName;
     
    370372
    371373  SYNCHELP_WRITE_STRING( getModel( 0 )->getName() );
    372   PRINTF(0)("%s\n", getModel( 0 )->getName());
     374  SYNCHELP_WRITE_FLOAT( scaling );
    373375  return SYNCHELP_WRITE_N;
    374376}
  • branches/network/src/world_entities/world_entity.h

    r6331 r6337  
    8989  std::list<WorldEntity*>::iterator objectListIterator; //!< The iterator position of this Entity in the given list of the ObjectManager.
    9090
     91  float                   scaling;
     92
    9193
    9294};
Note: See TracChangeset for help on using the changeset viewer.