diff --git a/dGame/dComponents/MovementAIComponentAronwk.cpp b/dGame/dComponents/MovementAIComponentAronwk.cpp index 983466f5..e8993c2d 100644 --- a/dGame/dComponents/MovementAIComponentAronwk.cpp +++ b/dGame/dComponents/MovementAIComponentAronwk.cpp @@ -73,7 +73,7 @@ void MovementAIComponent::HandleWaypointArrived(uint32_t commandIndex) { GameMessages::SendPlayNDAudioEmitter(m_Parent, UNASSIGNED_SYSTEM_ADDRESS, data); break; case eWaypointCommandType::BOUNCE: - Game::logger->LogDebug("MovementAIComponent", "Unable to process bounce waypoint command server side"); + Game::logger->LogDebug("MovementAIComponent", "Unable to process bounce waypoint command server side!"); break; case eWaypointCommandType::INVALID: default: @@ -111,7 +111,7 @@ void MovementAIComponent::HandleWaypointCommandCastSkill(const std::string& data return; } uint32_t skillId = 0; - GeneralUtils::TryParse(data, skillId); + if (!GeneralUtils::TryParse(data, skillId)) return; if (skillId != 0) skillComponent->CastSkill(skillId); return; } @@ -149,8 +149,7 @@ void MovementAIComponent::HandleWaypointCommandUnequipInventory(const std::strin float MovementAIComponent::HandleWaypointCommandDelay(const std::string& data) { float delay = 0.0f; std::string delayString = data; - delayString.erase(std::remove_if(delayString.begin(), delayString.end(), isspace), delayString.end()); - GeneralUtils::TryParse(delayString, delay); + if (!GeneralUtils::TryParse(delayString, delay)) return; return delay; } @@ -166,7 +165,7 @@ void MovementAIComponent::HandleWaypointCommandTeleport(const std::string& data) void MovementAIComponent::HandleWaypointCommandPathSpeed(const std::string& data) { float speed = 0.0; - GeneralUtils::TryParse(data, speed); + if (!GeneralUtils::TryParse(data, speed)) return; SetCurrentSpeed(speed); } @@ -187,7 +186,7 @@ void MovementAIComponent::HandleWaypointCommandRemoveNPC(const std::string& data return; } uint32_t factionID = -1; - GeneralUtils::TryParse(data, factionID); + if (!GeneralUtils::TryParse(data, factionID)) return; if (destroyableComponent->BelongsToFaction(factionID)) m_Parent->Kill(); } } @@ -199,7 +198,7 @@ void MovementAIComponent::HandleWaypointCommandChangeWaypoint(const std::string& if (data.find(",") != std::string::npos){ auto datas = GeneralUtils::SplitString(data, ','); path_string = datas.at(0); - GeneralUtils::TryParse(datas.at(1), index); + if (!GeneralUtils::TryParse(datas.at(1), index)) return; } else path_string = data; if (path_string != "") { @@ -210,7 +209,7 @@ void MovementAIComponent::HandleWaypointCommandChangeWaypoint(const std::string& void MovementAIComponent::HandleWaypointCommandSpawnObject(const std::string& data) { LOT newObjectLOT = 0; - GeneralUtils::TryParse(data, newObjectLOT); + if (!GeneralUtils::TryParse(data, newObjectLOT)) return; EntityInfo info{}; info.lot = newObjectLOT; info.pos = m_Parent->GetPosition(); diff --git a/dZoneManager/Zone.cpp b/dZoneManager/Zone.cpp index d9da6755..5c02b29f 100644 --- a/dZoneManager/Zone.cpp +++ b/dZoneManager/Zone.cpp @@ -550,9 +550,10 @@ void Zone::LoadPath(std::istream& file) { LDFBaseData* ldfConfig = nullptr; if (path.pathType == PathType::Movement || path.pathType == PathType::Rail) { // cause NetDevil puts spaces in things that don't need spaces - parameter.erase(std::remove_if(parameter.begin(), parameter.end(), isspace), parameter.end()); + 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)); + if (waypointCommand == eWaypointCommandType::DELAY) value.erase(std::remove_if(value.begin(), value.end(), ::isspace), value.end()); + 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);