Changeset 10540 in orxonox.OLD for trunk/src/world_entities
- Timestamp:
- Jan 31, 2007, 5:04:11 AM (18 years ago)
- Location:
- trunk/src/world_entities
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/mount_point.cc
r10534 r10540 140 140 if( this->_mount != NULL) 141 141 { 142 PRINTF(0)("Got detail informations\n");142 PRINTF(0)("Got detailed informations\n"); 143 143 this->_mount->loadParams( root); 144 144 -
trunk/src/world_entities/mount_point.h
r10534 r10540 31 31 void mount(PNode* entity); 32 32 void unmount(); 33 33 PNode* getMount() { return this->_mount; } 34 34 35 35 private: -
trunk/src/world_entities/npcs/npc.cc
r10539 r10540 52 52 #include "weapons/turret.h" 53 53 #include "weapons/cannon.h" 54 55 #include "mount_point.h" 56 #include "weapons/weapon_slot.h" 54 57 55 58 #include "npc.h" … … 169 172 170 173 this->getWeaponManager().setSlotCount(7); 174 175 176 // now get slots from the mount points 177 // const std::vector<MountPoint*>::const_iterator it = this->beginMountPoints(); 178 // std::vector<MountPoint*> list = this->getMountPoints(); 179 std::map<int, MountPoint*>::iterator it = this->mountPointMap.begin(); 180 // PRINTF(0)("\n\n\n\nsize: %i\n", this->mountPointMap.size()); 181 for( ;it != this->mountPointMap.end(); it++) 182 { 183 PRINTF(0)("5555555555 this npc got mountss\n\n\n"); 184 WeaponSlot* ws = dynamic_cast<WeaponSlot*>((*it).second->getMount()); 185 printf("more\n"); 186 if( ws != NULL && ws->isA(WeaponSlot::staticClassID())) 187 { 188 // 189 PRINTF(0)("5555555555 this npc got slots\n\n\n"); 190 191 this->getWeaponManager().setSlotPosition(ws->getWeaponSlot(), ws->getRelCoor()); 192 this->getWeaponManager().setSlotDirection(ws->getWeaponSlot(), ws->getRelDir()); 193 } 194 } 195 196 171 197 172 198 this->getWeaponManager().setSlotPosition(0, Vector(-2.6, .1, -3.0)); -
trunk/src/world_entities/world_entity.cc
r10537 r10540 416 416 { 417 417 // add the mount point at the last position 418 this->mountPoints.push_back(mountPoint); 418 // this->mountPointMap[](mountPoint); 419 assert(false); 419 420 } 420 421 … … 425 426 void WorldEntity::addMountPoint(int slot, MountPoint* mountPoint) 426 427 { 427 if( this->mountPoints.capacity() < (unsigned int)slot) 428 { 429 // reserve 5 more slots than needed so this function is called as rare as possible 430 this->mountPoints.reserve(slot + 5); 431 } 432 else if( this->mountPoints[slot] != NULL) 433 { 434 PRINTF(4)("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()); 428 if( this->mountPointMap.find(slot) == this->mountPointMap.end()) 429 { 430 PRINTF(2)("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()); 435 431 } 436 432 437 433 // just connect the mount point 438 this->mountPoint s[slot] = mountPoint;434 this->mountPointMap[slot] = mountPoint; 439 435 } 440 436 … … 446 442 void WorldEntity::mount(int slot, WorldEntity* entity) 447 443 { 448 if( this->mountPoint s[slot] == NULL)444 if( this->mountPointMap.find(slot) == this->mountPointMap.end()) 449 445 { 450 446 PRINTF(0)("you tried to add an entity to a mount point that doesn't exist (slot %i)\n", slot); -
trunk/src/world_entities/world_entity.h
r10511 r10540 62 62 void mount(int slot, WorldEntity* entity); 63 63 void unmount(int slot); 64 65 64 66 65 67 /** @param visibility if the Entity should be visible (been draw) */ … … 176 178 ; ///FIXME 177 179 void debugEntity() const; 178 180 179 181 void pauseTrack(bool stop); 180 182 … … 194 196 void updateHealthWidget(); 195 197 void addTrack(const TiXmlElement* root); 196 198 199 200 201 protected: 202 std::vector<MountPoint*> mountPoints; //!< A list with mount points for this model 203 std::map<int, MountPoint*> mountPointMap; 204 197 205 198 206 … … 206 214 std::vector<Model*> models; //!< The model that should be loaded for this entity. 207 215 ObjectInformationFile* oiFile; //!< Reference to the object information file discribing the model of this WE 208 std::vector<MountPoint*> mountPoints; //!< A list with mount points for this model209 216 std::string md2TextureFileName; //!< the file name of the md2 model texture, only if this 210 217 std::string modelLODName; //!< the name of the model lod file
Note: See TracChangeset
for help on using the changeset viewer.