Skip to content

Commit

Permalink
more fixes and cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
robn committed Apr 3, 2012
1 parent 75e9316 commit 4006e46
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/GeoSphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ void GeoSphere::Render(Renderer *renderer, vector3d campos, const float radius,
glTranslated(-campos.x, -campos.y, -campos.z);
Frustum frustum = Frustum::FromGLState();

const float atmosRadius = static_cast<float>(ATMOSPHERE_RADIUS);
const float atmosRadius = float(ATMOSPHERE_RADIUS);

// no frustum test of entire geosphere, since Space::Render does this
// for each body using its GetBoundingRadius() value
Expand Down
3 changes: 2 additions & 1 deletion src/LuaObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,9 @@ class LuaObjectUncopyable : LuaObject<UT> {
static inline T *CheckFromLua(int index) {
return dynamic_cast<T*>(LuaObject<UT>::CheckFromLua(index));
}

private:
LuaObjectUncopyable() {} // Avoids a compile warning
LuaObjectUncopyable() {}
};

#endif
2 changes: 1 addition & 1 deletion src/StarSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ static const struct StarTypeInfo {
45000, 60000
}, {
SBody::SUPERTYPE_STAR, // S BH
{20,2000}, {0.00002,0.00004}, // Sukender: Are we storing a small float in an int??? Is there a problem with these values?
{20,2000}, {0.00002,0.00004}, // XXX storing floats in ints?
10, 24
}, {
SBody::SUPERTYPE_STAR, // IM BH
Expand Down
6 changes: 3 additions & 3 deletions src/SystemPath.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
class SystemPath {
public:
SystemPath() :
sectorX(0), sectorY(0), sectorZ(0), systemIndex(static_cast<Uint32>(-1)), bodyIndex(static_cast<Uint32>(-1)) {}
sectorX(0), sectorY(0), sectorZ(0), systemIndex(Uint32(-1)), bodyIndex(Uint32(-1)) {}

SystemPath(Sint32 x, Sint32 y, Sint32 z) :
sectorX(x), sectorY(y), sectorZ(z), systemIndex(static_cast<Uint32>(-1)), bodyIndex(static_cast<Uint32>(-1)) {}
sectorX(x), sectorY(y), sectorZ(z), systemIndex(Uint32(-1)), bodyIndex(Uint32(-1)) {}
SystemPath(Sint32 x, Sint32 y, Sint32 z, Uint32 si) :
sectorX(x), sectorY(y), sectorZ(z), systemIndex(si), bodyIndex(static_cast<Uint32>(-1)) {}
sectorX(x), sectorY(y), sectorZ(z), systemIndex(si), bodyIndex(Uint32(-1)) {}
SystemPath(Sint32 x, Sint32 y, Sint32 z, Uint32 si, Uint32 bi) :
sectorX(x), sectorY(y), sectorZ(z), systemIndex(si), bodyIndex(bi) {}

Expand Down
2 changes: 1 addition & 1 deletion src/SystemView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void SystemView::ResetViewpoint()
m_selectedObject = 0;
m_rot_z = 0;
m_rot_x = 50;
m_zoom = 1.0f/static_cast<float>(AU);
m_zoom = 1.0f/float(AU);
m_timeStep = 1.0f;
m_time = Pi::game->GetTime();
}
Expand Down
2 changes: 1 addition & 1 deletion src/TextureFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ TextureFont::TextureFont(const FontConfig &fc) : Font(fc)

bool outline = GetConfig().Int("Outline");

FT_Stroker stroker(NULL);
FT_Stroker stroker(0);
if (outline) {
if (FT_Stroker_New(GetFreeTypeLibrary(), &stroker)) {
fprintf(stderr, "Freetype stroker init error\n");
Expand Down
1 change: 1 addition & 0 deletions src/fixed.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define _FIXED_H

#include <SDL_stdinc.h>
#include <cassert>

template <int FRAC_BITS>
class fixedf {
Expand Down
6 changes: 3 additions & 3 deletions src/graphics/TextureGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ TextureGL::TextureGL(const TextureDescriptor &descriptor) : Texture(descriptor),

GLenum magFilter, minFilter, wrapS, wrapT;
switch (descriptor.sampleMode) {
default:
assert(0);
// No break. Going to LINEAR_CLAMP forces all values to be initalized in any case, avoiding an annoying compiler warning.
case LINEAR_CLAMP:
magFilter = GL_LINEAR;
minFilter = descriptor.generateMipmaps ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR;
Expand All @@ -92,6 +89,9 @@ TextureGL::TextureGL(const TextureDescriptor &descriptor) : Texture(descriptor),
minFilter = descriptor.generateMipmaps ? GL_NEAREST_MIPMAP_NEAREST : GL_NEAREST;
wrapS = wrapT = GL_REPEAT;
break;

default:
assert(0);
}

glTexParameteri(m_target, GL_TEXTURE_WRAP_S, wrapS);
Expand Down
2 changes: 0 additions & 2 deletions src/libs.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ inline int isfinite(double x) { return _finite(x); }
template<class T> inline const T& Clamp(const T& x, const T& min, const T& max) { return x > max ? max : (x < min ? min : x); }

#define DEG_2_RAD 0.0174532925
//template <typename T>
//inline T DEG2RAD(T x) { return static_cast<T>(M_PI)/static_cast<T>(180.); }
inline double DEG2RAD(double x) { return x*(M_PI/180.); }
inline float DEG2RAD(float x) { return x*(float(M_PI)/180.f); }

Expand Down
5 changes: 3 additions & 2 deletions src/terrain/TerrainHeightHillsNormal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ double TerrainHeightFractal<TerrainHeightHillsNormal>::GetHeight(const vector3d
// cliffs at shore
if (continents < 0.01) n += m * continents * 100.0f;
else n += m;
return (n > 0.0 ? n*m_maxHeight : 0.0);
//return 0.0;

if (n > 0.0) return n*m_maxHeight;
return 0.0;
}
1 change: 0 additions & 1 deletion src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ void Screendump(const char* destFile, const int width, const int height)
}

//http://www.libpng.org/pub/png/libpng-1.2.5-manual.html#section-3.1
// Sukender: !!WARNING!! setjmp is awfully dangerous in C++, due to the incompatibility with destructors. If anyone has a better solution, then use it!
if (setjmp(png_jmpbuf(png_ptr))) {
png_destroy_write_struct(&png_ptr, &info_ptr);
fprintf(stderr, "Couldn't set png jump buffer\n");
Expand Down

0 comments on commit 4006e46

Please sign in to comment.