Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 10, 2009, 8:49:33 AM (15 years ago)
Author:
scheusso
Message:

further network fixes
changed screenshot format from jpeg to tiff (lossless)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/orxonox/items/MultiStateEngine.cc

    r6222 r6313  
    5555        RegisterObject(MultiStateEngine);
    5656
    57         this->defEngineSndNormal_ = new WorldSound(this);
    58         this->defEngineSndBoost_ = new WorldSound(this);
    59         this->defEngineSndNormal_->setLooping(true);
    60         this->defEngineSndBoost_->setLooping(true);
     57        if( GameMode::isMaster() )
     58        {
     59            this->defEngineSndNormal_ = new WorldSound(this);
     60            this->defEngineSndBoost_ = new WorldSound(this);
     61            this->defEngineSndNormal_->setLooping(true);
     62            this->defEngineSndBoost_->setLooping(true);
     63        }
     64        else
     65        {
     66            this->defEngineSndBoost_ = 0;
     67            this->defEngineSndNormal_ = 0;
     68        }
    6169
    6270        this->lua_ = new LuaState();
     
    7482                for (std::vector<WorldEntity*>::const_iterator it2 = (*it)->getEffectsBegin(); it2 != (*it)->getEffectsBegin(); ++it2)
    7583                    (*it2)->destroy();
    76             delete this->defEngineSndNormal_;
    77             delete this->defEngineSndBoost_;
     84            if( this->defEngineSndNormal_ )
     85                delete this->defEngineSndNormal_;
     86            if( this->defEngineSndBoost_  )
     87                delete this->defEngineSndBoost_;
    7888            delete this->lua_;
    7989        }
     
    97107        if (this->getShip())
    98108        {
    99             if (this->getShip()->hasLocalController())
     109//             if (this->getShip()->hasLocalController())
     110            if (GameMode::isMaster() && this->getShip()->hasLocalController())
    100111            {
    101112                this->setSyncMode(ObjectDirection::Bidirectional);
     
    192203            return;
    193204
    194         this->getShip()->attach(defEngineSndNormal_);
    195         this->getShip()->attach(defEngineSndBoost_);
     205        if( this->defEngineSndNormal_ )
     206            this->getShip()->attach(defEngineSndNormal_);
     207        if( this->defEngineSndBoost_ )
     208            this->getShip()->attach(defEngineSndBoost_);
    196209
    197210        for (std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it)
     
    226239    void MultiStateEngine::setDefEngSndNormal(const std::string &engineSound)
    227240    {
    228         defEngineSndNormal_->setSource(engineSound);
     241        if( defEngineSndNormal_ )
     242            defEngineSndNormal_->setSource(engineSound);
     243        else
     244            assert(0); // This should never happen, because soundpointer is only available on master
    229245    }
    230246
    231247    const std::string& MultiStateEngine::getDefEngSndNormal()
    232248    {
    233         return defEngineSndNormal_->getSource();
     249        if( defEngineSndNormal_ )
     250            return defEngineSndNormal_->getSource();
     251        else
     252            assert(0);
     253        return std::string();
    234254    }
    235255
    236256    void MultiStateEngine::setDefEngSndBoost(const std::string &engineSound)
    237257    {
    238         defEngineSndBoost_->setSource(engineSound);
     258        if( defEngineSndBoost_ )
     259            defEngineSndBoost_->setSource(engineSound);
     260        else
     261            assert(0);
    239262    }
    240263
    241264    const std::string& MultiStateEngine::getDefEngSndBoost()
    242265    {
    243         return defEngineSndBoost_->getSource();
     266        if( this->defEngineSndBoost_ )
     267            return defEngineSndBoost_->getSource();
     268        else
     269            assert(0);
     270        return std::string();
    244271    }
    245272}
Note: See TracChangeset for help on using the changeset viewer.