Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 27, 2005, 11:46:46 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: Weapons update, Now one can really assign SlotCapabilities and they are used and checked

File:
1 edited

Legend:

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

    r5440 r5441  
    229229  if (slotID == -1) // WM_FREE_SLOT
    230230  {
    231     slotID = this->getNextFreeSlot(configID);
     231    slotID = this->getNextFreeSlot(configID, weapon->getCapability());
    232232    if( slotID < 0 || slotID >= this->slotCount)
    233233    {
    234       PRINTF(0)("There is no free slot in this WeaponConfig to dock this weapon at! Aborting\n");
     234      PRINTF(1)("There is no free slot in this WeaponConfig to dock this weapon at! Aborting\n");
    235235      return;
    236236    }
     237  }
     238
     239  if (!(this->currentSlotConfig[slotID].capability & weapon->getCapability() & WTYPE_ALLKINDS) &&
     240        this->currentSlotConfig[slotID].capability & weapon->getCapability() & WTYPE_ALLDIRS)
     241  {
     242    PRINTF(2)("Unable to add Weapon with wrong capatibility to Slot %d (W:%d M:%d)\n",
     243              slotID, weapon->getCapability(), this->currentSlotConfig[slotID].capability);
     244    return;
    237245  }
    238246
     
    407415  {
    408416    if( this->configs[configID][i] == NULL &&
    409         (this->currentSlotConfig[i].capability & capability == this->currentSlotConfig[i].capability))
     417        (this->currentSlotConfig[i].capability & capability & WTYPE_ALLKINDS) &&
     418        (this->currentSlotConfig[i].capability & capability & WTYPE_ALLDIRS))
    410419      return i;
    411420  }
Note: See TracChangeset for help on using the changeset viewer.