Jeck - Quick fix to issue 198, options loading. Unknown options are now preserved: this should prevent any future options lossage... assuming the file loads properly.

This commit is contained in:
wagic.jeck
2009-11-19 01:58:18 +00:00
parent 68ecdb0d05
commit 0085c9b548
2 changed files with 7 additions and 1 deletions

View File

@@ -163,6 +163,7 @@ class GameOptions {
private:
vector<GameOption*> values;
vector<string> unknown;
};
class GameSettings{

View File

@@ -273,8 +273,10 @@ int GameOptions::load(){
string name = s.substr(0,found);
string val = s.substr(found+1);
int id = Options::getID(name);
if(id == INVALID_OPTION)
if(id == INVALID_OPTION){
unknown.push_back(s);
continue;
}
(*this)[id].read(val);
}
@@ -306,6 +308,9 @@ int GameOptions::save(){
opt->write(&file, name);
}
for(vector<string>::size_type t=0;t<unknown.size();t++){
file<<unknown[t]<<"\n";
}
file.close();
}
return 1;