diff --git a/include/omath/pathfinding/NavigationMesh.h b/include/omath/pathfinding/NavigationMesh.h index a3194f2..6143eff 100644 --- a/include/omath/pathfinding/NavigationMesh.h +++ b/include/omath/pathfinding/NavigationMesh.h @@ -32,7 +32,7 @@ namespace omath::pathfinding [[nodiscard]] std::vector Serialize() const; void Deserialize(const std::vector& raw); - + std::unordered_map> m_verTextMap; }; } \ No newline at end of file diff --git a/source/pathfinding/NavigationMesh.cpp b/source/pathfinding/NavigationMesh.cpp index 39ba6fb..b09e33d 100644 --- a/source/pathfinding/NavigationMesh.cpp +++ b/source/pathfinding/NavigationMesh.cpp @@ -30,7 +30,7 @@ namespace omath::pathfinding { auto dumpToVector =[](const T& t, std::vector& vec){ for (size_t i = 0; i < sizeof(t); i++) - vec.push_back(*(reinterpret_cast(&t)+i)); + vec.push_back(*(reinterpret_cast(&t)+i)); }; std::vector raw; @@ -52,8 +52,10 @@ namespace omath::pathfinding void NavigationMesh::Deserialize(const std::vector &raw) { - auto loadFromVector = [](const std::vector& vec, size_t& offset, auto& value) { - if (offset + sizeof(value) > vec.size()) { + auto loadFromVector = [](const std::vector& vec, size_t& offset, auto& value) + { + if (offset + sizeof(value) > vec.size()) + { throw std::runtime_error("Deserialize: Invalid input data size."); } std::memcpy(&value, vec.data() + offset, sizeof(value)); @@ -64,7 +66,8 @@ namespace omath::pathfinding size_t offset = 0; - while (offset < raw.size()) { + while (offset < raw.size()) + { Vector3 vertex; loadFromVector(raw, offset, vertex); @@ -74,7 +77,8 @@ namespace omath::pathfinding std::vector neighbors; neighbors.reserve(neighborsCount); - for (size_t i = 0; i < neighborsCount; ++i) { + for (size_t i = 0; i < neighborsCount; ++i) + { Vector3 neighbor; loadFromVector(raw, offset, neighbor); neighbors.push_back(neighbor);