Changeset 10239 in orxonox.OLD for branches/mount_points/src/world_entities
- Timestamp:
- Jan 16, 2007, 10:52:55 PM (18 years ago)
- Location:
- branches/mount_points/src/world_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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.