Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5953 in orxonox.OLD for trunk/src/lib


Ignore:
Timestamp:
Dec 7, 2005, 1:58:39 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: ini_parser safer now

Location:
trunk/src/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/gui/gtk_gui/gui_audio.cc

    r5298 r5953  
    4242    {
    4343      CheckButton* enableSound; //!< A Ckeckbutton for enabling Sound.
     44      Slider* audioChannels;    //!< A Slider for the count of audio-channels.
    4445      Slider* musicVolume;      //!< A Slider for music volume.
    4546      Slider* effectsVolume;    //!< A Slider for effects volume.
     
    5152      enableSound->saveability();
    5253      audioBox->fill(enableSound);
     54
     55      Label* audioChannelsLabel = new Label(CONFIG_NAME_AUDIO_CHANNELS);
     56      audioBox->fill(audioChannelsLabel);
     57      audioChannels = new Slider(CONFIG_NAME_AUDIO_CHANNELS, 0, 32);
     58      audioChannels->setFlagName("channels", "c", 32);
     59      audioChannels->setDescription("Sets the count of channels in the game");
     60      audioChannels->saveability();
     61      audioBox->fill (audioChannels);
     62
     63
    5364      Label* musicVolumeLabel = new Label(CONFIG_NAME_MUSIC_VOLUME);
    5465      audioBox->fill(musicVolumeLabel);
     
    5869      musicVolume->saveability();
    5970      audioBox->fill (musicVolume);
     71
    6072      Label* effectsVolumeLabel = new Label (CONFIG_NAME_EFFECTS_VOLUME);
    6173      audioBox->fill (effectsVolumeLabel);
  • trunk/src/lib/parser/ini_parser/ini_parser.cc

    r5952 r5953  
    125125  FILE*    stream;           //< The stream we use to read the file.
    126126  int      lineCount = 0;    //< The Count of lines.
    127 
    128127
    129128  if (this->fileName != NULL)
     
    448447  {
    449448    std::list<IniEntry>::const_iterator entry = this->getEntryIT(entryName, sectionName);
    450     if (!strcmp((*entry).name, entryName))
     449    if (entry != NULL &&  !strcmp((*entry).name, entryName))
    451450      return (*entry).value;
    452451    PRINTF(2)("Entry '%s' in section '%s' not found.\n", entryName, sectionName);
     
    618617      if (!strcmp((*entry).name, entryName))
    619618        break;
    620   return entry;
     619  if (entry == (*section).entries.end())
     620    return NULL;
     621  else
     622    return entry;
    621623}
    622624
     
    638640      if (!strcmp((*entry).name, entryName))
    639641        break;
    640   return entry;
     642  if (entry == (*section).entries.end())
     643    return NULL;
     644  else
     645    return entry;
    641646}
    642647
  • trunk/src/lib/sound/sound_engine.cc

    r5944 r5953  
    9797void SoundEngine::loadSettings(IniParser* iniParser)
    9898{
     99  const char* channels = iniParser->getVar(CONFIG_NAME_AUDIO_CHANNELS, CONFIG_SECTION_AUDIO, "32");
     100  this->maxSourceCount = atoi(channels);
    99101  const char* musicVolume = iniParser->getVar(CONFIG_NAME_MUSIC_VOLUME, CONFIG_SECTION_AUDIO, "80");
    100102  this->musicVolume = atof(musicVolume)/100.0;
Note: See TracChangeset for help on using the changeset viewer.