Changeset 5441 in orxonox.OLD for trunk/src/world_entities/weapons
- Timestamp:
- Oct 27, 2005, 11:46:46 PM (19 years ago)
- Location:
- trunk/src/world_entities/weapons
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/weapons/test_gun.cc
r5382 r5441 134 134 this->setActionSound(WA_SHOOT, "sound/shot1.wav"); 135 135 136 this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 136 137 this->setProjectileType(CL_TEST_BULLET); 137 138 this->prepareProjectiles(20); -
trunk/src/world_entities/weapons/turret.cc
r5440 r5441 91 91 //this->minCharge = 2; 92 92 93 93 this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET); 94 94 this->setProjectileType(CL_TEST_BULLET); 95 95 -
trunk/src/world_entities/weapons/weapon.cc
r5357 r5441 94 94 this->energy = .0; 95 95 this->energyMax = 10.0; 96 this->capability = WTYPE_ALL; 96 97 97 98 this->setWeaponManager(NULL); -
trunk/src/world_entities/weapons/weapon.h
r5356 r5441 106 106 107 107 // FUNCTIONS TO SET THE WEAPONS PROPERTIES. 108 /** sets the Weapons Capabilities */ 109 inline void setCapability(long capabilities) { this->capability = capabilities; }; 110 /** @returns the Capabilities of this Weapon */ 111 inline long getCapability() { return this->capability; }; 108 112 void setProjectileType(ClassID projectile); 109 113 void setProjectileType(const char* projectile); … … 185 189 186 190 private: 191 // type of Weapon 192 long capability; //!< what capabilities the Weapon has @see W_Capability 193 187 194 // it is all about energy 188 195 float energy; //!< The energy stored in the weapons secondary buffers (reserve) -
trunk/src/world_entities/weapons/weapon_manager.cc
r5440 r5441 229 229 if (slotID == -1) // WM_FREE_SLOT 230 230 { 231 slotID = this->getNextFreeSlot(configID );231 slotID = this->getNextFreeSlot(configID, weapon->getCapability()); 232 232 if( slotID < 0 || slotID >= this->slotCount) 233 233 { 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"); 235 235 return; 236 236 } 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; 237 245 } 238 246 … … 407 415 { 408 416 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)) 410 419 return i; 411 420 }
Note: See TracChangeset
for help on using the changeset viewer.