Merge pull request #8 from grahamboree/unused_warnings

Fix for google code Issue 108
This commit is contained in:
Mikko Mononen 2013-10-16 09:38:48 -07:00
commit 7308f91d80
7 changed files with 32 additions and 16 deletions

View File

@ -32,6 +32,11 @@ feature to find minor members.
/// @name General helper functions
/// @{
/// Used to ignore a function parameter. VS complains about unused parameters
/// and this silences the warning.
/// @param [in] _ Unused parameter
template<class T> void dtIgnoreUnused(const T&) { }
/// Swaps the values of the two parameters.
/// @param[in,out] a Value A
/// @param[in,out] b Value B

View File

@ -2116,6 +2116,7 @@ dtStatus dtDecompressTileCacheLayer(dtTileCacheAlloc* alloc, dtTileCacheCompress
bool dtTileCacheHeaderSwapEndian(unsigned char* data, const int dataSize)
{
dtIgnoreUnused(dataSize);
dtTileCacheLayerHeader* header = (dtTileCacheLayerHeader*)data;
int swappedMagic = DT_TILECACHE_MAGIC;

View File

@ -549,6 +549,11 @@ static const int RC_NOT_CONNECTED = 0x3f;
/// @name General helper functions
/// @{
/// Used to ignore a function parameter. VS complains about unused parameters
/// and this silences the warning.
/// @param [in] _ Unused parameter
template<class T> void rcIgnoreUnused(const T&) { }
/// Swaps the values of the two parameters.
/// @param[in,out] a Value A
/// @param[in,out] b Value B

View File

@ -208,12 +208,11 @@ void rcCalcGridSize(const float* bmin, const float* bmax, float cs, int* w, int*
/// See the #rcConfig documentation for more information on the configuration parameters.
///
/// @see rcAllocHeightfield, rcHeightfield
bool rcCreateHeightfield(rcContext* /*ctx*/, rcHeightfield& hf, int width, int height,
bool rcCreateHeightfield(rcContext* ctx, rcHeightfield& hf, int width, int height,
const float* bmin, const float* bmax,
float cs, float ch)
{
// TODO: VC complains about unref formal variable, figure out a way to handle this better.
// rcAssert(ctx);
rcIgnoreUnused(ctx);
hf.width = width;
hf.height = height;
@ -245,13 +244,12 @@ static void calcTriNormal(const float* v0, const float* v1, const float* v2, flo
/// See the #rcConfig documentation for more information on the configuration parameters.
///
/// @see rcHeightfield, rcClearUnwalkableTriangles, rcRasterizeTriangles
void rcMarkWalkableTriangles(rcContext* /*ctx*/, const float walkableSlopeAngle,
void rcMarkWalkableTriangles(rcContext* ctx, const float walkableSlopeAngle,
const float* verts, int /*nv*/,
const int* tris, int nt,
unsigned char* areas)
{
// TODO: VC complains about unref formal variable, figure out a way to handle this better.
// rcAssert(ctx);
rcIgnoreUnused(ctx);
const float walkableThr = cosf(walkableSlopeAngle/180.0f*RC_PI);
@ -275,13 +273,12 @@ void rcMarkWalkableTriangles(rcContext* /*ctx*/, const float walkableSlopeAngle,
/// See the #rcConfig documentation for more information on the configuration parameters.
///
/// @see rcHeightfield, rcClearUnwalkableTriangles, rcRasterizeTriangles
void rcClearUnwalkableTriangles(rcContext* /*ctx*/, const float walkableSlopeAngle,
void rcClearUnwalkableTriangles(rcContext* ctx, const float walkableSlopeAngle,
const float* verts, int /*nv*/,
const int* tris, int nt,
unsigned char* areas)
{
// TODO: VC complains about unref formal variable, figure out a way to handle this better.
// rcAssert(ctx);
rcIgnoreUnused(ctx);
const float walkableThr = cosf(walkableSlopeAngle/180.0f*RC_PI);
@ -297,10 +294,9 @@ void rcClearUnwalkableTriangles(rcContext* /*ctx*/, const float walkableSlopeAng
}
}
int rcGetHeightFieldSpanCount(rcContext* /*ctx*/, rcHeightfield& hf)
int rcGetHeightFieldSpanCount(rcContext* ctx, rcHeightfield& hf)
{
// TODO: VC complains about unref formal variable, figure out a way to handle this better.
// rcAssert(ctx);
rcIgnoreUnused(ctx);
const int w = hf.width;
const int h = hf.height;

View File

@ -1068,6 +1068,7 @@ void CrowdTool::handleToggle()
void CrowdTool::handleUpdate(const float dt)
{
rcIgnoreUnused(dt);
}
void CrowdTool::handleRender()
@ -1076,6 +1077,9 @@ void CrowdTool::handleRender()
void CrowdTool::handleRenderOverlay(double* proj, double* model, int* view)
{
rcIgnoreUnused(model);
rcIgnoreUnused(proj);
// Tool help
const int h = view[3];
int ty = h-40;

View File

@ -261,8 +261,11 @@ void NavMeshPruneTool::handleMenu()
}
}
void NavMeshPruneTool::handleClick(const float* /*s*/, const float* p, bool shift)
void NavMeshPruneTool::handleClick(const float* s, const float* p, bool shift)
{
rcIgnoreUnused(s);
rcIgnoreUnused(shift);
if (!m_sample) return;
InputGeom* geom = m_sample->getInputGeom();
if (!geom) return;
@ -341,9 +344,11 @@ void NavMeshPruneTool::handleRender()
void NavMeshPruneTool::handleRenderOverlay(double* proj, double* model, int* view)
{
rcIgnoreUnused(model);
rcIgnoreUnused(proj);
// Tool help
const int h = view[3];
imguiDrawText(280, h-40, IMGUI_ALIGN_LEFT, "LMB: Click fill area.", imguiRGBA(255,255,255,192));
imguiDrawText(280, h-40, IMGUI_ALIGN_LEFT, "LMB: Click fill area.", imguiRGBA(255,255,255,192));
}

View File

@ -1297,7 +1297,7 @@ void NavMeshTesterTool::handleRender()
for (int i = 0; i < m_nrandPoints; i++)
{
const float* p = &m_randPoints[i*3];
dd.vertex(p[0],p[1]+0.1,p[2], duRGBA(220,32,16,192));
dd.vertex(p[0],p[1]+0.1f,p[2], duRGBA(220,32,16,192));
}
dd.end();