? libs/mercator/Debug
? libs/mercator/Release
? libs/mercator/mercator.sln
? libs/mercator/mercator.vcproj
? libs/mercator/x86
? libs/mercator/Mercator/config.h
? libs/mercator/Mercator/config.h.windows
? libs/mercator/Mercator/float_cast.h
Index: libs/mercator/Mercator/Area.cpp
===================================================================
RCS file: /home/cvspsrv/worldforge/forge/libs/mercator/Mercator/Area.cpp,v
retrieving revision 1.7
diff -u -r1.7 Area.cpp
--- libs/mercator/Mercator/Area.cpp	24 May 2005 19:05:22 -0000	1.7
+++ libs/mercator/Mercator/Area.cpp	2 Oct 2005 18:21:37 -0000
@@ -6,6 +6,7 @@
 #include "Mercator/Segment.h"
 
 #include <wfmath/intersect.h>
+#include <wfmath/polygon_funcs.h>
 #include <iostream>
 
 namespace Mercator
@@ -171,7 +172,31 @@
 {
     assert(p.isValid());
     m_shape = p;
+#ifdef _MSC_VER
+	//MSVC (at least not 7.1) can't handle the template magic of WFMATH, so we have to do this ourselves
+	std::vector< WFMath::Point<2> >::const_iterator i = p.Points().begin();
+	std::vector< WFMath::Point<2> >::const_iterator end = p.Points().end();
+
+	assert(i != end);
+
+	WFMath::Point<2> low = *i, high = *i;
+	bool valid = i->isValid();
+
+	while(++i != end) {
+		valid = valid && i->isValid();
+		for(int j = 0; j < 2; ++j) {
+			low[j] = WFMath::FloatMin(low[j], (*i)[j]);
+			high[j] = WFMath::FloatMax(high[j], (*i)[j]);
+		}
+	}
+
+	low.setValid(valid);
+	high.setValid(valid);
+
+	m_box = WFMath::AxisBox<2>(low, high, true);
+#else 
     m_box = p.boundingBox();
+#endif
 }
 
 bool Area::contains(double x, double y) const
Index: libs/mercator/Mercator/AreaShader.cpp
===================================================================
RCS file: /home/cvspsrv/worldforge/forge/libs/mercator/Mercator/AreaShader.cpp,v
retrieving revision 1.9
diff -u -r1.9 AreaShader.cpp
--- libs/mercator/Mercator/AreaShader.cpp	8 May 2005 23:15:59 -0000	1.9
+++ libs/mercator/Mercator/AreaShader.cpp	2 Oct 2005 18:24:02 -0000
@@ -12,6 +12,7 @@
 #include "Mercator/Segment.h"
 #include "Mercator/Surface.h"
 
+#include <algorithm>
 #include <set>
 #include <iostream>
 
@@ -86,7 +87,9 @@
     if ((y == 0) || (y == sz))
         amount *= 2;
         
-    s(x, y, 0) = std::min( static_cast<ColorT>(I_ROUND(amount * 255)) + s(x,y,0), 255);
+	//do operations in 32 bit space to avoid wrapping
+	signed int temp1 = I_ROUND(amount * 255);
+    s(x, y, 0) = static_cast<ColorT>(std::max<signed int>(std::min<signed int>( temp1 + s(x,y,0), 255),0));
 }
 
 void span(Surface& s, double y, double xStart, double xEnd)
Index: libs/mercator/Mercator/AreaShader.h
===================================================================
RCS file: /home/cvspsrv/worldforge/forge/libs/mercator/Mercator/AreaShader.h,v
retrieving revision 1.3
diff -u -r1.3 AreaShader.h
--- libs/mercator/Mercator/AreaShader.h	11 Apr 2005 23:55:44 -0000	1.3
+++ libs/mercator/Mercator/AreaShader.h	2 Oct 2005 18:14:48 -0000
@@ -22,7 +22,7 @@
     virtual bool checkIntersect(const Segment &) const;
 private:
     /// helper to shader a single area into the surface
-    void shadeArea(Surface& s, const Area* const s) const;
+    void shadeArea(Surface& s, const Area* const area) const;
     
     int m_layer;
 };
Index: libs/mercator/Mercator/Segment.cpp
===================================================================
RCS file: /home/cvspsrv/worldforge/forge/libs/mercator/Mercator/Segment.cpp,v
retrieving revision 1.62
diff -u -r1.62 Segment.cpp
--- libs/mercator/Mercator/Segment.cpp	8 May 2005 12:46:51 -0000	1.62
+++ libs/mercator/Mercator/Segment.cpp	2 Oct 2005 18:11:16 -0000
@@ -273,7 +273,7 @@
           min = std::min(std::min(nn, fn), std::min(nf, ff)),
           heightDifference = max - min;
  
-    return ((nn+fn+ff+nf)/4.f) + randHalf() * roughness * heightDifference / (1.f+::pow(depth,falloff));
+    return ((nn+fn+ff+nf)/4.f) + randHalf() * roughness * heightDifference / (1.f+::pow(static_cast<float>(depth),falloff));
 }
 
 /// \brief One dimensional midpoint displacement fractal.
@@ -319,7 +319,7 @@
                 hd+=0.05f * roughness;       
             }
           
-            array[i] = ((hh+lh)/2.f) + randHalf() * roughness  * hd / (1.f+::pow(depth,BasePoint::FALLOFF));
+            array[i] = ((hh+lh)/2.f) + randHalf() * roughness  * hd / (1.f+::pow(static_cast<float>(depth),BasePoint::FALLOFF));
         }
         stride >>= 1;
         depth++;
Index: libs/mercator/Mercator/iround.h
===================================================================
RCS file: /home/cvspsrv/worldforge/forge/libs/mercator/Mercator/iround.h,v
retrieving revision 1.1
diff -u -r1.1 iround.h
--- libs/mercator/Mercator/iround.h	3 Jun 2004 17:49:56 -0000	1.1
+++ libs/mercator/Mercator/iround.h	2 Oct 2005 18:11:17 -0000
@@ -8,6 +8,7 @@
 #ifndef PACKAGE
 #error iround.h must be included after config.h
 #endif
+#include "float_cast.h"
 
 #ifdef HAVE_LRINTF
     #define I_ROUND(x) (::lrintf(x)) 

