Changeset 6307 for code/branches/presentation2/src/orxonox/weaponsystem
- Timestamp:
- Dec 9, 2009, 10:09:27 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/orxonox/weaponsystem/WeaponMode.cc
r6265 r6307 71 71 this->muzzleOrientation_ = Quaternion::IDENTITY; 72 72 73 this->defSndWpnFire_ = new WorldSound(this); 74 this->defSndWpnFire_->setLooping(false); 75 this->bSoundAttached_ = false; 73 if( GameMode::isMaster() ) 74 { 75 this->defSndWpnFire_ = new WorldSound(this); 76 this->defSndWpnFire_->setLooping(false); 77 this->bSoundAttached_ = false; 78 } 79 else 80 this->defSndWpnFire_ = 0; 76 81 } 77 82 … … 80 85 if(this->isInitialized()) 81 86 { 82 delete this->defSndWpnFire_; 87 if( this->defSndWpnFire_ ) 88 delete this->defSndWpnFire_; 83 89 } 84 90 } … … 106 112 { 107 113 (*reloadTime) = this->reloadTime_; 108 if( !this->bSoundAttached_ )114 if( !this->bSoundAttached_ && GameMode::isMaster() ) 109 115 { 110 116 assert(this->getWeapon() && this->getWeapon()->getWeaponSlot()); … … 130 136 this->reloadTimer_.startTimer(); 131 137 132 if( !(this->defSndWpnFire_->isPlaying()))138 if( this->defSndWpnFire_ && !(this->defSndWpnFire_->isPlaying())) 133 139 { 134 140 this->defSndWpnFire_->play(); … … 222 228 void WeaponMode::reloaded() 223 229 { 224 if( this->defSndWpnFire_->isPlaying())230 if( this->defSndWpnFire_ && this->defSndWpnFire_->isPlaying()) 225 231 { 226 232 this->defSndWpnFire_->stop(); … … 257 263 void WeaponMode::setDefaultSound(const std::string& soundPath) 258 264 { 259 this->defSndWpnFire_->setSource(soundPath); 265 if( this->defSndWpnFire_ ) 266 this->defSndWpnFire_->setSource(soundPath); 260 267 } 261 268 262 269 const std::string& WeaponMode::getDefaultSound() 263 270 { 264 return this->defSndWpnFire_->getSource(); 271 if( this->defSndWpnFire_ ) 272 return this->defSndWpnFire_->getSource(); 273 else 274 return std::string(); 265 275 } 266 276 }
Note: See TracChangeset
for help on using the changeset viewer.