From 95369e26db66dc7caa76cfe1e5f679180f0701db Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 28 Mar 2013 11:43:11 +0000 Subject: [PATCH] base: a few minor style tweaks. --- src/entity.cpp | 2 +- src/gpu/shader.cpp | 2 +- src/gpu/vertexbuffer.cpp | 12 ++++++------ src/lol/gpu/vertexbuffer.h | 4 ++-- src/platform/sdl/sdlinput.cpp | 2 +- src/tileset.cpp | 11 +++-------- 6 files changed, 14 insertions(+), 19 deletions(-) diff --git a/src/entity.cpp b/src/entity.cpp index 59a7ce97..f4edf2e4 100644 --- a/src/entity.cpp +++ b/src/entity.cpp @@ -52,7 +52,7 @@ char const *Entity::GetName() void Entity::TickGame(float seconds) { - (void)seconds; + UNUSED(seconds); #if !LOL_RELEASE if (m_tickstate != STATE_PRETICK_GAME) Log::Error("invalid entity game tick\n"); diff --git a/src/gpu/shader.cpp b/src/gpu/shader.cpp index 4618deaa..a2ae57c6 100644 --- a/src/gpu/shader.cpp +++ b/src/gpu/shader.cpp @@ -163,7 +163,7 @@ Shader *Shader::Create(char const *lolfx) void Shader::Destroy(Shader *shader) { /* XXX: do nothing! the shader should remain in cache */ - (void)shader; + UNUSED(shader); } Shader::Shader(char const *vert, char const *frag) diff --git a/src/gpu/vertexbuffer.cpp b/src/gpu/vertexbuffer.cpp index 25d42f54..af243f9a 100644 --- a/src/gpu/vertexbuffer.cpp +++ b/src/gpu/vertexbuffer.cpp @@ -239,27 +239,27 @@ void VertexDeclaration::DrawIndexedElements(MeshPrimitive type, int vbase, { case MeshPrimitive::Triangles: /* FIXME: ignores most of the arguments! */ - (void)vbase; (void)vskip; (void)vcount; (void)skip; + UNUSED(vbase, vskip, vcount, skip); glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, 0); break; case MeshPrimitive::TriangleStrips: /* FIXME: ignores most of the arguments! */ - (void)vbase; (void)vskip; (void)vcount; (void)skip; + UNUSED(vbase, vskip, vcount, skip); glDrawElements(GL_TRIANGLE_STRIP, count, GL_UNSIGNED_SHORT, 0); break; case MeshPrimitive::TriangleFans: /* FIXME: ignores most of the arguments! */ - (void)vbase; (void)vskip; (void)vcount; (void)skip; + UNUSED(vbase, vskip, vcount, skip); glDrawElements(GL_TRIANGLE_FAN, count, GL_UNSIGNED_SHORT, 0); break; case MeshPrimitive::Points: /* FIXME: ignores most of the arguments! */ - (void)vbase; (void)vskip; (void)vcount; (void)skip; + UNUSED(vbase, vskip, vcount, skip); glDrawElements(GL_POINTS, count, GL_UNSIGNED_SHORT, 0); break; case MeshPrimitive::Lines: /* FIXME: ignores most of the arguments! */ - (void)vbase; (void)vskip; (void)vcount; (void)skip; + UNUSED(vbase, vskip, vcount, skip); glDrawElements(GL_LINES, count, GL_UNSIGNED_SHORT, 0); break; } @@ -645,7 +645,7 @@ void *VertexBuffer::Lock(size_t offset, size_t size) return ret; #else /* FIXME: is there a way to use "size"? */ - (void)size; + UNUSED(size); return m_data->m_memory + offset; #endif } diff --git a/src/lol/gpu/vertexbuffer.h b/src/lol/gpu/vertexbuffer.h index 32df52a3..0e8dd26e 100644 --- a/src/lol/gpu/vertexbuffer.h +++ b/src/lol/gpu/vertexbuffer.h @@ -158,7 +158,7 @@ protected: }; #define LOL_TYPE(T) \ - static uint8_t GetType(T *x) { (void)x; return Type##T; } + static uint8_t GetType(T *x) { UNUSED(x); return Type##T; } LOL_TYPE(void) LOL_TYPE(half) LOL_TYPE(f16vec2) LOL_TYPE(f16vec3) LOL_TYPE(f16vec4) @@ -191,7 +191,7 @@ private: template<> inline void VertexStreamBase::AddStream(int n, VertexUsage usage) { - (void)usage; + UNUSED(usage); m_streams[n].size = 0; } diff --git a/src/platform/sdl/sdlinput.cpp b/src/platform/sdl/sdlinput.cpp index 37faad7b..9e493e58 100644 --- a/src/platform/sdl/sdlinput.cpp +++ b/src/platform/sdl/sdlinput.cpp @@ -201,7 +201,7 @@ void SdlInputData::Tick(float seconds) if (keystate[i]) Input::KeyPressed(i, seconds); #else - (void)seconds; + UNUSED(seconds); #endif #endif } diff --git a/src/tileset.cpp b/src/tileset.cpp index 579ff42b..3423ed04 100644 --- a/src/tileset.cpp +++ b/src/tileset.cpp @@ -67,8 +67,6 @@ TileSet::TileSet(char const *path) : m_data(new TileSetData()) { Init(path); - - m_drawgroup = DRAWGROUP_BEFORE; } TileSet::TileSet(char const *path, ivec2 size, ivec2 count) @@ -85,8 +83,7 @@ TileSet::TileSet(char const *path, ivec2 size, ivec2 count) { if (size.x <= 0 || size.y <= 0) size = ivec2(32, 32); - count = ivec2(max(1, m_data->m_image_size.x / size.x), - max(1, m_data->m_image_size.y / size.y)); + count = max(ivec2(1, 1), m_data->m_image_size / size); } for (int j = 0; j < count.y; ++j) @@ -95,8 +92,6 @@ TileSet::TileSet(char const *path, ivec2 size, ivec2 count) AddTile(ibox2(size * ivec2(i, j), size * ivec2(i + 1, j + 1))); } - - m_drawgroup = DRAWGROUP_BEFORE; } void TileSet::Init(char const *path) @@ -108,6 +103,8 @@ void TileSet::Init(char const *path) m_data->m_image_size = m_data->m_image->GetSize(); m_data->m_texture_size = ivec2(PotUp(m_data->m_image_size.x), PotUp(m_data->m_image_size.y)); + + m_drawgroup = DRAWGROUP_BEFORE; } int TileSet::AddTile(ibox2 rect) @@ -194,8 +191,6 @@ int TileSet::GetTileCount() const ivec2 TileSet::GetTileSize(int tileid) const { - (void)tileid; - ibox2 const &box = m_data->m_tiles[tileid].m1; return box.B - box.A; }