projects
/
oweals
/
minetest.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Reworked the inventory move handling code, hopefully fixed more problems than caused
[oweals/minetest.git]
/
src
/
settings.h
diff --git
a/src/settings.h
b/src/settings.h
index e8f376938676ecee172f247e189325098ac47c06..4bc22eaa1e08f47682108872b272a7790dc246d4 100644
(file)
--- a/
src/settings.h
+++ b/
src/settings.h
@@
-31,6
+31,7
@@
with this program; if not, write to the Free Software Foundation, Inc.,
#include <sstream>
#include "debug.h"
#include "utility.h"
#include <sstream>
#include "debug.h"
#include "utility.h"
+#include "log.h"
enum ValueType
{
enum ValueType
{
@@
-77,11
+78,11
@@
public:
std::string trimmedline = trim(line);
std::string trimmedline = trim(line);
- // Ignore comments
- if(trimmedline[0] == '#')
+ // Ignore
empty lines and
comments
+ if(trimmedline
.size() == 0 || trimmedline
[0] == '#')
return true;
return true;
- //
d
stream<<"trimmedline=\""<<trimmedline<<"\""<<std::endl;
+ //
info
stream<<"trimmedline=\""<<trimmedline<<"\""<<std::endl;
Strfnd sf(trim(line));
Strfnd sf(trim(line));
@@
-94,7
+95,7
@@
public:
std::string value = sf.next("\n");
value = trim(value);
std::string value = sf.next("\n");
value = trim(value);
- /*
d
stream<<"Config name=\""<<name<<"\" value=\""
+ /*
info
stream<<"Config name=\""<<name<<"\" value=\""
<<value<<"\""<<std::endl;*/
m_settings[name] = value;
<<value<<"\""<<std::endl;*/
m_settings[name] = value;
@@
-130,7
+131,7
@@
public:
*/
std::string line;
std::getline(is, line);
*/
std::string line;
std::getline(is, line);
- //
d
stream<<"got line: \""<<line<<"\""<<std::endl;
+ //
info
stream<<"got line: \""<<line<<"\""<<std::endl;
return parseConfigLine(line);
}
return parseConfigLine(line);
}
@@
-145,12
+146,12
@@
public:
std::ifstream is(filename);
if(is.good() == false)
{
std::ifstream is(filename);
if(is.good() == false)
{
-
d
stream<<"Error opening configuration file \""
+
error
stream<<"Error opening configuration file \""
<<filename<<"\""<<std::endl;
return false;
}
<<filename<<"\""<<std::endl;
return false;
}
-
d
stream<<"Parsing configuration file: \""
+
info
stream<<"Parsing configuration file: \""
<<filename<<"\""<<std::endl;
while(parseConfigObject(is));
<<filename<<"\""<<std::endl;
while(parseConfigObject(is));
@@
-188,8
+189,8
@@
public:
if(is.eof() == false)
line_end = "\n";
if(is.eof() == false)
line_end = "\n";
- // Ignore comments
- if(trimmedline[0] == '#')
+ // Ignore
empty lines and
comments
+ if(trimmedline
.size() == 0 || trimmedline
[0] == '#')
{
dst.push_back(line+line_end);
return true;
{
dst.push_back(line+line_end);
return true;
@@
-215,7
+216,7
@@
public:
if(newvalue != value)
{
if(newvalue != value)
{
-
d
stream<<"Changing value of \""<<name<<"\" = \""
+
info
stream<<"Changing value of \""<<name<<"\" = \""
<<value<<"\" -> \""<<newvalue<<"\""
<<std::endl;
}
<<value<<"\" -> \""<<newvalue<<"\""
<<std::endl;
}
@@
-235,7
+236,7
@@
public:
*/
bool updateConfigFile(const char *filename)
{
*/
bool updateConfigFile(const char *filename)
{
-
d
stream<<"Updating configuration file: \""
+
info
stream<<"Updating configuration file: \""
<<filename<<"\""<<std::endl;
core::list<std::string> objects;
<<filename<<"\""<<std::endl;
core::list<std::string> objects;
@@
-246,7
+247,7
@@
public:
std::ifstream is(filename);
if(is.good() == false)
{
std::ifstream is(filename);
if(is.good() == false)
{
-
dstream<<"INFO:
updateConfigFile():"
+
infostream<<"
updateConfigFile():"
" Error opening configuration file"
" for reading: \""
<<filename<<"\""<<std::endl;
" Error opening configuration file"
" for reading: \""
<<filename<<"\""<<std::endl;
@@
-264,7
+265,7
@@
public:
std::ofstream os(filename);
if(os.good() == false)
{
std::ofstream os(filename);
if(os.good() == false)
{
-
d
stream<<"Error opening configuration file"
+
error
stream<<"Error opening configuration file"
" for writing: \""
<<filename<<"\""<<std::endl;
return false;
" for writing: \""
<<filename<<"\""<<std::endl;
return false;
@@
-291,7
+292,7
@@
public:
continue;
std::string name = i.getNode()->getKey();
std::string value = i.getNode()->getValue();
continue;
std::string name = i.getNode()->getKey();
std::string value = i.getNode()->getValue();
-
d
stream<<"Adding \""<<name<<"\" = \""<<value<<"\""
+
info
stream<<"Adding \""<<name<<"\" = \""<<value<<"\""
<<std::endl;
os<<name<<" = "<<value<<"\n";
}
<<std::endl;
os<<name<<" = "<<value<<"\n";
}
@@
-316,7
+317,7
@@
public:
std::string argname = argv[i];
if(argname.substr(0, 2) != "--")
{
std::string argname = argv[i];
if(argname.substr(0, 2) != "--")
{
-
d
stream<<"Invalid command-line parameter \""
+
error
stream<<"Invalid command-line parameter \""
<<argname<<"\": --<option> expected."<<std::endl;
return false;
}
<<argname<<"\": --<option> expected."<<std::endl;
return false;
}
@@
-328,7
+329,7
@@
public:
n = allowed_options.find(name);
if(n == NULL)
{
n = allowed_options.find(name);
if(n == NULL)
{
-
d
stream<<"Unknown command-line parameter \""
+
error
stream<<"Unknown command-line parameter \""
<<argname<<"\""<<std::endl;
return false;
}
<<argname<<"\""<<std::endl;
return false;
}
@@
-345,7
+346,7
@@
public:
{
if(i >= argc)
{
{
if(i >= argc)
{
-
d
stream<<"Invalid command-line parameter \""
+
error
stream<<"Invalid command-line parameter \""
<<name<<"\": missing value"<<std::endl;
return false;
}
<<name<<"\": missing value"<<std::endl;
return false;
}
@@
-354,7
+355,7
@@
public:
}
}
-
d
stream<<"Valid command-line parameter: \""
+
info
stream<<"Valid command-line parameter: \""
<<name<<"\" = \""<<value<<"\""
<<std::endl;
set(name, value);
<<name<<"\" = \""<<value<<"\""
<<std::endl;
set(name, value);
@@
-403,7
+404,7
@@
public:
n = m_defaults.find(name);
if(n == NULL)
{
n = m_defaults.find(name);
if(n == NULL)
{
-
dstream<<"INFO:
Settings: Setting not found: \""
+
infostream<<"
Settings: Setting not found: \""
<<name<<"\""<<std::endl;
throw SettingNotFoundException("Setting not found");
}
<<name<<"\""<<std::endl;
throw SettingNotFoundException("Setting not found");
}