From: kwolekr Date: Fri, 18 Jan 2013 19:12:19 +0000 (-0500) Subject: Last set of minor cleanups X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=b55fb4f2f6952f08ede8b37ba15ec8639410cca4;p=zefram%2Fminetest%2Fminetest_engine.git Last set of minor cleanups --- diff --git a/src/biome.cpp b/src/biome.cpp index 80b8d8f4..69d2dc2f 100644 --- a/src/biome.cpp +++ b/src/biome.cpp @@ -181,7 +181,8 @@ int Biome::getSurfaceHeight(float noise_terrain) { } -void Biome::genColumn(MapgenV7 *mg, int x, int z, int y1, int y2) { +void Biome::genColumn(Mapgen *mapgen, int x, int z, int y1, int y2) { + MapgenV7 *mg = (MapgenV7 *)mapgen; int i = (z - mg->node_min.Z) * mg->csize.Z + (x - mg->node_min.X); int surfaceh = np->offset + np->scale * mg->map_terrain[i]; @@ -214,7 +215,8 @@ void Biome::genColumn(MapgenV7 *mg, int x, int z, int y1, int y2) { ///////////////////////////// [ Ocean biome ] ///////////////////////////////// -void BiomeLiquid::genColumn(MapgenV7 *mg, int x, int z, int y1, int y2) { +void BiomeLiquid::genColumn(Mapgen *mapgen, int x, int z, int y1, int y2) { + MapgenV7 *mg = (MapgenV7 *)mapgen; int i = (z - mg->node_min.Z) * mg->csize.Z + (x - mg->node_min.X); int surfaceh = np->offset + np->scale * mg->map_terrain[i]; int y = y1; @@ -239,8 +241,9 @@ int BiomeHell::getSurfaceHeight(float noise_terrain) { } -void BiomeHell::genColumn(MapgenV7 *mg, int x, int z, int y1, int y2) { - +void BiomeHell::genColumn(Mapgen *mapgen, int x, int z, int y1, int y2) { + MapgenV7 *mg = (MapgenV7 *)mapgen; + //stub } @@ -252,8 +255,9 @@ int BiomeAether::getSurfaceHeight(float noise_terrain) { } -void BiomeAether::genColumn(MapgenV7 *mg, int x, int z, int y1, int y2) { - +void BiomeAether::genColumn(Mapgen *mapgen, int x, int z, int y1, int y2) { + MapgenV7 *mg = (MapgenV7 *)mapgen; + //stub } @@ -265,7 +269,8 @@ int BiomeSuperflat::getSurfaceHeight(float noise_terrain) { } -void BiomeSuperflat::genColumn(MapgenV7 *mg, int x, int z, int y1, int y2) { +void BiomeSuperflat::genColumn(Mapgen *mapgen, int x, int z, int y1, int y2) { + MapgenV7 *mg = (MapgenV7 *)mapgen; int surfaceh = ntopnodes; int y = y1; diff --git a/src/biome.h b/src/biome.h index 3bf7a5d3..265f1df4 100644 --- a/src/biome.h +++ b/src/biome.h @@ -53,26 +53,26 @@ public: std::string name; NoiseParams *np; - virtual void genColumn(MapgenV7 *mg, int x, int z, int y1, int y2); + virtual void genColumn(Mapgen *mg, int x, int z, int y1, int y2); virtual int getSurfaceHeight(float noise_terrain); }; class BiomeLiquid : public Biome { - virtual void genColumn(MapgenV7 *mg, int x, int z, int y1, int y2); + virtual void genColumn(Mapgen *mg, int x, int z, int y1, int y2); }; class BiomeHell : public Biome { - virtual void genColumn(MapgenV7 *mg, int x, int z, int y1, int y2); + virtual void genColumn(Mapgen *mg, int x, int z, int y1, int y2); virtual int getSurfaceHeight(float noise_terrain); }; class BiomeAether : public Biome { - virtual void genColumn(MapgenV7 *mg, int x, int z, int y1, int y2); + virtual void genColumn(Mapgen *mg, int x, int z, int y1, int y2); virtual int getSurfaceHeight(float noise_terrain); }; class BiomeSuperflat : public Biome { - virtual void genColumn(MapgenV7 *mg, int x, int z, int y1, int y2); + virtual void genColumn(Mapgen *mg, int x, int z, int y1, int y2); virtual int getSurfaceHeight(float noise_terrain); }; diff --git a/src/irrlichttypes.h b/src/irrlichttypes.h index 998992e0..2db744a4 100644 --- a/src/irrlichttypes.h +++ b/src/irrlichttypes.h @@ -28,12 +28,13 @@ using namespace irr; #if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 8) #ifdef _MSC_VER // Windows + typedef long long s64; typedef unsigned long long u64; #else // Posix #include + typedef int64_t s64; typedef uint64_t u64; - //typedef unsigned long long u64; #endif #endif diff --git a/src/porting.h b/src/porting.h index 2f9d43ac..0062c11f 100644 --- a/src/porting.h +++ b/src/porting.h @@ -35,14 +35,28 @@ with this program; if not, write to the Free Software Foundation, Inc., #define SWPRINTF_CHARSTRING L"%s" #endif +//currently not needed +//template struct alignment_trick { char c; T member; }; +//#define ALIGNOF(type) offsetof (alignment_trick, member) + #ifdef _WIN32 #include + + #define ALIGNOF(x) __alignof(x) #define sleep_ms(x) Sleep(x) + #define strtok_r(x, y, z) strtok_s(x, y, z) + #define strtof(x, y) (float)strtod(x, y) + #define strtoll(x, y, z) _strtoi64(x, y, z) + #define strtoull(x, y, z) _strtoui64(x, y, z) #else #include + + #define ALIGNOF(x) __alignof__(x) #define sleep_ms(x) usleep(x*1000) #endif +#define PADDING(x, y) ((ALIGNOF(y) - ((uintptr_t)(x) & (ALIGNOF(y) - 1))) & (ALIGNOF(y) - 1)) + namespace porting { diff --git a/src/settings.h b/src/settings.h index 18d6ade7..6d6db220 100644 --- a/src/settings.h +++ b/src/settings.h @@ -32,6 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "debug.h" #include "log.h" #include "util/string.h" +#include "porting.h" enum ValueType { @@ -566,23 +567,6 @@ public: return value; } -//template struct alignment_trick { char c; T member; }; -//#define ALIGNOF(type) offsetof (alignment_trick, member) -#ifdef _WIN32 - #define ALIGNOF(x) __alignof(x) -#else - #define ALIGNOF(x) __alignof__(x) -#endif -#define PADDING(x, y) ((ALIGNOF(y) - ((uintptr_t)(x) & (ALIGNOF(y) - 1))) & (ALIGNOF(y) - 1)) -#ifdef _WIN32 - #define strtok_r(x, y, z) strtok_s(x, y, z) - #define strtof(x, y) (float)strtod(x, y) - #define strtoll(x, y, z) _strtoi64(x, y, z) - #define strtoull(x, y, z) _strtoui64(x, y, z) -#endif - -typedef long long int s64; //to be added to src/irrlichttypes.h later - template T *getStruct(std::string name, std::string format) { size_t len = sizeof(T);