Changeset 10678 in orxonox.OLD for branches/vs-enhencements/src/world_entities/weapons
- Timestamp:
- Jun 7, 2007, 5:59:39 PM (18 years ago)
- Location:
- branches/vs-enhencements/src/world_entities/weapons
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/vs-enhencements/src/world_entities/weapons/weapon_manager.cc
r10676 r10678 100 100 } 101 101 102 for (int i = 0; i < WM_MAX_LOADED_WEAPONS; i++)103 this->availiableWeapons[i] = NULL;102 // for (int i = 0; i < WM_MAX_LOADED_WEAPONS; i++) 103 // this->availiableWeapons[i] = NULL; 104 104 105 105 … … 287 287 } 288 288 289 // if (configID > 0 && slotID > 0 && this->configs[configID][slotID]!= NULL)290 //{291 //PRINTF(3)("Weapon-slot %d/%d of %s already poulated, remove weapon (%s::%s) first\n", configID, slotID, this->getCName(), weapon->getClassCName(), weapon->getCName());292 //return false;293 //}294 295 //if (slotID <= -1) // WM_FREE_SLOT296 //{297 //slotID = this->getNextFreeSlot(configID, weapon->getCapability());298 //if( slotID < 0 || slotID >= this->slotCount)299 //{300 //PRINTF(1)("There is no free slot in this WeaponConfig to dock this weapon at! Aborting\n");301 //return false;302 //}303 //}304 305 //if (!(this->slotConfigs[slotID]->getCapability() & weapon->getCapability() & WTYPE_ALLKINDS) &&306 //this->slotConfigs[slotID]->getCapability() & weapon->getCapability() & WTYPE_ALLDIRS)307 //{308 //PRINTF(2)("Unable to add Weapon with wrong capatibility to Slot %d (W:%d M:%d)\n",309 //slotID, weapon->getCapability(), this->slotConfigs[slotID]->getCapability());310 //return false;311 //}289 if (configID > 0 && slotID > 0 && this->slotConfigs[slotID]->getWeapon(configID) != NULL) 290 { 291 PRINTF(3)("Weapon-slot %d/%d of %s already poulated, remove weapon (%s::%s) first\n", configID, slotID, this->getCName(), weapon->getClassCName(), weapon->getCName()); 292 return false; 293 } 294 295 if (slotID <= -1) // WM_FREE_SLOT 296 { 297 slotID = this->getNextFreeSlot(configID, weapon->getCapability()); 298 if( slotID < 0 || slotID >= this->slotCount) 299 { 300 PRINTF(1)("There is no free slot in this WeaponConfig to dock this weapon at! Aborting\n"); 301 return false; 302 } 303 } 304 305 if (!(this->slotConfigs[slotID]->getCapability() & weapon->getCapability() & WTYPE_ALLKINDS) && 306 this->slotConfigs[slotID]->getCapability() & weapon->getCapability() & WTYPE_ALLDIRS) 307 { 308 PRINTF(2)("Unable to add Weapon with wrong capatibility to Slot %d (W:%d M:%d)\n", 309 slotID, weapon->getCapability(), this->slotConfigs[slotID]->getCapability()); 310 return false; 311 } 312 312 313 313 //! @todo check if the weapon is already assigned to another config in another slot … … 508 508 { 509 509 tickWeapon->toList(OM_NULL); 510 this->slotConfigs[i]->setCurrentWeapon( NULL);510 this->slotConfigs[i]->setCurrentWeapon(-1); 511 511 } 512 512 } … … 530 530 } 531 531 else if (unlikely(tickWeapon != NULL && tickWeapon->getCurrentState() == WS_DEACTIVATING)) 532 this->slotConfigs[i]->setCurrentWeapon( NULL);532 this->slotConfigs[i]->setCurrentWeapon(-1); 533 533 } 534 534 } -
branches/vs-enhencements/src/world_entities/weapons/weapon_manager.h
r10676 r10678 125 125 // WeaponSlot* currentSlotConfig[WM_MAX_SLOTS]; //!< The currentConfigureation. 126 126 WeaponSlot* slotConfigs[WM_MAX_SLOTS]; 127 Weapon* availiableWeapons[WM_MAX_LOADED_WEAPONS]; //!< The availiable Weapons of this WeaponSlot127 // Weapon* availiableWeapons[WM_MAX_LOADED_WEAPONS]; //!< The availiable Weapons of this WeaponSlot 128 128 129 129 bool weaponChange; -
branches/vs-enhencements/src/world_entities/weapons/weapon_slot.h
r10676 r10678 32 32 33 33 inline Weapon* getCurrentWeapon() { return this->currentWeapon; } 34 inline void setCurrentWeapon(int config) { this->currentWeapon = this->configs[config]; }34 inline void setCurrentWeapon(int config) { config == -1 ? this->currentWeapon = NULL: this->currentWeapon = this->configs[config]; } 35 35 36 36 inline Weapon* getNextWeapon() { return this->nextWeapon; } 37 inline void setNextWeapon(int config) { if (config == -1) this->nextWeapon = NULL; elsethis->nextWeapon = configs[config]; }37 inline void setNextWeapon(int config) { config == -1 ? this->nextWeapon = NULL : this->nextWeapon = configs[config]; } 38 38 39 39 inline void setNextToCurrent() {this->currentWeapon = this->nextWeapon; };
Note: See TracChangeset
for help on using the changeset viewer.