Changeset 10239 in orxonox.OLD for branches/mount_points/src
- Timestamp:
- Jan 16, 2007, 10:52:55 PM (18 years ago)
- 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 22 22 #include "util/loading/factory.h" 23 23 #include "util/loading/load_param_xml.h" 24 25 26 27 /** 28 * constructor 29 */ 30 OIFData::OIFData() 31 {} 24 32 25 33 … … 70 78 71 79 72 73 80 /** 74 * standard constructor 81 * constructor 82 * @param fileName name of the file 75 83 */ 76 84 ObjectInformationFile::ObjectInformationFile() 85 : data(new OIFData()) 77 86 { 78 87 this->init(); … … 105 114 106 115 /** 116 * the definition of the assignment operator 117 * @param oif 118 * @return 119 */ 120 ObjectInformationFile& ObjectInformationFile::operator=(const ObjectInformationFile& oif) 121 { 122 this->init(); 123 this->data = oif.data; 124 125 return *this; 126 } 127 128 /** 107 129 * initizlizing function 108 130 */ … … 122 144 123 145 124 125 ObjectInformationFile& ObjectInformationFile::operator=(const ObjectInformationFile& oif)126 {127 this->data = oif.data;128 return *this;129 }130 131 132 146 /** 133 147 * this initializes the mount point -
branches/mount_points/src/lib/graphics/importer/oif/object_information_file.h
r10228 r10239 20 20 21 21 public: 22 OIFData(); 22 23 OIFData(const std::string& fileName); 23 24 virtual ~OIFData() {} … … 44 45 ObjectInformationFile& operator=(const ObjectInformationFile& oif); 45 46 46 // void initMountPoint(MountPoint* mountPoint); 47 /** @returns a reference to the xml oif file */ 48 inline const TiXmlElement* getMountPointDescription() { return this->data->root(); } 49 47 50 48 51 private: -
branches/mount_points/src/world_entities/mount_point.cc
r10232 r10239 10 10 11 11 ### File Specific 12 main-programmer: Patrick Boenzli patrick@orxonox.net12 main-programmer: Patrick Boenzli, patrick@orxonox.net 13 13 co-programmer: 14 14 */ … … 27 27 28 28 ObjectListDefinition(MountPoint); 29 CREATE_FACTORY(MountPoint);30 29 31 30 … … 106 105 void MountPoint::loadParam(const TiXmlElement* root) 107 106 { 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"); 110 110 111 112 LoadParam(root, "OrxClass", this, WorldEntity, setOrxClass)113 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"); 114 114 } 115 115 … … 134 134 { 135 135 // create the object for this mount point 136 this->_mount= Factory::fabricate(orxClass);136 BaseObject* obj = Factory::fabricate(orxClass); 137 137 // 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 139 146 PRINTF(1)("Couldn't create %s for this mount point (%s)\n", orxClass.c_str(), this->_name.c_str()); 140 147 } … … 149 156 { 150 157 151 152 158 } 153 159 … … 158 164 void MountPoint::draw() const 159 165 { 160 161 166 } 162 167 -
branches/mount_points/src/world_entities/world_entity.cc
r10228 r10239 12 12 13 13 ### 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 16 17 */ 17 18 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY … … 73 74 this->scaling = 1.0f; 74 75 this->oiFile = NULL; 76 // add 10 members to this array 77 this->mountPoints.reserve(10); 75 78 76 79 /* OSOLETE */ … … 298 301 299 302 // now fill the mount point 300 this->oiFile->initMountPoint(mp);303 mp->initMountPoint( this->oiFile->getMountPointDescription()); 301 304 } 302 305 … … 364 367 void WorldEntity::addMountPoint(int slot, MountPoint* mountPoint) 365 368 { 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()); 369 377 } 370 378
Note: See TracChangeset
for help on using the changeset viewer.