]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/settings.h
Move ClientMap to clientmap.{h,cpp}
[dragonfireclient.git] / src / settings.h
index c08d54a4713ad3c696640ee5e1542f651f189040..b95fbd1845ef4f5eae88ba24f4160b587882134f 100644 (file)
@@ -145,11 +145,7 @@ class Settings
        {
                std::ifstream is(filename);
                if(is.good() == false)
-               {
-                       errorstream<<"Error opening configuration file \""
-                                       <<filename<<"\""<<std::endl;
                        return false;
-               }
 
                infostream<<"Parsing configuration file: \""
                                <<filename<<"\""<<std::endl;
@@ -334,6 +330,7 @@ class Settings
        bool parseCommandLine(int argc, char *argv[],
                        core::map<std::string, ValueSpec> &allowed_options)
        {
+               int nonopt_index = 0;
                int i=1;
                for(;;)
                {
@@ -342,6 +339,15 @@ class Settings
                        std::string argname = argv[i];
                        if(argname.substr(0, 2) != "--")
                        {
+                               // If option doesn't start with -, read it in as nonoptX
+                               if(argname[0] != '-'){
+                                       std::string name = "nonopt";
+                                       name += itos(nonopt_index);
+                                       set(name, argname);
+                                       nonopt_index++;
+                                       i++;
+                                       continue;
+                               }
                                errorstream<<"Invalid command-line parameter \""
                                                <<argname<<"\": --<option> expected."<<std::endl;
                                return false;
@@ -429,8 +435,6 @@ class Settings
                        n = m_defaults.find(name);
                        if(n == NULL)
                        {
-                               infostream<<"Settings: Setting not found: \""
-                                               <<name<<"\""<<std::endl;
                                throw SettingNotFoundException("Setting not found");
                        }
                }