Add pathfinding interfaces, still heavily wip

This commit is contained in:
KimLS
2017-07-18 00:01:59 -07:00
parent 596e3b28b5
commit 5f1063acb9
26 changed files with 705 additions and 1181 deletions
+68 -65
View File
@@ -673,76 +673,79 @@ void QuestManager::repopzone() {
}
void QuestManager::ConnectNodeToNode(int node1, int node2, int teleport, int doorid) {
if (!node1 || !node2)
{
Log(Logs::General, Logs::Quests, "QuestManager::ConnectNodeToNode called without node1 or node2. Probably syntax error in quest file.");
}
else
{
if (!teleport)
{
teleport = 0;
}
else if (teleport == 1 || teleport == -1)
{
teleport = -1;
}
if (!doorid)
{
doorid = 0;
}
if (!zone->pathing)
{
// if no pathing bits available, make them available.
zone->pathing = new PathManager();
}
if (zone->pathing)
{
zone->pathing->ConnectNodeToNode(node1, node2, teleport, doorid);
Log(Logs::Moderate, Logs::Quests, "QuestManager::ConnectNodeToNode connecting node %i to node %i.", node1, node2);
}
}
//PATHING TODO
//if (!node1 || !node2)
//{
// Log(Logs::General, Logs::Quests, "QuestManager::ConnectNodeToNode called without node1 or node2. Probably syntax error in quest file.");
//}
//else
//{
// if (!teleport)
// {
// teleport = 0;
// }
// else if (teleport == 1 || teleport == -1)
// {
// teleport = -1;
// }
//
// if (!doorid)
// {
// doorid = 0;
// }
//
// if (!zone->pathing)
// {
// // if no pathing bits available, make them available.
// zone->pathing = new PathManager();
// }
//
// if (zone->pathing)
// {
// zone->pathing->ConnectNodeToNode(node1, node2, teleport, doorid);
// Log(Logs::Moderate, Logs::Quests, "QuestManager::ConnectNodeToNode connecting node %i to node %i.", node1, node2);
// }
//}
}
void QuestManager::AddNode(float x, float y, float z, float best_z, int32 requested_id)
{
if (!x || !y || !z)
{
Log(Logs::General, Logs::Quests, "QuestManager::AddNode called without x, y, z. Probably syntax error in quest file.");
}
//PATHING TODO
if (!best_z || best_z == 0)
{
if (zone->zonemap)
{
glm::vec3 loc(x, y, z);
best_z = zone->zonemap->FindBestZ(loc, nullptr);
}
else
{
best_z = z;
}
}
if (!requested_id)
{
requested_id = 0;
}
if (!zone->pathing)
{
// if no pathing bits available, make them available.
zone->pathing = new PathManager();
}
if (zone->pathing)
{
zone->pathing->AddNode(x, y, z, best_z, requested_id);
Log(Logs::Moderate, Logs::Quests, "QuestManager::AddNode adding node at (%i, %i, %i).", x, y, z);
}
//if (!x || !y || !z)
//{
// Log(Logs::General, Logs::Quests, "QuestManager::AddNode called without x, y, z. Probably syntax error in quest file.");
//}
//
//if (!best_z || best_z == 0)
//{
// if (zone->zonemap)
// {
// glm::vec3 loc(x, y, z);
// best_z = zone->zonemap->FindBestZ(loc, nullptr);
// }
// else
// {
// best_z = z;
// }
//}
//
//if (!requested_id)
//{
// requested_id = 0;
//}
//
//if (!zone->pathing)
//{
// // if no pathing bits available, make them available.
// zone->pathing = new PathManager();
//}
//
//if (zone->pathing)
//{
// zone->pathing->AddNode(x, y, z, best_z, requested_id);
// Log(Logs::Moderate, Logs::Quests, "QuestManager::AddNode adding node at (%i, %i, %i).", x, y, z);
//}
}
void QuestManager::settarget(const char *type, int target_id) {