wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src global.hpp mapgen.cpp sdl_utils.cpp


From: Guillaume Melquiond
Subject: [Wesnoth-cvs-commits] wesnoth/src global.hpp mapgen.cpp sdl_utils.cpp
Date: Fri, 07 Jan 2005 19:09:22 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Guillaume Melquiond <address@hidden>    05/01/07 23:55:48

Modified files:
        src            : global.hpp mapgen.cpp sdl_utils.cpp 

Log message:
        Another try at satisfying both MSVC and Irix CC with respect to 
mathematical functions.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/global.hpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/mapgen.cpp.diff?tr1=1.49&tr2=1.50&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/sdl_utils.cpp.diff?tr1=1.68&tr2=1.69&r1=text&r2=text

Patches:
Index: wesnoth/src/global.hpp
diff -u wesnoth/src/global.hpp:1.2 wesnoth/src/global.hpp:1.3
--- wesnoth/src/global.hpp:1.2  Thu Nov 18 18:35:03 2004
+++ wesnoth/src/global.hpp      Fri Jan  7 23:55:47 2005
@@ -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 @@
 
 static warning4786WorkAround 
VariableThatHacksWarning4786IntoBeingMutedForSomeUnknownReason;
 
+//put the mathematical functions where they belong: in the std namespace
+//it is necessary for VC6 at least
+#include <cmath>
+namespace std {
+  using ::floor;
+  using ::sqrt;
+}
+
 #endif
 
 #endif
Index: wesnoth/src/mapgen.cpp
diff -u wesnoth/src/mapgen.cpp:1.49 wesnoth/src/mapgen.cpp:1.50
--- wesnoth/src/mapgen.cpp:1.49 Thu Dec 30 02:52:37 2004
+++ wesnoth/src/mapgen.cpp      Fri Jan  7 23:55:47 2005
@@ -133,7 +133,7 @@
                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 @@
                                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) {
Index: wesnoth/src/sdl_utils.cpp
diff -u wesnoth/src/sdl_utils.cpp:1.68 wesnoth/src/sdl_utils.cpp:1.69
--- wesnoth/src/sdl_utils.cpp:1.68      Fri Dec 31 21:01:37 2004
+++ wesnoth/src/sdl_utils.cpp   Fri Jan  7 23:55:47 2005
@@ -1,4 +1,4 @@
-/* $Id: sdl_utils.cpp,v 1.68 2004/12/31 21:01:37 isaaccp Exp $ */
+/* $Id: sdl_utils.cpp,v 1.69 2005/01/07 23:55:47 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -187,12 +187,12 @@
                                //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<double>(floor(xloc+1.0)-xloc,xsrc+xratio-xloc);
+                                       const double xsize = 
minimum<double>(std::floor(xloc+1.0)-xloc,xsrc+xratio-xloc);
                                        for(double yloc = ysrc; yloc < 
ysrc+yratio; yloc += 1.0) {
                                                const int xsrcint = 
maximum<int>(0,minimum<int>(src->w-1,static_cast<int>(xsrc)));
                                                const int ysrcint = 
maximum<int>(0,minimum<int>(src->h-1,static_cast<int>(ysrc)));
 
-                                               const double ysize = 
minimum<double>(floor(yloc+1.0)-yloc,ysrc+yratio-yloc);            
+                                               const double ysize = 
minimum<double>(std::floor(yloc+1.0)-yloc,ysrc+yratio-yloc);               
 
                                                Uint8 r,g,b,a;
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]