Better navmesh handling

This commit is contained in:
Benau 2015-12-02 10:41:32 +08:00
parent 084a4ee844
commit b5d4610f45
2 changed files with 11 additions and 9 deletions

View File

@ -41,6 +41,11 @@ NavMesh::NavMesh(const std::string &filename)
m_n_polys=0;
XMLNode *xml = file_manager->createXMLTree(filename);
if(xml->getName()!="navmesh")
{
Log::error("NavMesh", "NavMesh is invalid. \n");
return;
}
// Assigning m_nav_mesh here because constructing NavPoly requires m_nav_mesh to be defined
m_nav_mesh = this;

View File

@ -585,16 +585,13 @@ void Track::loadTrackInfo()
delete easter;
}
XMLNode *navmesh = file_manager->createXMLTree(m_root+"navmesh.xml");
if(!navmesh || navmesh->getName()!="navmesh")
{
Log::warn("Track", "NavMesh is not found for this arena, "
"disable AI for it.\n");
}
else
if(file_manager->fileExists(m_root+"navmesh.xml"))
m_has_navmesh = true;
delete navmesh;
else if (m_is_arena)
{
Log::warn("Track", "NavMesh is not found for arena %s, "
"disable AI for it.\n", m_name.c_str());
}
} // loadTrackInfo