Fix a bunch of compiler warnings

* Removed some unused vars
* Fixed some signed/unsigned comparison mismatch warnings
* Cast some int's to size_t when appropriate
* Removed some redundant casts
* silenced warnings about implicit conversions that lose precision
* changed origMousePos to an array of ints to match mousePos
This commit is contained in:
Graham Pentheny 2015-01-20 23:12:42 -05:00 committed by grahamboree
parent ac0316e6a8
commit 66c6060e95
7 changed files with 14 additions and 15 deletions

View File

@ -331,7 +331,7 @@ float dtObstacleAvoidanceQuery::processSample(const float* vcand, const float cs
// find the threshold hit time to bail out based on the early out penalty
// (see how the penalty is calculated below to understnad)
float minPen = minPenalty - vpen - vcpen;
float tThresold = ((double)m_params.weightToi/(double)minPen - 0.1) * (double)m_params.horizTime;
float tThresold = (m_params.weightToi / minPen - 0.1f) * m_params.horizTime;
if (tThresold - m_params.horizTime > -FLT_EPSILON)
return minPenalty; // already too much
@ -528,7 +528,6 @@ int dtObstacleAvoidanceQuery::sampleVelocityAdaptive(const float* pos, const flo
const int nd = dtClamp(ndivs, 1, DT_MAX_PATTERN_DIVS);
const int nr = dtClamp(nrings, 1, DT_MAX_PATTERN_RINGS);
const int nd2 = nd / 2;
const float da = (1.0f/nd) * DT_PI*2;
const float ca = cosf(da);
const float sa = sinf(da);

View File

@ -35,7 +35,6 @@ class SlideShow
void purgeImage();
bool loadImage(const char* path);
bool m_showSlides;
bool m_showCurSlide;
float m_slideAlpha;
int m_curSlide;

View File

@ -39,10 +39,13 @@ class TestCase
}
TestType type;
float spos[3], epos[3];
float nspos[3], nepos[3];
float spos[3];
float epos[3];
float nspos[3];
float nepos[3];
float radius;
int includeFlags, excludeFlags;
unsigned short includeFlags;
unsigned short excludeFlags;
bool expand;
float* straight;

View File

@ -118,12 +118,12 @@ static void subdivide(BoundsItem* items, int nitems, int imin, int imax, int tri
if (axis == 0)
{
// Sort along x-axis
qsort(items+imin, inum, sizeof(BoundsItem), compareItemX);
qsort(items+imin, static_cast<size_t>(inum), sizeof(BoundsItem), compareItemX);
}
else if (axis == 1)
{
// Sort along y-axis
qsort(items+imin, inum, sizeof(BoundsItem), compareItemY);
qsort(items+imin, static_cast<size_t>(inum), sizeof(BoundsItem), compareItemY);
}
int isplit = imin+inum/2;

View File

@ -672,7 +672,6 @@ class TempObstacleHilightTool : public SampleTool
Sample_TempObstacles* m_sample;
float m_hitPos[3];
bool m_hitPosSet;
float m_agentRadius;
int m_drawType;
public:
@ -680,7 +679,6 @@ public:
TempObstacleHilightTool() :
m_sample(0),
m_hitPosSet(false),
m_agentRadius(0),
m_drawType(DRAWDETAIL_AREAS)
{
m_hitPos[0] = m_hitPos[1] = m_hitPos[2] = 0;

View File

@ -146,7 +146,7 @@ bool TestCase::load(const char* filePath)
test->expand = false;
test->next = m_tests;
m_tests = test;
sscanf(row+2, "%f %f %f %f %f %f %x %x",
sscanf(row+2, "%f %f %f %f %f %f %hx %hx",
&test->spos[0], &test->spos[1], &test->spos[2],
&test->epos[0], &test->epos[1], &test->epos[2],
&test->includeFlags, &test->excludeFlags);
@ -160,7 +160,7 @@ bool TestCase::load(const char* filePath)
test->expand = false;
test->next = m_tests;
m_tests = test;
sscanf(row+2, "%f %f %f %f %f %f %x %x",
sscanf(row+2, "%f %f %f %f %f %f %hx %hx",
&test->spos[0], &test->spos[1], &test->spos[2],
&test->epos[0], &test->epos[1], &test->epos[2],
&test->includeFlags, &test->excludeFlags);
@ -204,8 +204,8 @@ void TestCase::doTests(dtNavMesh* navmesh, dtNavMeshQuery* navquery)
iter->nstraight = 0;
dtQueryFilter filter;
filter.setIncludeFlags((unsigned short)iter->includeFlags);
filter.setExcludeFlags((unsigned short)iter->excludeFlags);
filter.setIncludeFlags(iter->includeFlags);
filter.setExcludeFlags(iter->excludeFlags);
// Find start points
TimeVal findNearestPolyStart = getPerfTime();

View File

@ -139,7 +139,7 @@ int main(int /*argc*/, char** /*argv*/)
float timeAcc = 0.0f;
Uint32 prevFrameTime = SDL_GetTicks();
int mousePos[2] = {0, 0};
float origMousePos[2] = {0, 0}; // Used to compute mouse movement totals across frames.
int origMousePos[2] = {0, 0}; // Used to compute mouse movement totals across frames.
float cameraEulers[] = {45, -45};
float cameraPos[] = {0, 0, 0};