diff options
| author | jackpoz <giacomopoz@gmail.com> | 2015-07-03 23:21:09 +0200 |
|---|---|---|
| committer | DDuarte <dnpd.dd@gmail.com> | 2015-07-12 12:43:31 +0100 |
| commit | 0fd0529ed1cce57e19076302f748ec5f1a224f53 (patch) | |
| tree | 1c498894ddd56a6fa0c9e351d9be2ff40bcf9535 | |
| parent | 7cabfc74205a6a74365a5e12f34da5838adec2cd (diff) | |
Scripts/Commands: ".mmap path line" now uses raycast pathfinding
Add "line" optional parameter to ".mmap path" command to use raycast implementation of recast, useful to simulate charge paths.
(cherry picked from commit 37b157746e075294fd14abef5cc8e611b7bf2c76)
| -rw-r--r-- | src/server/scripts/Commands/cs_mmaps.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/server/scripts/Commands/cs_mmaps.cpp b/src/server/scripts/Commands/cs_mmaps.cpp index db3063fc693..a21fe324de3 100644 --- a/src/server/scripts/Commands/cs_mmaps.cpp +++ b/src/server/scripts/Commands/cs_mmaps.cpp @@ -87,6 +87,10 @@ public: if (para && strcmp(para, "true") == 0) useStraightPath = true; + bool useStraightLine = false; + if (para && strcmp(para, "line") == 0) + useStraightLine = true; + // unit locations float x, y, z; player->GetPosition(x, y, z); @@ -94,11 +98,11 @@ public: // path PathGenerator path(target); path.SetUseStraightPath(useStraightPath); - bool result = path.CalculatePath(x, y, z); + bool result = path.CalculatePath(x, y, z, false, useStraightLine); Movement::PointsArray const& pointPath = path.GetPath(); handler->PSendSysMessage("%s's path to %s:", target->GetName().c_str(), player->GetName().c_str()); - handler->PSendSysMessage("Building: %s", useStraightPath ? "StraightPath" : "SmoothPath"); + handler->PSendSysMessage("Building: %s", useStraightPath ? "StraightPath" : useStraightLine ? "Raycast" : "SmoothPath"); handler->PSendSysMessage("Result: %s - Length: %zu - Type: %u", (result ? "true" : "false"), pointPath.size(), path.GetPathType()); G3D::Vector3 const &start = path.GetStartPosition(); |
