diff options
author | Todd Stinson <stinson@lindenlab.com> | 2012-03-13 14:29:01 -0700 |
---|---|---|
committer | Todd Stinson <stinson@lindenlab.com> | 2012-03-13 14:29:01 -0700 |
commit | 9aa0c58c20f8d60dc2f674ce1eaa805db8f599c8 (patch) | |
tree | 898d792f8e7d8cc2a3137efaba483f5eee2fb995 /indra/newview | |
parent | 66374e4d656ae07d4dddc010e6239267ffe94b05 (diff) |
PATH-304: Using the embedded navmesh version information.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llpathfindingnavmesh.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp index 138295a8cf..740d1cde24 100644 --- a/indra/newview/llpathfindingnavmesh.cpp +++ b/indra/newview/llpathfindingnavmesh.cpp @@ -32,6 +32,9 @@ #include <string>
+#define NAVMESH_VERSION_FIELD "navmesh_version"
+#define NAVMESH_DATA_FIELD "navmesh_data"
+
//---------------------------------------------------------------------------
// LLPathfindingNavMesh
//---------------------------------------------------------------------------
@@ -98,11 +101,24 @@ void LLPathfindingNavMesh::handleNavMeshStart(U32 pNavMeshVersion) void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion)
{
+ if (pContent.has(NAVMESH_VERSION_FIELD))
+ {
+ llassert(pContent.get(NAVMESH_VERSION_FIELD).isInteger());
+ llassert(pContent.get(NAVMESH_VERSION_FIELD).asInteger() >= 0);
+ U32 embeddedNavMeshVersion = static_cast<U32>(pContent.get(NAVMESH_VERSION_FIELD).asInteger());
+ llassert(embeddedNavMeshVersion == pNavMeshVersion); // stinson 03/13/2012 : does this ever occur?
+ if (embeddedNavMeshVersion != pNavMeshVersion)
+ {
+ llwarns << "Mismatch between expected and embedded navmesh versions occurred" << llendl;
+ pNavMeshVersion = embeddedNavMeshVersion;
+ }
+ }
+
if (mNavMeshVersion == pNavMeshVersion)
{
- if ( pContent.has("navmesh_data") )
+ if ( pContent.has(NAVMESH_DATA_FIELD) )
{
- const LLSD::Binary &value = pContent["navmesh_data"].asBinary();
+ const LLSD::Binary &value = pContent.get(NAVMESH_DATA_FIELD).asBinary();
unsigned int binSize = value.size();
std::string newStr(reinterpret_cast<const char *>(&value[0]), binSize);
std::istringstream streamdecomp( newStr );
|