00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _OPENCITY_MAP_H_
00021 #define _OPENCITY_MAP_H_ 1
00022
00023 #define MAP_NDEBUG 1 // Debugging off
00024 #undef MAP_NDEBUG
00025
00026 #include "macros.h"
00027
00028 #include <string>
00029 using std::string;
00030
00031 #ifndef MAP_NDEBUG
00032 #define MAP_DEBUG( msg ) OPENCITY_DEBUG( msg )
00033 #else
00034 #define MAP_DEBUG( msg )
00035 #endif
00036
00037 namespace MapGen
00038 {
00039
00043 class Map {
00044 public:
00045 Map(
00046 const uint w,
00047 const uint h );
00048
00049 ~Map();
00050
00051
00052 void setAt(
00053 int x,
00054 int y,
00055 float value );
00056
00057
00058 float getAt(
00059 int x,
00060 int y ) const;
00061
00062 bool save( const string &file );
00063
00064 inline uint getW() const { return _w; }
00065
00066 inline uint getH() const { return _h; }
00067
00068
00069 Map* crop(
00070 const uint w,
00071 const uint h ) const;
00072
00073
00074 int *toIntArray() const;
00075
00076 private:
00077 uint _w;
00078 uint _h;
00079 float **_map;
00080
00081 };
00082
00083 }
00084
00085 #endif