Address a few compile errors. Correct spacing in HandleMmapPathCommand.

This commit is contained in:
kaelima committed 2012-09-28 15:04:47 +02:00
1 parent ad0cd9f40a
commit 753f43718e
12 files changed
+89 -81

No files matched your search

+41 -43
View File
@@ -60,60 +60,58 @@ public:
static bool HandleMmapPathCommand(ChatHandler* handler, char const* args)
{
if (!MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId()))
{
handler->PSendSysMessage("NavMesh not loaded for current map.");
return true;
}
if (!MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId()))
{
handler->PSendSysMessage("NavMesh not loaded for current map.");
return true;
}
handler->PSendSysMessage("mmap path:");
handler->PSendSysMessage("mmap path:");
// units
Player* player = handler->GetSession()->GetPlayer();
Unit* target = handler->getSelectedUnit();
if (!player || !target)
{
handler->PSendSysMessage("Invalid target/source selection.");
return true;
}
// units
Player* player = handler->GetSession()->GetPlayer();
Unit* target = handler->getSelectedUnit();
if (!player || !target)
{
handler->PSendSysMessage("Invalid target/source selection.");
return true;
}
char* para = strtok((char*)args, " ");
char* para = strtok((char*)args, " ");
bool useStraightPath = false;
if (para && strcmp(para, "true") == 0)
useStraightPath = true;
bool useStraightPath = false;
if (para && strcmp(para, "true") == 0)
useStraightPath = true;
// unit locations
float x, y, z;
player->GetPosition(x, y, z);
// unit locations
float x, y, z;
player->GetPosition(x, y, z);
// path
PathGenerator path(target);
path.SetUseStraightPath(useStraightPath);
path.CalculatePath(x, y, z);
// path
PathGenerator path(target);
path.SetUseStraightPath(useStraightPath);
bool result = path.CalculatePath(x, y, z);
PointsArray pointPath = path.GetPath();
handler->PSendSysMessage("%s's path to %s:", target->GetName(), player->GetName());
handler->PSendSysMessage("Building %s", useStraightPath ? "StraightPath" : "SmoothPath");
handler->PSendSysMessage("length %i type %u", pointPath.size(), path.GetPathType());
PointsArray pointPath = path.GetPath();
handler->PSendSysMessage("%s's path to %s:", target->GetName(), player->GetName());
handler->PSendSysMessage("Building: %s", useStraightPath ? "StraightPath" : "SmoothPath");
handler->PSendSysMessage("Result: %s - Length: %i - Type: %u", (result ? "true" : "false"), pointPath.size(), path.GetPathType());
Vector3 start = path.GetStartPosition();
Vector3 end = path.GetEndPosition();
Vector3 actualEnd = path.GetActualEndPosition();
Vector3 start = path.GetStartPosition();
Vector3 end = path.GetEndPosition();
Vector3 actualEnd = path.GetActualEndPosition();
handler->PSendSysMessage("start (%.3f, %.3f, %.3f)", start.x, start.y, start.z);
handler->PSendSysMessage("end (%.3f, %.3f, %.3f)", end.x, end.y, end.z);
handler->PSendSysMessage("actual end (%.3f, %.3f, %.3f)", actualEnd.x, actualEnd.y, actualEnd.z);
handler->PSendSysMessage("StartPosition (%.3f, %.3f, %.3f)", start.x, start.y, start.z);
handler->PSendSysMessage("EndPosition (%.3f, %.3f, %.3f)", end.x, end.y, end.z);
handler->PSendSysMessage("ActualEndPosition (%.3f, %.3f, %.3f)", actualEnd.x, actualEnd.y, actualEnd.z);
if (!player->isGameMaster())
handler->PSendSysMessage("Enable GM mode to see the path points.");
if (!player->isGameMaster())
handler->PSendSysMessage("Enable GM mode to see the path points.");
// this entry visible only to GM's with "gm on"
static const uint32 WAYPOINT_NPC_ENTRY = 1;
for (uint32 i = 0; i < pointPath.size(); ++i)
player->SummonCreature(WAYPOINT_NPC_ENTRY, pointPath[i].x, pointPath[i].y, pointPath[i].z, 0, TEMPSUMMON_TIMED_DESPAWN, 9000);
for (uint32 i = 0; i < pointPath.size(); ++i)
player->SummonCreature(VISUAL_WAYPOINT, pointPath[i].x, pointPath[i].y, pointPath[i].z, 0, TEMPSUMMON_TIMED_DESPAWN, 9000);
return true;
return true;
}
static bool HandleMmapLocCommand(ChatHandler* handler, const char* args)
@@ -290,4 +288,4 @@ public:
void AddSC_mmaps_commandscript()
{
new mmaps_commandscript();
}
}