[Orxonox-commit 51] r2756 - in trunk/src: network network/packet orxonox/gamestates orxonox/pch/havepch util

rgrieder at orxonox.net rgrieder at orxonox.net
Sun Mar 8 13:24:15 CET 2009


Author: rgrieder
Date: 2009-03-08 13:24:15 +0100 (Sun, 08 Mar 2009)
New Revision: 2756

Modified:
   trunk/src/network/ClientConnection.h
   trunk/src/network/ClientInformation.h
   trunk/src/network/ConnectionManager.h
   trunk/src/network/PacketBuffer.h
   trunk/src/network/packet/DeleteObjects.cc
   trunk/src/network/packet/Packet.cc
   trunk/src/network/packet/Packet.h
   trunk/src/orxonox/gamestates/GSGraphics.h
   trunk/src/orxonox/gamestates/GSRoot.cc
   trunk/src/orxonox/pch/havepch/OrxonoxStableHeaders.h
   trunk/src/util/Math.h
Log:
Minimising problems when including windows.h because it defines macros like "min" and "max" if not explicitly specified.
There are two headers we use that include windows.h: OgreWindowEventUtilities.h and enet.h. I had to tweak a little bit there as well.

Modified: trunk/src/network/ClientConnection.h
===================================================================
--- trunk/src/network/ClientConnection.h	2009-03-07 17:02:34 UTC (rev 2755)
+++ trunk/src/network/ClientConnection.h	2009-03-08 12:24:15 UTC (rev 2756)
@@ -43,6 +43,10 @@
 #include "NetworkPrereqs.h"
 
 #include <string>
+#ifndef WIN32_LEAN_AND_MEAN
+#  define WIN32_LEAN_AND_MEAN
+#endif
+#define NOMINMAX // required to stop windows.h screwing up std::min definition
 #include <enet/enet.h>
 #include <boost/thread/recursive_mutex.hpp>
 #include "PacketBuffer.h"

Modified: trunk/src/network/ClientInformation.h
===================================================================
--- trunk/src/network/ClientInformation.h	2009-03-07 17:02:34 UTC (rev 2755)
+++ trunk/src/network/ClientInformation.h	2009-03-08 12:24:15 UTC (rev 2756)
@@ -42,6 +42,10 @@
 
 #include "NetworkPrereqs.h"
 
+#ifndef WIN32_LEAN_AND_MEAN
+#  define WIN32_LEAN_AND_MEAN
+#endif
+#define NOMINMAX // required to stop windows.h screwing up std::min definition
 #include <enet/enet.h>
 #include <boost/thread/recursive_mutex.hpp>
 

Modified: trunk/src/network/ConnectionManager.h
===================================================================
--- trunk/src/network/ConnectionManager.h	2009-03-07 17:02:34 UTC (rev 2755)
+++ trunk/src/network/ConnectionManager.h	2009-03-08 12:24:15 UTC (rev 2756)
@@ -45,6 +45,10 @@
 #include <string>
 #include <map>
 // enet library for networking support
+#ifndef WIN32_LEAN_AND_MEAN
+#  define WIN32_LEAN_AND_MEAN
+#endif
+#define NOMINMAX // required to stop windows.h screwing up std::min definition
 #include <enet/enet.h>
 #include <boost/thread/recursive_mutex.hpp>
 

Modified: trunk/src/network/PacketBuffer.h
===================================================================
--- trunk/src/network/PacketBuffer.h	2009-03-07 17:02:34 UTC (rev 2755)
+++ trunk/src/network/PacketBuffer.h	2009-03-08 12:24:15 UTC (rev 2756)
@@ -43,6 +43,10 @@
 
 #include "NetworkPrereqs.h"
 
+#ifndef WIN32_LEAN_AND_MEAN
+#  define WIN32_LEAN_AND_MEAN
+#endif
+#define NOMINMAX // required to stop windows.h screwing up std::min definition
 #include <enet/enet.h>
 #include <boost/thread/recursive_mutex.hpp>
 

Modified: trunk/src/network/packet/DeleteObjects.cc
===================================================================
--- trunk/src/network/packet/DeleteObjects.cc	2009-03-07 17:02:34 UTC (rev 2755)
+++ trunk/src/network/packet/DeleteObjects.cc	2009-03-08 12:24:15 UTC (rev 2756)
@@ -28,6 +28,10 @@
 
 
 #include "DeleteObjects.h"
+#ifndef WIN32_LEAN_AND_MEAN
+#  define WIN32_LEAN_AND_MEAN
+#endif
+#define NOMINMAX // required to stop windows.h screwing up std::min definition
 #include <enet/enet.h>
 #include "network/synchronisable/Synchronisable.h"
 #include "core/CoreIncludes.h"

