diff --git a/src/global.hpp b/src/global.hpp index 34378c22aa9..b5ad7506010 100755 --- a/src/global.hpp +++ b/src/global.hpp @@ -1,7 +1,7 @@ #ifndef DISABLE_4786_HPP_INCLUDED #define DISABLE_4786_HPP_INCLUDED -#ifdef _WIN32 +#ifdef _MSC_VER //disable the warning to let us know about 'this' being used in //initializer list, since it's a common thing to want to do @@ -23,6 +23,14 @@ warning4786WorkAround() {} static warning4786WorkAround VariableThatHacksWarning4786IntoBeingMutedForSomeUnknownReason; +//put the mathematical functions where they belong: in the std namespace +//it is necessary for VC6 at least +#include +namespace std { + using ::floor; + using ::sqrt; +} + #endif #endif diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 6709fbd4b55..70e1e057fbe 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -133,7 +133,7 @@ height_map generate_height_map(size_t width, size_t height, if(island_size != 0) { const size_t diffx = abs(x1 - int(center_x)); const size_t diffy = abs(y1 - int(center_y)); - const size_t dist = size_t(sqrt(double(diffx*diffx + diffy*diffy))); + const size_t dist = size_t(std::sqrt(double(diffx*diffx + diffy*diffy))); is_valley = dist > island_size; } @@ -149,7 +149,7 @@ height_map generate_height_map(size_t width, size_t height, const int xdiff = (x2-x1); const int ydiff = (y2-y1); - const int height = radius - int(sqrt(double(xdiff*xdiff + ydiff*ydiff))); + const int height = radius - int(std::sqrt(double(xdiff*xdiff + ydiff*ydiff))); if(height > 0) { if(is_valley) { diff --git a/src/sdl_utils.cpp b/src/sdl_utils.cpp index 8d7c496d93e..246e1152ca6 100644 --- a/src/sdl_utils.cpp +++ b/src/sdl_utils.cpp @@ -187,12 +187,12 @@ surface scale_surface_blended(surface surf, int w, int h) //we now have a rectangle, (xsrc,ysrc,xratio,yratio) which we //want to derive the pixel from for(double xloc = xsrc; xloc < xsrc+xratio; xloc += 1.0) { - const double xsize = minimum(floor(xloc+1.0)-xloc,xsrc+xratio-xloc); + const double xsize = minimum(std::floor(xloc+1.0)-xloc,xsrc+xratio-xloc); for(double yloc = ysrc; yloc < ysrc+yratio; yloc += 1.0) { const int xsrcint = maximum(0,minimum(src->w-1,static_cast(xsrc))); const int ysrcint = maximum(0,minimum(src->h-1,static_cast(ysrc))); - const double ysize = minimum(floor(yloc+1.0)-yloc,ysrc+yratio-yloc); + const double ysize = minimum(std::floor(yloc+1.0)-yloc,ysrc+yratio-yloc); Uint8 r,g,b,a;