Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5440 in orxonox.OLD for trunk/src/world_entities/weapons


Ignore:
Timestamp:
Oct 27, 2005, 10:56:58 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Weapons update, Now one can really assign SlotCapabilities
Debug-redesign (small)

Location:
trunk/src/world_entities/weapons
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/weapons/turret.cc

    r5414 r5440  
    9797  this->setEmissionPoint(1.684, 0.472, 0);
    9898  //this->getProjectileFactory()->prepare(100);
    99 
    100 
    10199}
    102100
     
    140138  if (target != NULL)
    141139  {
    142     pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*100.0   /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
     140    pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*100.0 + VECTOR_RAND(20)
     141            /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
    143142  }
    144143  else
     
    148147  pj->setAbsCoor(this->getEmissionPoint());
    149148  pj->setAbsDir(this->getAbsDir());
     149
    150150  State::getWorldEntityList()->add(pj);
    151151}
    152 
    153152
    154153void Turret::destroy ()
  • trunk/src/world_entities/weapons/weapon_manager.cc

    r5435 r5440  
    220220  if (unlikely(configID >= WM_MAX_CONFIGS || slotID >= (int)this->slotCount))
    221221  {
    222     PRINTF(2)("Slot %d of config %d is not availiabe\n", slotID, configID);
     222    PRINTF(2)("Slot %d of config %d is not availiabe (max: %d)\n", slotID, configID, this->slotCount);
    223223    return;
    224224  }
     
    238238
    239239  //! @todo check if the weapon is already assigned to another config in another slot
    240 
    241240  this->configs[configID][slotID] = weapon;
    242241  if (this->parent != NULL)
     
    403402 * @param the selected weaponconfig
    404403 */
    405 int WeaponManager::getNextFreeSlot(int configID)
     404int WeaponManager::getNextFreeSlot(int configID, long capability)
    406405{
    407406  for( int i = 0; i < this->slotCount; ++i)
    408407  {
    409     if( this->configs[configID][i] == NULL)
     408    if( this->configs[configID][i] == NULL &&
     409        (this->currentSlotConfig[i].capability & capability == this->currentSlotConfig[i].capability))
    410410      return i;
    411411  }
  • trunk/src/world_entities/weapons/weapon_manager.h

    r5435 r5440  
    8787
    8888  private:
    89     int getNextFreeSlot(int configID);
     89    int getNextFreeSlot(int configID, long capability = WTYPE_ALL);
    9090
    9191  private:
Note: See TracChangeset for help on using the changeset viewer.