Modified: trunk/src/network/packet/Packet.cc
===================================================================
--- trunk/src/network/packet/Packet.cc	2009-03-07 17:02:34 UTC (rev 2755)
+++ trunk/src/network/packet/Packet.cc	2009-03-08 12:24:15 UTC (rev 2756)
@@ -30,6 +30,10 @@
 #include "Packet.h"
 
 #include <cassert>
+#ifndef WIN32_LEAN_AND_MEAN
+#  define WIN32_LEAN_AND_MEAN
+#endif
+#define NOMINMAX // required to stop windows.h screwing up std::min definition
 #include <enet/enet.h>
 #include <boost/bind.hpp>
 

Modified: trunk/src/network/packet/Packet.h
===================================================================
--- trunk/src/network/packet/Packet.h	2009-03-07 17:02:34 UTC (rev 2755)
+++ trunk/src/network/packet/Packet.h	2009-03-08 12:24:15 UTC (rev 2756)
@@ -31,6 +31,10 @@
 #include "network/NetworkPrereqs.h"
 
 #include <map>
+#ifndef WIN32_LEAN_AND_MEAN
+#  define WIN32_LEAN_AND_MEAN
+#endif
+#define NOMINMAX // required to stop windows.h screwing up std::min definition
 #include <enet/enet.h>
 #include <boost/thread/recursive_mutex.hpp>
 

Modified: trunk/src/orxonox/gamestates/GSGraphics.h
===================================================================
--- trunk/src/orxonox/gamestates/GSGraphics.h	2009-03-07 17:02:34 UTC (rev 2755)
+++ trunk/src/orxonox/gamestates/GSGraphics.h	2009-03-08 12:24:15 UTC (rev 2756)
@@ -31,6 +31,7 @@
 
 #include "OrxonoxPrereqs.h"
 #include <OgrePrerequisites.h>
+#define NOMINMAX // required to stop windows.h screwing up std::min definition
 #include <OgreWindowEventUtilities.h>
 #include "core/GameState.h"
 #include "core/OrxonoxClass.h"

Modified: trunk/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- trunk/src/orxonox/gamestates/GSRoot.cc	2009-03-07 17:02:34 UTC (rev 2755)
+++ trunk/src/orxonox/gamestates/GSRoot.cc	2009-03-08 12:24:15 UTC (rev 2756)
@@ -48,15 +48,8 @@
 #  ifndef WIN32_LEAN_AND_MEAN
 #    define WIN32_LEAN_AND_MEAN
 #  endif
+#  define NOMINMAX // required to stop windows.h screwing up std::min definition
 #  include "windows.h"
-
-   //Get around Windows hackery
-#  ifdef max
-#    undef max
-#  endif
-#  ifdef min
-#    undef min
-#  endif
 #endif
 
 namespace orxonox

Modified: trunk/src/orxonox/pch/havepch/OrxonoxStableHeaders.h
===================================================================
--- trunk/src/orxonox/pch/havepch/OrxonoxStableHeaders.h	2009-03-07 17:02:34 UTC (rev 2755)
+++ trunk/src/orxonox/pch/havepch/OrxonoxStableHeaders.h	2009-03-08 12:24:15 UTC (rev 2756)
@@ -44,6 +44,7 @@
 // prevent Ogre from including winsock.h that messes with winsock2.h from enet
 #  define WIN32_LEAN_AND_MEAN
 #endif
+#define NOMINMAX // required to stop windows.h screwing up std::min definition
 #include <Ogre.h>
 #include <CEGUI.h>
 #include <boost/thread/recursive_mutex.hpp>
@@ -57,16 +58,6 @@
 #include <tinyxml/ticpp.h>
 #include <tolua++.h>
 
-//Get around Windows hackery (windows.h is included by Ogre.h)
-#ifdef ORXONOX_PLATFORM_WINDOWS 
-#  ifdef max
-#    undef max
-#  endif
-#  ifdef min
-#    undef min
-#  endif
-#endif
-
 //----------- Our files ----------
 //--------------------------------
 //// only include when not debugging so that we may find issues with missing headers quicker

Modified: trunk/src/util/Math.h
===================================================================
--- trunk/src/util/Math.h	2009-03-07 17:02:34 UTC (rev 2755)
+++ trunk/src/util/Math.h	2009-03-08 12:24:15 UTC (rev 2756)
@@ -50,14 +50,9 @@
 #include <OgreQuaternion.h>
 #include <OgreColourValue.h>
 
-//Get around Windows hackery
-#ifdef ORXONOX_PLATFORM_WINDOWS
-#  ifdef max
-#    undef max
-#  endif
-#  ifdef min
-#    undef min
-#  endif
+// Certain headers might define min and max macros
+#if defined(max) || defined(min) || defined(sgn) || defined(clamp) || defined(square) || defined(mod)
+#  error An inline math function was overridden by a macro
 #endif
 
 namespace orxonox




More information about the Orxonox-commit mailing list