Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10239 in orxonox.OLD for branches/mount_points/src


Ignore:
Timestamp:
Jan 16, 2007, 10:52:55 PM (18 years ago)
Author:
patrick
Message:

found a bug in the object information resources file. fixed

Location:
branches/mount_points/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/mount_points/src/lib/graphics/importer/oif/object_information_file.cc

    r10228 r10239  
    2222#include "util/loading/factory.h"
    2323#include "util/loading/load_param_xml.h"
     24
     25
     26
     27/**
     28 * constructor
     29 */
     30OIFData::OIFData()
     31{}
    2432
    2533
     
    7078
    7179
    72 
    7380/**
    74  * standard constructor
     81 * constructor
     82 * @param fileName name of the file
    7583 */
    7684ObjectInformationFile::ObjectInformationFile()
     85  : data(new OIFData())
    7786{
    7887  this->init();
     
    105114
    106115/**
     116 * the definition of the assignment operator
     117 * @param oif
     118 * @return
     119 */
     120ObjectInformationFile& ObjectInformationFile::operator=(const ObjectInformationFile& oif)
     121{
     122  this->init();
     123  this->data = oif.data;
     124
     125  return *this;
     126}
     127
     128/**
    107129 * initizlizing function
    108130 */
     
    122144
    123145
    124 
    125 ObjectInformationFile& ObjectInformationFile::operator=(const ObjectInformationFile& oif)
    126 {
    127   this->data = oif.data;
    128   return *this;
    129 }
    130 
    131 
    132146/**
    133147 * this initializes the mount point
  • branches/mount_points/src/lib/graphics/importer/oif/object_information_file.h

    r10228 r10239  
    2020
    2121public:
     22  OIFData();
    2223  OIFData(const std::string& fileName);
    2324  virtual ~OIFData() {}
     
    4445  ObjectInformationFile& operator=(const ObjectInformationFile& oif);
    4546
    46 //   void initMountPoint(MountPoint* mountPoint);
     47  /** @returns a reference to the xml oif file */
     48  inline const TiXmlElement* getMountPointDescription() { return this->data->root(); }
     49
    4750
    4851  private:
  • branches/mount_points/src/world_entities/mount_point.cc

    r10232 r10239  
    1010
    1111   ### File Specific
    12    main-programmer: Patrick Boenzli patrick@orxonox.net
     12   main-programmer: Patrick Boenzli, patrick@orxonox.net
    1313   co-programmer:
    1414*/
     
    2727
    2828ObjectListDefinition(MountPoint);
    29 CREATE_FACTORY(MountPoint);
    3029
    3130
     
    106105void MountPoint::loadParam(const TiXmlElement* root)
    107106{
    108    LoadParam(root, "description", this, WorldEntity, setDescription)
    109     .describe("Sets this mount point a description");
     107  // first check for the description
     108  LoadParam(root, "Description", this, MountPoint, setDescription)
     109  .describe("Sets this mount point a description");
    110110
    111 
    112    LoadParam(root, "OrxClass", this, WorldEntity, setOrxClass)
    113     .describe("Sets the class this mount points should host");
     111  // now check for the orx class to create
     112  LoadParam(root, "OrxClass", this, MountPoint, setOrxClass)
     113  .describe("Sets the class this mount points should host");
    114114}
    115115
     
    134134{
    135135  // create the object for this mount point
    136   this->_mount = Factory::fabricate(orxClass);
     136  BaseObject* obj = Factory::fabricate(orxClass);
    137137  // check if the object is created correctly
    138   if( this->_mount == NULL)
     138  if( this->_mount != NULL)
     139  {
     140    if( obj->isA( WorldEntity::staticClassID()))
     141    {
     142      this->_mount = dynamic_cast<WorldEntity*>(obj);
     143    }
     144  }
     145  else
    139146    PRINTF(1)("Couldn't create %s for this mount point (%s)\n", orxClass.c_str(), this->_name.c_str());
    140147}
     
    149156{
    150157
    151 
    152158}
    153159
     
    158164void MountPoint::draw() const
    159165{
    160 
    161166}
    162167
  • branches/mount_points/src/world_entities/world_entity.cc

    r10228 r10239  
    1212
    1313   ### File Specific:
    14    main-programmer: Patrick Boenzli, Benjamin Grauer
    15    co-programmer: Christian Meier
     14   main-programmer: Patrick Boenzli
     15   main-programmer: Benjamin Grauer
     16   co-programmer:   Christian Meier
    1617*/
    1718#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
     
    7374  this->scaling = 1.0f;
    7475  this->oiFile = NULL;
     76  // add 10 members to this array
     77  this->mountPoints.reserve(10);
    7578
    7679  /* OSOLETE */
     
    298301
    299302    // now fill the mount point
    300     this->oiFile->initMountPoint(mp);
     303    mp->initMountPoint( this->oiFile->getMountPointDescription());
    301304  }
    302305
     
    364367void WorldEntity::addMountPoint(int slot, MountPoint* mountPoint)
    365368{
    366   if( this->mountPoints[slot] != NULL)
    367   {
    368     PRINTF(0)("adding a mount point to a slot, that already is occupied! ignoring - maybe some object do not get connected well (object: %s)\n", this->getClassCName());
     369  if( this->mountPoints.capacity() < (unsigned int)slot)
     370  {
     371    // reserve 5 more slots than needed so this function is called as rare as possible
     372    this->mountPoints.reserve(slot + 5);
     373  }
     374  else if( this->mountPoints[slot] != NULL)
     375  {
     376    PRINTF(0)("adding a mount point to a slot, that already is occupied! ignoring - maybe some object did not get connected well (object: %s)\n", this->getClassCName());
    369377  }
    370378
Note: See TracChangeset for help on using the changeset viewer.