Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10546 in orxonox.OLD for trunk/src/world_entities/npcs


Ignore:
Timestamp:
Jan 31, 2007, 5:44:06 AM (17 years ago)
Author:
patrick
Message:

debug, and better slot pos

Location:
trunk/src/world_entities/npcs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/npcs/npc.cc

    r10545 r10546  
    195195
    196196
    197   // now get slots from the mount points
    198   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   }
    211197
    212198  this->getWeaponManager().getFixedTarget()->setParent(this);
    213199  this->getWeaponManager().getFixedTarget()->setRelCoor(100000,0,0);
     200  this->bInit = false;
    214201}
    215202
     
    411398void NPC::tick(float dt)
    412399{
     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
    413422  this->weaponMan.tick(dt);
    414423  if (this->bFire)
  • trunk/src/world_entities/npcs/npc.h

    r10545 r10546  
    5757  WeaponManager         weaponMan;    //!< weapon manager
    5858  bool                  bFire;        //!< fire
     59  bool                  bInit;
    5960
    6061  AIModule*             aiModule;
Note: See TracChangeset for help on using the changeset viewer.