Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 5, 2009, 1:36:33 AM (15 years ago)
Author:
rgrieder
Message:

Added GameMode::playsSound(). This function checks whether sound is available. You MUST NEVER assume that the SoundManager exists and ALWAYS check it (even if graphics is all loaded).
Also cleaned SoundManager c'tor to use Exceptions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/orxonox/gamestates/GSMainMenu.cc

    r5876 r5878  
    5959        // and a Camera
    6060        this->camera_ = this->scene_->getSceneManager()->createCamera("mainMenu/Camera");
    61         // Load sound
    62         this->ambient_ = new SoundMainMenu();
     61        if (GameMode::playsSound())
     62        {
     63            // Load sound
     64            this->ambient_ = new SoundMainMenu();
     65        }
    6366    }
    6467
    6568    GSMainMenu::~GSMainMenu()
    6669    {
     70        if (GameMode::playsSound())
     71        {
     72            this->ambient_->destroy();
     73        }
     74
    6775        InputManager::getInstance().destroyState("mainMenu");
    6876
     
    8795        InputManager::getInstance().enterState("mainMenu");
    8896
    89         this->ambient_->play(true);
     97        if (GameMode::playsSound())
     98        {
     99            this->ambient_->play(true);
     100        }
    90101    }
    91102
    92103    void GSMainMenu::deactivate()
    93104    {
    94         this->ambient_->stop();
     105        if (GameMode::playsSound())
     106        {
     107            this->ambient_->stop();
     108        }
    95109
    96110        InputManager::getInstance().leaveState("mainMenu");
Note: See TracChangeset for help on using the changeset viewer.