bool pawsConfigSound::SaveConfig()
{
    csString xml;
    xml = "<sound>\n";
    xml.AppendFmt("<ambient on=\"%s\" />\n",
                     ambient->GetState() ? "yes" : "no");
    xml.AppendFmt("<actions on=\"%s\" />\n",
                     actions->GetState() ? "yes" : "no");
    xml.AppendFmt("<music on=\"%s\" />\n",
                     music->GetState() ? "yes" : "no");
    xml.AppendFmt("<gui on=\"%s\" />\n",
                     gui->GetState() ? "yes" : "no");
    xml.AppendFmt("<voices on=\"%s\" />\n",
                     voices->GetState() ? "yes" : "no");
    xml.AppendFmt("<volume value=\"%d\" />\n",
                     int(generalVol->GetCurrentValue()));
    xml.AppendFmt("<musicvolume value=\"%d\" />\n",
                     int(musicVol->GetCurrentValue()));
    xml.AppendFmt("<ambientvolume value=\"%d\" />\n",
                     int(ambientVol->GetCurrentValue()));
    xml.AppendFmt("<actionsvolume value=\"%d\" />\n",
                     int(actionsVol->GetCurrentValue()));
    xml.AppendFmt("<guivolume value=\"%d\" />\n",
                     int(guiVol->GetCurrentValue()));
    xml.AppendFmt("<voicesvolume value=\"%d\" />\n",
                     int(voicesVol->GetCurrentValue()));
    xml.AppendFmt("<muteonfocusloss on=\"%s\" />\n",
                     muteOnFocusLoss->GetState() ? "yes" : "no");
    xml.AppendFmt("<loopbgm on=\"%s\" />\n",
                     loopBGM->GetState() ? "yes" : "no");
    xml.AppendFmt("<combatmusic on=\"%s\" />\n",
                     combatMusic->GetState() ? "yes" : "no");
    xml.AppendFmt("<chatsound on=\"%s\" />\n",
                     chatSound->GetState() ? "yes" : "no");
               
    if (csStrCaseCmp(soundLocation->GetSelectedRowString(), "Camera") == 0)
    {
        xml.AppendFmt("<usecamerapos on=\"%s\" />\n", "yes");
    }
    else
    {
        xml.AppendFmt("<usecamerapos on=\"%s\" />\n", "no");
    }
    xml += "</sound>\n";

    dirty = false;

    return psengine->GetVFS()->WriteFile("/planeshift/userdata/options/sound.xml",
                                         xml,xml.Length());
}
Beispiel #2
0
pawsListBoxRow* pawsComboBox::Select(const char * text)
{
    pawsListBoxRow *row;
    for (unsigned int i = 0; i < listChoice->GetRowCount(); i++ )
    {
        row = listChoice->GetRow(i);
        pawsTextBox* thing = dynamic_cast <pawsTextBox*> (row->GetColumn(0));
        if ( thing )
        {
            if ( !csStrCaseCmp(thing->GetText(), text) )
            {
                return Select( i );
            }
        }
    }
    Select( -1 );
    return NULL;
}