- Timestamp:
- Jan 31, 2007, 5:44:06 AM (18 years ago)
- Location:
- trunk/src/world_entities
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/mount_point.cc
r10542 r10546 190 190 else if( obj->isA( WeaponSlot::staticClassID())) 191 191 { 192 // PRINTF(0)("=========+>we got a weapon slot\n"); 192 PRINTF(0)("=========+>we got a weapon slot at\n"); 193 this->getRelCoor().debug(); 194 193 195 194 196 // cast down the object to WE … … 196 198 197 199 // now set the position, direction and reparent it to this node 198 this->_mount->set AbsCoor( this->getAbsCoor());199 this->_mount->set AbsDir( this->getAbsDir());200 this->_mount->setRelCoor( this->getRelCoor()); 201 this->_mount->setRelDir( this->getRelDir()); 200 202 this->_mount->setParent( this); 201 203 } -
trunk/src/world_entities/npcs/npc.cc
r10545 r10546 195 195 196 196 197 // now get slots from the mount points198 std::map<int, MountPoint*>::iterator it = this->mountPointMap.begin();199 for( ;it != this->mountPointMap.end(); it++)200 {201 WeaponSlot* ws = dynamic_cast<WeaponSlot*>((*it).second->getMount());202 if( ws != NULL && ws->isA(WeaponSlot::staticClassID()))203 {204 int slot = ws->getWeaponSlot();205 int side = ws->getWeaponSide();206 this->getWeaponManager().setSlotPosition(slot, ws->getRelCoor());207 this->getWeaponManager().setSlotDirection(slot, ws->getRelDir());208 PRINTF(0)("setting slot %i\n", slot);209 }210 }211 197 212 198 this->getWeaponManager().getFixedTarget()->setParent(this); 213 199 this->getWeaponManager().getFixedTarget()->setRelCoor(100000,0,0); 200 this->bInit = false; 214 201 } 215 202 … … 411 398 void NPC::tick(float dt) 412 399 { 400 if( !this->bInit) 401 { 402 // now get slots from the mount points 403 std::map<int, MountPoint*>::iterator it = this->mountPointMap.begin(); 404 for( ;it != this->mountPointMap.end(); it++) 405 { 406 WeaponSlot* ws = dynamic_cast<WeaponSlot*>((*it).second->getMount()); 407 if( ws != NULL && ws->isA(WeaponSlot::staticClassID())) 408 { 409 int slot = ws->getWeaponSlot(); 410 int side = ws->getWeaponSide(); 411 this->getWeaponManager().setSlotPosition(slot, ws->getRelCoor()); 412 this->getWeaponManager().setSlotDirection(slot, ws->getRelDir()); 413 PRINTF(0)("setting slot %i\n", slot); 414 ws->getRelCoor().debug(); 415 } 416 } 417 this->bInit = true; 418 } 419 420 421 413 422 this->weaponMan.tick(dt); 414 423 if (this->bFire) -
trunk/src/world_entities/npcs/npc.h
r10545 r10546 57 57 WeaponManager weaponMan; //!< weapon manager 58 58 bool bFire; //!< fire 59 bool bInit; 59 60 60 61 AIModule* aiModule; -
trunk/src/world_entities/world_entity.cc
r10540 r10546 426 426 void WorldEntity::addMountPoint(int slot, MountPoint* mountPoint) 427 427 { 428 if( this->mountPointMap.find(slot) == this->mountPointMap.end())428 if( this->mountPointMap.find(slot) != this->mountPointMap.end()) 429 429 { 430 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()); … … 442 442 void WorldEntity::mount(int slot, WorldEntity* entity) 443 443 { 444 if( this->mountPointMap.find(slot) == this->mountPointMap.end())444 if( this->mountPointMap.find(slot) != this->mountPointMap.end()) 445 445 { 446 446 PRINTF(0)("you tried to add an entity to a mount point that doesn't exist (slot %i)\n", slot);
Note: See TracChangeset
for help on using the changeset viewer.