From 2bb39f4fa589d1496e711e32739cb699f47f781d Mon Sep 17 00:00:00 2001 From: Aaron Kimbre Date: Wed, 16 Aug 2023 15:53:13 -0500 Subject: [PATCH] fixe some spacey string be smater about pausing --- dGame/dComponents/MovementAIComponentAronwk.cpp | 9 ++++----- dZoneManager/Zone.cpp | 7 +++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dGame/dComponents/MovementAIComponentAronwk.cpp b/dGame/dComponents/MovementAIComponentAronwk.cpp index 2de24a07..983466f5 100644 --- a/dGame/dComponents/MovementAIComponentAronwk.cpp +++ b/dGame/dComponents/MovementAIComponentAronwk.cpp @@ -11,16 +11,15 @@ #include "DestroyableComponent.h" void MovementAIComponent::HandleWaypointArrived(uint32_t commandIndex) { - Pause(); if (!m_Path){ - Resume(); + if(IsPaused()) Resume(); return; } if (commandIndex >= m_Path->pathWaypoints.at(m_CurrentPathWaypointIndex).commands.size()){ - Resume(); + if(IsPaused()) Resume(); return; } - + if(!IsPaused()) Pause(); const auto& data = m_Path->pathWaypoints.at(m_CurrentPathWaypointIndex).commands.at(commandIndex).data; const auto& command = m_Path->pathWaypoints.at(m_CurrentPathWaypointIndex).commands.at(commandIndex).command; float delay = 0.0f; @@ -150,7 +149,7 @@ void MovementAIComponent::HandleWaypointCommandUnequipInventory(const std::strin float MovementAIComponent::HandleWaypointCommandDelay(const std::string& data) { float delay = 0.0f; std::string delayString = data; - std::remove_if(delayString.begin(), delayString.end(), ::isspace); + delayString.erase(std::remove_if(delayString.begin(), delayString.end(), isspace), delayString.end()); GeneralUtils::TryParse(delayString, delay); return delay; } diff --git a/dZoneManager/Zone.cpp b/dZoneManager/Zone.cpp index 52fec5f2..d9da6755 100644 --- a/dZoneManager/Zone.cpp +++ b/dZoneManager/Zone.cpp @@ -549,8 +549,11 @@ void Zone::LoadPath(std::istream& file) { LDFBaseData* ldfConfig = nullptr; if (path.pathType == PathType::Movement || path.pathType == PathType::Rail) { - // :+1: - waypoint.commands.push_back(WaypointCommand(WaypointCommandType::StringToWaypointCommandType(parameter), value)); + // cause NetDevil puts spaces in things that don't need spaces + parameter.erase(std::remove_if(parameter.begin(), parameter.end(), isspace), parameter.end()); + auto waypointCommand = WaypointCommandType::StringToWaypointCommandType(parameter); + if(waypointCommand != eWaypointCommandType::INVALID) waypoint.commands.push_back(WaypointCommand(waypointCommand, value)); + else Game::logger->Log("Zone", "Tried to load invalid waypoint command '%s'", parameter.c_str()); } else { ldfConfig = LDFBaseData::DataFromString(parameter + "=" + value); if (ldfConfig) waypoint.config.push_back(ldfConfig);