From 66374e4d656ae07d4dddc010e6239267ffe94b05 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 13 Mar 2012 11:59:44 -0700 Subject: PATH-304: Proper handling of the sim-to-viewer message. --- indra/newview/llpathfindingmanager.cpp | 12 ++++++++---- indra/newview/llpathfindingnavmeshstatus.cpp | 27 ++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index f3b9bc4b8a..251e330914 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -41,6 +41,7 @@ #include "llpathfindinglinkset.h" #include "llpathfindinglinksetlist.h" #include "llhttpnode.h" +//#include "llpathfindingnavmeshzone.h" // XXX #include #include @@ -57,6 +58,7 @@ #define CAP_SERVICE_TERRAIN_LINKSETS "TerrainNavMeshProperties" #define SIM_MESSAGE_NAVMESH_STATUS_UPDATE "/message/NavMeshStatusUpdate" +#define SIM_MESSAGE_BODY_FIELD "body" //--------------------------------------------------------------------------- // LLNavMeshSimStateChangeNode @@ -628,10 +630,12 @@ LLViewerRegion *LLPathfindingManager::getCurrentRegion() const void LLNavMeshSimStateChangeNode::post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const { #ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "Received NavMeshStatusUpdate: " << pContext << llendl; + llinfos << "STINSON DEBUG: Received NavMeshStatusUpdate: " << pInput << llendl; #endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - LLPathfindingNavMeshStatus navMeshStatus(pContext); - LLPathfindingManager::getInstance()->handleNavMeshStatusUpdate(pContext); + llassert(pInput.has(SIM_MESSAGE_BODY_FIELD)); + llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).isMap()); + LLPathfindingNavMeshStatus navMeshStatus(pInput.get(SIM_MESSAGE_BODY_FIELD)); + LLPathfindingManager::getInstance()->handleNavMeshStatusUpdate(navMeshStatus); } //--------------------------------------------------------------------------- @@ -656,7 +660,7 @@ NavMeshStatusResponder::~NavMeshStatusResponder() void NavMeshStatusResponder::result(const LLSD &pContent) { #ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "Received requested NavMeshStatus: " << pContent << llendl; + llinfos << "STINSON DEBUG: Received requested NavMeshStatus: " << pContent << llendl; #endif // XXX_STINSON_DEBUG_NAVMESH_ZONE LLPathfindingNavMeshStatus navMeshStatus(mRegionUUID, pContent); LLPathfindingManager::getInstance()->handleNavMeshStatusRequest(navMeshStatus, mRegion); diff --git a/indra/newview/llpathfindingnavmeshstatus.cpp b/indra/newview/llpathfindingnavmeshstatus.cpp index 67be0459a5..2ef892c8cd 100644 --- a/indra/newview/llpathfindingnavmeshstatus.cpp +++ b/indra/newview/llpathfindingnavmeshstatus.cpp @@ -33,8 +33,9 @@ #include -#define REGION_FIELD "region" -#define STATE_FIELD "state" +#define REGION_FIELD "region_id" +#define DEPRECATED_STATE_FIELD "state" +#define STATUS_FIELD "status" #define VERSION_FIELD "version" const std::string LLPathfindingNavMeshStatus::sStatusPending("pending"); @@ -106,9 +107,25 @@ void LLPathfindingNavMeshStatus::parseStatus(const LLSD &pContent) llassert(pContent.get(VERSION_FIELD).asInteger() >= 0); mVersion = static_cast(pContent.get(VERSION_FIELD).asInteger()); - llassert(pContent.has(STATE_FIELD)); - llassert(pContent.get(STATE_FIELD).isString()); - std::string status = pContent.get(STATE_FIELD).asString(); +#ifdef DEPRECATED_STATE_FIELD + std::string status; + if (pContent.has(DEPRECATED_STATE_FIELD)) + { + llassert(pContent.has(DEPRECATED_STATE_FIELD)); + llassert(pContent.get(DEPRECATED_STATE_FIELD).isString()); + status = pContent.get(DEPRECATED_STATE_FIELD).asString(); + } + else + { + llassert(pContent.has(STATUS_FIELD)); + llassert(pContent.get(STATUS_FIELD).isString()); + status = pContent.get(STATUS_FIELD).asString(); + } +#else // DEPRECATED_STATE_FIELD + llassert(pContent.has(STATUS_FIELD)); + llassert(pContent.get(STATUS_FIELD).isString()); + std::string status = pContent.get(STATUS_FIELD).asString(); +#endif // DEPRECATED_STATE_FIELD if (LLStringUtil::compareStrings(status, sStatusPending)) { -- cgit v1.2.3