Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6197


Ignore:
Timestamp:
Dec 2, 2009, 2:58:20 PM (15 years ago)
Author:
dafrick
Message:

Small adjustments, better code re-use, added getConfig() function to get values of config values.

Location:
code/branches/presentation2/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/libraries/core/ConfigFileManager.cc

    r5929 r6197  
    5656        }
    5757        return false;
     58    }
     59   
     60    std::string getConfig(const std::string& classname, const std::string& varname)
     61    {
     62        return ConfigFileManager::getInstance().getValue(ConfigFileType::Settings, classname, varname, "", true);
    5863    }
    5964
  • code/branches/presentation2/src/libraries/core/ConfigFileManager.h

    r6194 r6197  
    5757
    5858    _CoreExport bool config(const std::string& classname, const std::string& varname, const std::string& value); // tolua_export
     59    _CoreExport std::string getConfig(const std::string& classname, const std::string& varname); // tolua_export
    5960    _CoreExport bool tconfig(const std::string& classname, const std::string& varname, const std::string& value);
    6061    _CoreExport void reloadConfig();
  • code/branches/presentation2/src/orxonox/sound/SoundManager.cc

    r6190 r6197  
    163163    void SoundManager::checkSoundVolumeValidity()
    164164    {
    165         if(this->soundVolume_ < 0.0 || this->soundVolume_ > 1.0)
    166         {
    167             COUT(2) << "Sound warning: Sound volume out of range, ignoring change." << std::endl;
     165        if(!checkVolumeValidity(SoundType::none))
     166        {
    168167            ResetConfigValue(soundVolume_);
    169168        }
    170        
    171         this->updateVolume(SoundType::none);
    172         COUT(3) << "SoundManager: volume set to " << this->soundVolume_ << std::endl;
    173            
    174169    }
    175170   
    176171    void SoundManager::checkAmbientVolumeValidity()
    177172    {
    178         if(this->ambientVolume_ < 0.0 || this->ambientVolume_ > 1.0)
    179         {
    180             COUT(2) << "Sound warning: Sound volume out of range, ignoring change." << std::endl;
     173        if(!checkVolumeValidity(SoundType::ambient))
     174        {
    181175            ResetConfigValue(ambientVolume_);
    182176        }
    183        
    184         this->updateVolume(SoundType::ambient);
    185         COUT(3) << "SoundManager: volume set to " << this->ambientVolume_ << std::endl;
    186177    }
    187178   
    188179    void SoundManager::checkEffectsVolumeValidity()
    189180    {
    190         if(this->effectsVolume_ < 0.0 || this->effectsVolume_ > 1.0)
    191         {
    192             COUT(2) << "Sound warning: Sound volume out of range, ignoring change." << std::endl;
     181        if(!checkVolumeValidity(SoundType::effects))
     182        {
    193183            ResetConfigValue(effectsVolume_);
    194184        }
    195        
    196         this->updateVolume(SoundType::effects);
    197         COUT(3) << "SoundManager: volume set to " << this->effectsVolume_ << std::endl;
    198     }
    199    
    200 //     void SoundManager::checkSoundVolumeValidity()
    201 //     {
    202 //         if(!checkVolumeValidity(SoundType::none))
    203 //             ResetConfigValue(soundVolume_)
    204 //     }
    205 //     
    206 //     void SoundManager::checkAmbientVolumeValidity()
    207 //     {
    208 //         if(!checkVolumeValidity(SoundType::ambient))
    209 //             ResetConfigValue(ambientVolume_);
    210 //     }
    211 //     
    212 //     void SoundManager::checkEffectsVolumeValidity()
    213 //     {
    214 //         if(!checkVolumeValidity(SoundType::effects))
    215 //             ResetConfigValue(effectsVolume_);
    216 //     }
     185    }
    217186
    218187    void SoundManager::setListenerPosition(const Vector3& position)
Note: See TracChangeset for help on using the changeset viewer.