Convert enum to enum class

This commit is contained in:
Graham Pentheny
2025-07-29 23:20:59 -04:00
parent 12ce3c2368
commit 26fd33d188
2 changed files with 9 additions and 8 deletions

View File

@@ -20,14 +20,15 @@
#include "DetourNavMesh.h"
#include <cstdint>
#include <string>
class TestCase
{
enum TestType
enum class TestType : uint8_t
{
TEST_PATHFIND,
TEST_RAYCAST
PATHFIND,
RAYCAST
};
struct Test
@@ -43,7 +44,7 @@ class TestCase
delete[] polys;
}
TestType type{};
TestCase::TestType type{};
float spos[3]{};
float epos[3]{};
float nspos[3]{};

View File

@@ -164,7 +164,7 @@ bool TestCase::load(const std::string& filePath)
{
// Pathfind test.
Test* test = new Test();
test->type = TEST_PATHFIND;
test->type = TestCase::TestType::PATHFIND;
test->expand = false;
test->next = tests;
tests = test;
@@ -184,7 +184,7 @@ bool TestCase::load(const std::string& filePath)
{
// Pathfind test.
Test* test = new Test();
test->type = TEST_RAYCAST;
test->type = TestCase::TestType::RAYCAST;
test->expand = false;
test->next = tests;
tests = test;
@@ -258,7 +258,7 @@ void TestCase::doTests(dtNavMesh* navmesh, dtNavMeshQuery* navquery)
continue;
}
if (iter->type == TEST_PATHFIND)
if (iter->type == TestCase::TestType::PATHFIND)
{
// Find path
TimeVal findPathStart = getPerfTime();
@@ -299,7 +299,7 @@ void TestCase::doTests(dtNavMesh* navmesh, dtNavMeshQuery* navquery)
memcpy(iter->straight, straight, sizeof(float) * 3 * iter->nstraight);
}
}
else if (iter->type == TEST_RAYCAST)
else if (iter->type == TestCase::TestType::RAYCAST)
{
float t = 0;
float hitNormal[3], hitPos[3];