From 26fd33d1880bd9e47dbffaa873f24e8fc0facb7d Mon Sep 17 00:00:00 2001 From: Graham Pentheny Date: Tue, 29 Jul 2025 23:20:59 -0400 Subject: [PATCH] Convert enum to enum class --- RecastDemo/Include/TestCase.h | 9 +++++---- RecastDemo/Source/TestCase.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/RecastDemo/Include/TestCase.h b/RecastDemo/Include/TestCase.h index 7d2e1ccb..86aa05ad 100644 --- a/RecastDemo/Include/TestCase.h +++ b/RecastDemo/Include/TestCase.h @@ -20,14 +20,15 @@ #include "DetourNavMesh.h" +#include #include 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]{}; diff --git a/RecastDemo/Source/TestCase.cpp b/RecastDemo/Source/TestCase.cpp index d6280233..e6783933 100644 --- a/RecastDemo/Source/TestCase.cpp +++ b/RecastDemo/Source/TestCase.cpp @@ -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];