mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 19:43:45 +01:00
Some MSVC fixes
This commit is contained in:
parent
c910ead4db
commit
c8211ceb3e
@ -78,8 +78,8 @@ public:
|
|||||||
|
|
||||||
std::string trimmedline = trim(line);
|
std::string trimmedline = trim(line);
|
||||||
|
|
||||||
// Ignore comments
|
// Ignore empty lines and comments
|
||||||
if(trimmedline[0] == '#')
|
if(trimmedline.size() == 0 || trimmedline[0] == '#')
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//infostream<<"trimmedline=\""<<trimmedline<<"\""<<std::endl;
|
//infostream<<"trimmedline=\""<<trimmedline<<"\""<<std::endl;
|
||||||
@ -189,8 +189,8 @@ public:
|
|||||||
if(is.eof() == false)
|
if(is.eof() == false)
|
||||||
line_end = "\n";
|
line_end = "\n";
|
||||||
|
|
||||||
// Ignore comments
|
// Ignore empty lines and comments
|
||||||
if(trimmedline[0] == '#')
|
if(trimmedline.size() == 0 || trimmedline[0] == '#')
|
||||||
{
|
{
|
||||||
dst.push_back(line+line_end);
|
dst.push_back(line+line_end);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1082,7 +1082,7 @@ bool generate_image(std::string part_of_name, video::IImage *& baseimg,
|
|||||||
assert(driver);
|
assert(driver);
|
||||||
|
|
||||||
// Stuff starting with [ are special commands
|
// 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);
|
video::IImage *image = sourcecache->getOrLoad(part_of_name, device);
|
||||||
|
|
||||||
|
@ -967,7 +967,7 @@ inline bool is_yes(const std::string &s)
|
|||||||
return false;
|
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());
|
s32 i = atoi(s.c_str());
|
||||||
if(i < min)
|
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
|
// 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());
|
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());
|
return atoi(wide_to_narrow(s).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline float stof(std::string s)
|
inline float mystof(std::string s)
|
||||||
{
|
{
|
||||||
float f;
|
float f;
|
||||||
std::istringstream ss(s);
|
std::istringstream ss(s);
|
||||||
@ -999,7 +999,10 @@ inline float stof(std::string s)
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
|
#define stoi mystoi
|
||||||
|
#define stof mystof
|
||||||
|
|
||||||
inline std::string itos(s32 i)
|
inline std::string itos(s32 i)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user