void GameConfig::loadSettings(const INI::Section& section, std::vector<ConfigVariable*>& settings) { try { std::vector<ConfigVariable*>::iterator i; for(i = settings.begin(); i != settings.end(); i++) { ConfigVariable* var = *i; try { ConfigInt* confint = dynamic_cast<ConfigInt*> (var); if(confint) { *confint = section.getIntValue(confint->getName()); continue; } ConfigXY* confxy = dynamic_cast<ConfigXY*> (var); if(confxy) { confxy->set(section.getIntValue(confxy->getName() + "_x"), section.getIntValue(confxy->getName() + "_y")); continue; } ConfigBool* confbool = dynamic_cast<ConfigBool*> (var); if(confbool) { std::string str = section.getValue(confbool->getName()); if(str == "yes" || str == "1" || str == "on") *confbool = true; else if(str == "no" || str == "0" || str == "off") *confbool = false; else throw Exception("No boolean value for setting '%s'.", confbool->getName().c_str()); continue; } ConfigStringSpecialChars* confstringspecial = dynamic_cast<ConfigStringSpecialChars*> (var); if(confstringspecial) { *confstringspecial = section.getValue(confstringspecial->getName()); continue; } ConfigString* confstring = dynamic_cast<ConfigString*> (var); if(confstring) *confstring = section.getValue(confstring->getName()); // we have a value from config file in the variable now //var->setNonDefaultValue(); // now each subclass changethis if the value has been changed } catch(std::exception& e) { LOG(("Skipping config '%s': %s", var->getName().c_str(), e.what())); } } } catch(std::exception& e) { LOG(("Couldn't find config section '%s', skipping...", section.getName().c_str())); } }