fix GRAPHICS_ENABLED configuration... probably broken again if the <ClanLib/Display> includes aren't there
authorTero Marttila <terom@fixme.fi>
Thu, 22 Jan 2009 04:09:53 +0200
changeset 424 f337a86d144e
parent 423 947ab54de4b7
child 425 567144562978
fix GRAPHICS_ENABLED configuration... probably broken again if the <ClanLib/Display> includes aren't there
src/Engine.cc
src/Graphics/Drawable.hh
src/Graphics/Graphics.hh
src/Terrain.hh
src/Vector.hh
--- a/src/Engine.cc	Thu Jan 22 03:53:17 2009 +0200
+++ b/src/Engine.cc	Thu Jan 22 04:09:53 2009 +0200
@@ -178,8 +178,10 @@
 }
 
 void Engine::run (void) {
+#if NETWORK_ENABLED 
     // timeout for NetworkReactor
     timeval timeout;
+#endif        
 
     while (is_running) {
         /*
--- a/src/Graphics/Drawable.hh	Thu Jan 22 03:53:17 2009 +0200
+++ b/src/Graphics/Drawable.hh	Thu Jan 22 04:09:53 2009 +0200
@@ -1,6 +1,5 @@
 
-// XXX: because this is included from ..
-#if GRAPHICS_ENABLED && !(defined GRAPHICS_DRAWABLE_HH)
+#ifndef GRAPHICS_DRAWABLE_HH
 #define GRAPHICS_DRAWABLE_HH
 
 namespace graphics
--- a/src/Graphics/Graphics.hh	Thu Jan 22 03:53:17 2009 +0200
+++ b/src/Graphics/Graphics.hh	Thu Jan 22 04:09:53 2009 +0200
@@ -1,5 +1,5 @@
-// XXX: ugly hack
-#if GRAPHICS_ENABLED && !(defined GRAPHICS_GRAPHICS_HH)
+
+#ifndef GRAPHICS_GRAPHICS_HH
 #define GRAPHICS_GRAPHICS_HH
 
 namespace graphics
--- a/src/Terrain.hh	Thu Jan 22 03:53:17 2009 +0200
+++ b/src/Terrain.hh	Thu Jan 22 04:09:53 2009 +0200
@@ -8,6 +8,11 @@
 
 #include <vector>
 
+#if GRAPHICS_ENABLED
+    #include "Graphics/Drawable.hh"
+
+#endif
+
 /**
  * Different types of terrain available
  */
@@ -43,12 +48,11 @@
 #if GRAPHICS_ENABLED    
     /** We pre-render the textured terrain data for display */
     CL_PixelBuffer pixbuf;
-
+    
+    /** Generated texture pattern */
+    std::vector<std::vector<int> > texture;
 #endif    
 
-    // XXX: terrain texture
-    std::vector<std::vector<int> > texture;
-
 public:    
     /**
      * Construct a new terrain based on the given configuration
@@ -105,6 +109,7 @@
      */
     void generatePixelBuffer (void);
 
+#if GRAPHICS_ENABLED    
     /**
      * Generates an area of random texture using a fractal-based algorithm, this can then be applied to the terrain
      * pixels using noisifyPixel
@@ -116,6 +121,7 @@
      * at \a pc.
      */
     Color getTexturePixel (PixelDimension x, PixelDimension y);
+#endif
 
     /**
      * Scale parameter to "pixels"
--- a/src/Vector.hh	Thu Jan 22 03:53:17 2009 +0200
+++ b/src/Vector.hh	Thu Jan 22 04:09:53 2009 +0200
@@ -208,8 +208,8 @@
  * Float/int absolute value
  */
 template<typename T> static T absType (T value);
-template<> float absType<float> (float value) { return (float) fabs(value); }
-template<> long absType<long> (long value) { return labs(value); }
+template<> static float absType<float> (float value) { return (float) fabs(value); }
+template<> static long absType<long> (long value) { return labs(value); }
 
 /**
  * Direction-normalize the given coordinate against the tangent coordinate.