src/Terrain.hh
changeset 409 1a03ff151abc
parent 408 e6cfc44266af
child 411 106aaf6eadfe
--- a/src/Terrain.hh	Tue Jan 20 23:30:18 2009 +0200
+++ b/src/Terrain.hh	Wed Jan 21 00:21:42 2009 +0200
@@ -1,8 +1,6 @@
 #ifndef TERRAIN_HH
 #define TERRAIN_HH
 
-#include <vector>
-
 #include "Vector.hh"
 #include "GraphicsPointer.hh"
 #include "Types.hh"
@@ -28,6 +26,22 @@
 typedef uint8_t TerrainPixel;
 
 /**
+ * Terrain configuration
+ */
+struct TerrainConfig {
+    /** Size of the terrain field*/
+    PixelCoordinate dimensions;
+
+    /** Set to nonzero to generate random map */
+    int random_seed;
+    
+    /** Defaults */
+    TerrainConfig (void) : dimensions(TERRAIN_WIDTH, TERRAIN_HEIGHT), random_seed(TERRAIN_RANDOM_SEED) { }
+};
+
+#include <vector>
+
+/**
  * Terrain class. Represents game terrain and contains member
  * functions to manipulate terrain and get info about it.
  * 
@@ -53,18 +67,11 @@
 
 public:    
     /**
-     * Default constructor. The width/height are set to zero and the terrain is invalid until it gets updated
+     * Construct a new terrain based on the given configuration
+     *
+     * @param config a TerrainConfig describing how to build the terrain
      */
-    Terrain (void);
-
-    /**
-     * Construct a randomly generated terrain
-     *
-     * @param width terrain width
-     * @param height terrain height
-     * @param seed random number generator seed used to generate the random terrain.
-     */
-    Terrain (PixelDimension width, PixelDimension height, int seed);
+    explicit Terrain (const TerrainConfig &config);
 
     /**
      * Construct the terrain using the provided terrain data. The given \a terrain_buf must be a linear array in the