aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-11-29 14:13:57 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-11-29 19:13:57 +0200
commitc8211ceb3e3a9e28767e57a497f8912d6a6bdf5c (patch)
tree46a87bb762b71db8927a3dd20bcf8399b4019090 /src
parentc910ead4db55bca09764cda71cd24ee5aef9e93b (diff)
downloadminetest-c8211ceb3e3a9e28767e57a497f8912d6a6bdf5c.tar.gz
minetest-c8211ceb3e3a9e28767e57a497f8912d6a6bdf5c.tar.bz2
minetest-c8211ceb3e3a9e28767e57a497f8912d6a6bdf5c.zip
Some MSVC fixes
Diffstat (limited to 'src')
-rw-r--r--src/settings.h8
-rw-r--r--src/tile.cpp2
-rw-r--r--src/utility.h15
3 files changed, 14 insertions, 11 deletions
diff --git a/src/settings.h b/src/settings.h
index af010fe06..4bc22eaa1 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -78,8 +78,8 @@ public:
std::string trimmedline = trim(line);
- // Ignore comments
- if(trimmedline[0] == '#')
+ // Ignore empty lines and comments
+ if(trimmedline.size() == 0 || trimmedline[0] == '#')
return true;
//infostream<<"trimmedline=\""<<trimmedline<<"\""<<std::endl;
@@ -189,8 +189,8 @@ public:
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;
diff --git a/src/tile.cpp b/src/tile.cpp
index b6abc5427..bf0e264c6 100644
--- a/src/tile.cpp
+++ b/src/tile.cpp
@@ -1082,7 +1082,7 @@ bool generate_image(std::string part_of_name, video::IImage *& baseimg,
assert(driver);
// Stuff starting with [ are special commands
- if(part_of_name[0] != '[')
+ if(part_of_name.size() == 0 || part_of_name[0] != '[')
{
video::IImage *image = sourcecache->getOrLoad(part_of_name, device);
diff --git a/src/utility.h b/src/utility.h
index 97f902b99..4e469db89 100644
--- a/src/utility.h
+++ b/src/utility.h
@@ -967,7 +967,7 @@ inline bool is_yes(const std::string &s)
return false;
}
-inline s32 stoi(const std::string &s, s32 min, s32 max)
+inline s32 mystoi(const std::string &s, s32 min, s32 max)
{
s32 i = atoi(s.c_str());
if(i < min)
@@ -979,19 +979,19 @@ inline s32 stoi(const std::string &s, s32 min, s32 max)
// MSVC2010 includes it's own versions of these
-#if !defined(_MSC_VER) || _MSC_VER < 1600
+//#if !defined(_MSC_VER) || _MSC_VER < 1600
-inline s32 stoi(std::string s)
+inline s32 mystoi(std::string s)
{
return atoi(s.c_str());
}
-inline s32 stoi(std::wstring s)
+inline s32 mystoi(std::wstring s)
{
return atoi(wide_to_narrow(s).c_str());
}
-inline float stof(std::string s)
+inline float mystof(std::string s)
{
float f;
std::istringstream ss(s);
@@ -999,7 +999,10 @@ inline float stof(std::string s)
return f;
}
-#endif
+//#endif
+
+#define stoi mystoi
+#define stof mystof
inline std::string itos(s32 i)
{