[Orxonox-commit 320] r2946 - in trunk/src: . core

rgrieder at orxonox.net rgrieder at orxonox.net
Fri May 1 22:20:02 CEST 2009


Author: rgrieder
Date: 2009-05-01 22:20:02 +0200 (Fri, 01 May 2009)
New Revision: 2946

Modified:
   trunk/src/OrxonoxConfig.h.in
   trunk/src/SpecialConfig.h.in
   trunk/src/core/Game.h
Log:
Fixed a bug when using the __LINE__ macro in Game.h
If you want to concatenate __LINE__ to form a variable name, use:
MACRO_CONCATENATE(dummyvar##myParam1, __LINE__)

Modified: trunk/src/OrxonoxConfig.h.in
===================================================================
--- trunk/src/OrxonoxConfig.h.in	2009-05-01 13:16:12 UTC (rev 2945)
+++ trunk/src/OrxonoxConfig.h.in	2009-05-01 20:20:02 UTC (rev 2946)
@@ -141,6 +141,15 @@
 
 
 /*---------------------------------
+ * Special Macros
+ *-------------------------------*/
+#define MACRO_CONCATENATE_AUX(a, b) a##b
+#define MACRO_CONCATENATE(a, b) MACRO_CONCATENATE_AUX(a, b)
+#define MACRO_QUOTEME_AUX(x) #x
+#define MACRO_QUOTEME(x) MACRO_QUOTEME_AUX(x)
+
+
+/*---------------------------------
  * Includes
  *-------------------------------*/
 /* Define the english written operators like and, or, xor

Modified: trunk/src/SpecialConfig.h.in
===================================================================
--- trunk/src/SpecialConfig.h.in	2009-05-01 13:16:12 UTC (rev 2945)
+++ trunk/src/SpecialConfig.h.in	2009-05-01 20:20:02 UTC (rev 2946)
@@ -39,6 +39,8 @@
 #ifndef _SpecialConfig_H__
 #define _SpecialConfig_H__
 
+#include "OrxonoxConfig.h"
+
 /* Set whether we must suffix "ceguilua/" for the CEGUILua.h include */
 #cmakedefine CEGUILUA_USE_INTERNAL_LIBRARY
 
@@ -53,11 +55,6 @@
 /* Using MSVC or XCode IDE */
 #cmakedefine CMAKE_CONFIGURATION_TYPES
 
-/* Macros used in the next section */
-#define MACRO_CONCATENATE(str1, str2) str1##str2
-#define MACRO_QUOTEME_AUX(x) #x
-#define MACRO_QUOTEME(x) MACRO_QUOTEME_AUX(x)
-
 /* Handle default ConfigValues */
 namespace orxonox
 {

Modified: trunk/src/core/Game.h
===================================================================
--- trunk/src/core/Game.h	2009-05-01 13:16:12 UTC (rev 2945)
+++ trunk/src/core/Game.h	2009-05-01 20:20:02 UTC (rev 2946)
@@ -43,7 +43,7 @@
 #include "OrxonoxClass.h"
 
 #define AddGameState(classname, name) \
-    static bool bGameStateDummy_##classname##__LINE__ = orxonox::Game::addGameState(new classname(name))
+    static bool MACRO_CONCATENATE(bGameStateDummy_##classname, __LINE__) = orxonox::Game::addGameState(new classname(name))
 
 namespace orxonox
 {




More information about the Orxonox-commit mailing list