Merge pull request #76 from grahamboree/warnings

Removed a smattering of compiler warnings
This commit is contained in:
Ben Hymers 2016-01-14 15:28:02 +00:00
commit a25b018be9
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 // find the threshold hit time to bail out based on the early out penalty
// (see how the penalty is calculated below to understnad) // (see how the penalty is calculated below to understnad)
float minPen = minPenalty - vpen - vcpen; 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) if (tThresold - m_params.horizTime > -FLT_EPSILON)
return minPenalty; // already too much 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 nd = dtClamp(ndivs, 1, DT_MAX_PATTERN_DIVS);
const int nr = dtClamp(nrings, 1, DT_MAX_PATTERN_RINGS); 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 da = (1.0f/nd) * DT_PI*2;
const float ca = cosf(da); const float ca = cosf(da);
const float sa = sinf(da); const float sa = sinf(da);

View File

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

View File

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

View File

@ -118,12 +118,12 @@ static void subdivide(BoundsItem* items, int nitems, int imin, int imax, int tri
if (axis == 0) if (axis == 0)
{ {
// Sort along x-axis // 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) else if (axis == 1)
{ {
// Sort along y-axis // 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; int isplit = imin+inum/2;

View File

@ -672,7 +672,6 @@ class TempObstacleHilightTool : public SampleTool
Sample_TempObstacles* m_sample; Sample_TempObstacles* m_sample;
float m_hitPos[3]; float m_hitPos[3];
bool m_hitPosSet; bool m_hitPosSet;
float m_agentRadius;
int m_drawType; int m_drawType;
public: public:
@ -680,7 +679,6 @@ public:
TempObstacleHilightTool() : TempObstacleHilightTool() :
m_sample(0), m_sample(0),
m_hitPosSet(false), m_hitPosSet(false),
m_agentRadius(0),
m_drawType(DRAWDETAIL_AREAS) m_drawType(DRAWDETAIL_AREAS)
{ {
m_hitPos[0] = m_hitPos[1] = m_hitPos[2] = 0; 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->expand = false;
test->next = m_tests; test->next = m_tests;
m_tests = test; 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->spos[0], &test->spos[1], &test->spos[2],
&test->epos[0], &test->epos[1], &test->epos[2], &test->epos[0], &test->epos[1], &test->epos[2],
&test->includeFlags, &test->excludeFlags); &test->includeFlags, &test->excludeFlags);
@ -160,7 +160,7 @@ bool TestCase::load(const char* filePath)
test->expand = false; test->expand = false;
test->next = m_tests; test->next = m_tests;
m_tests = test; 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->spos[0], &test->spos[1], &test->spos[2],
&test->epos[0], &test->epos[1], &test->epos[2], &test->epos[0], &test->epos[1], &test->epos[2],
&test->includeFlags, &test->excludeFlags); &test->includeFlags, &test->excludeFlags);
@ -204,8 +204,8 @@ void TestCase::doTests(dtNavMesh* navmesh, dtNavMeshQuery* navquery)
iter->nstraight = 0; iter->nstraight = 0;
dtQueryFilter filter; dtQueryFilter filter;
filter.setIncludeFlags((unsigned short)iter->includeFlags); filter.setIncludeFlags(iter->includeFlags);
filter.setExcludeFlags((unsigned short)iter->excludeFlags); filter.setExcludeFlags(iter->excludeFlags);
// Find start points // Find start points
TimeVal findNearestPolyStart = getPerfTime(); TimeVal findNearestPolyStart = getPerfTime();

View File

@ -139,7 +139,7 @@ int main(int /*argc*/, char** /*argv*/)
float timeAcc = 0.0f; float timeAcc = 0.0f;
Uint32 prevFrameTime = SDL_GetTicks(); Uint32 prevFrameTime = SDL_GetTicks();
int mousePos[2] = {0, 0}; 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 cameraEulers[] = {45, -45};
float cameraPos[] = {0, 0, 0}; float cameraPos[] = {0, 0, 0};