From a3b62d60f0be2c490fe5b7aeccdb7ae8c67e1171 Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Thu, 10 Aug 2023 01:55:35 -0700 Subject: [PATCH] fixes and testing Bounce works add null check and default --- dGame/dComponents/MovementAIComponent.cpp | 4 ++-- dGame/dComponents/MovementAIComponentAronwk.cpp | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dGame/dComponents/MovementAIComponent.cpp b/dGame/dComponents/MovementAIComponent.cpp index 5e14050c..13127fe6 100644 --- a/dGame/dComponents/MovementAIComponent.cpp +++ b/dGame/dComponents/MovementAIComponent.cpp @@ -70,7 +70,7 @@ void MovementAIComponent::SetupPath(const std::string& pathname) { waypoints.push_back(waypoint.position); } SetPath(waypoints); - SetMaxSpeed(3.0f); + SetMaxSpeed(30.0f); } else { Game::logger->Log("MovementAIComponent", "No path found for %i:%llu", m_Parent->GetLOT(), m_Parent->GetObjectID()); } @@ -152,7 +152,7 @@ void MovementAIComponent::Update(const float deltaTime) { HandleWaypointArrived(); if (!AdvancePathWaypointIndex()) { if (m_Path && m_Path->pathBehavior == PathBehavior::Bounce) { - ReversePath(); // untested. + ReversePath(); } else if (m_Path && m_Path->pathBehavior == PathBehavior::Loop) { m_CurrentPathWaypointIndex = 0; m_NextPathWaypointIndex = 0; diff --git a/dGame/dComponents/MovementAIComponentAronwk.cpp b/dGame/dComponents/MovementAIComponentAronwk.cpp index 1dc57edc..f03ad67d 100644 --- a/dGame/dComponents/MovementAIComponentAronwk.cpp +++ b/dGame/dComponents/MovementAIComponentAronwk.cpp @@ -4,6 +4,7 @@ #include "eWaypointCommandType.h" void MovementAIComponent::HandleWaypointArrived() { + if (!m_Path) return; if (m_Path->pathWaypoints[m_CurrentPathWaypointIndex].commands.empty()) return; for(auto [command, data] : m_Path->pathWaypoints[m_CurrentPathWaypointIndex].commands){ switch(command){ @@ -75,6 +76,7 @@ void MovementAIComponent::HandleWaypointArrived() { Game::logger->Log("MovementAIComponentAronwk", "Unusable Command %i", command); break; case eWaypointCommandType::INVALID: + default: Game::logger->LogDebug("MovementAIComponentAronwk", "Got invalid waypoint command %i", command); break; }