fix(Scripts/Commands): Fix assertion error on mmaps path command (#13704)

This commit is contained in:
Mickaël Mauger
2022-11-16 05:24:27 +01:00
committed by GitHub
parent 772fe38fe9
commit 2e5e3bda5d

View File

@@ -61,7 +61,7 @@ public:
return commandTable; return commandTable;
} }
static bool HandleMmapPathCommand(ChatHandler* handler, Optional<std::string> para) static bool HandleMmapPathCommand(ChatHandler* handler, Optional<std::string> param)
{ {
if (!MMAP::MMapFactory::createOrGetMMapMgr()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId())) if (!MMAP::MMapFactory::createOrGetMMapMgr()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId()))
{ {
@@ -81,14 +81,20 @@ public:
} }
bool useStraightPath = false; bool useStraightPath = false;
if (StringStartsWith("true", *para))
useStraightPath = true;
bool useRaycast = false; bool useRaycast = false;
if (StringStartsWith("line", *para) || StringStartsWith("ray", *para) || StringStartsWith("raycast", *para)) if (param)
{
auto paramValue = param.value();
if (paramValue.starts_with("true"))
{
useStraightPath = true;
}
if (paramValue.starts_with("line") || paramValue.starts_with("ray") || paramValue.starts_with("raycast"))
{ {
useRaycast = true; useRaycast = true;
} }
}
// unit locations // unit locations
float x, y, z; float x, y, z;