- Timestamp:
- Dec 3, 2008, 5:13:34 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/weapon2/src/orxonox/objects/weaponSystem/Weapon.cc
r2327 r2331 54 54 { 55 55 SUPER(Weapon, XMLPort, xmlelement, mode); 56 XMLPortParam(Weapon, "munitionType", setMunitionType, getMunitionType, xmlelement, mode); 56 57 } 57 58 … … 81 82 { 82 83 //if munition type already exists attach it, else create a new one of this type and attach it to the weapon and to the WeaponSystem 83 if ( this->parentWeaponSystem_->getMunitionType(munitionName) ) 84 this->munition_ = this->parentWeaponSystem_->getMunitionType(munitionName); 85 else 84 if (this->parentWeaponSystem_) 86 85 { 87 //create new munition with identifier 88 this->munitionIdentifier_ = ClassByString(munitionName); 89 this->munition_ = this->munitionIdentifier_.fabricate(this); 90 this->parentWeaponSystem_->setNewMunition(munitionName, this->munition_); 86 Munition* munition = this->parentWeaponSystem_->getMunitionType(munitionName); 87 if ( munition ) 88 this->munition_ = munition; 89 else 90 { 91 //create new munition with identifier 92 this->munitionIdentifier_ = ClassByString(munitionName); 93 this->munition_ = this->munitionIdentifier_.fabricate(this); 94 this->parentWeaponSystem_->setNewMunition(munitionName, this->munition_); 95 } 91 96 } 92 97 } … … 96 101 * 97 102 */ 103 104 void Weapon::setMunitionType(std::string munitionType) 105 { this->munitionType_ = munitionType; } 106 107 std::string Weapon::getMunitionType() 108 { return this->munitionType_; } 109 98 110 Munition * Weapon::getAttachedMunition() 99 111 { return this->munition_; }
Note: See TracChangeset
for help on using the changeset viewer.