From c990cc71ce124059a072c7778ac962253bacb199 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 12 Mar 2012 19:18:19 -0700 Subject: PATH-304: Adding an extra state for the pathfinding console to report that the status of the navmesh is being checked. --- indra/newview/llfloaterpathfindingconsole.cpp | 7 +++++++ indra/newview/llfloaterpathfindingconsole.h | 1 + indra/newview/llpathfindingmanager.cpp | 4 +++- indra/newview/llpathfindingnavmesh.cpp | 22 +++++++++++++++++++--- indra/newview/llpathfindingnavmesh.h | 4 +++- indra/newview/llpathfindingnavmeshzone.cpp | 11 +++++++++++ indra/newview/llpathfindingnavmeshzone.h | 1 + .../default/xui/en/floater_pathfinding_console.xml | 1 + 8 files changed, 46 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 493b4617b5..487ef0933a 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -618,6 +618,9 @@ void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENav case LLPathfindingNavMeshZone::kNavMeshZoneRequestUnknown : setConsoleState(kConsoleStateUnknown); break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestChecking : + setConsoleState(kConsoleStateCheckingVersion); + break; case LLPathfindingNavMeshZone::kNavMeshZoneRequestNeedsUpdate : mIsNavMeshUpdating = true; mNavMeshZone.refresh(); @@ -677,6 +680,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mHasStartPoint = false; mHasEndPoint = false; break; + case kConsoleStateCheckingVersion : case kConsoleStateDownloading : case kConsoleStateError : mShowNavMeshCheckBox->setEnabled(FALSE); @@ -736,6 +740,9 @@ void LLFloaterPathfindingConsole::updateStatusOnConsoleState() statusText = getString("navmesh_status_region_not_enabled"); styleParams.color = warningColor; break; + case kConsoleStateCheckingVersion : + statusText = getString("navmesh_status_checking_version"); + break; case kConsoleStateDownloading : if (mIsNavMeshUpdating) { diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index 8c29bf5909..c58dc83653 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -120,6 +120,7 @@ private: kConsoleStateUnknown, kConsoleStateLibraryNotImplemented, kConsoleStateRegionNotEnabled, + kConsoleStateCheckingVersion, kConsoleStateDownloading, kConsoleStateHasNavMesh, kConsoleStateError diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 9cd3d5625c..9abd9fda1a 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -274,11 +274,13 @@ void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion) } else { + navMeshPtr->handleNavMeshCheckVersion(); LLHTTPClient::ResponderPtr navMeshStatusResponder = new NavMeshStatusResponder(navMeshStatusURL, pRegion); LLHTTPClient::get(navMeshStatusURL, navMeshStatusResponder); } #else // DEPRECATED_UNVERSIONED_NAVMESH llassert(!navMeshStatusURL.empty()); + navMeshPtr->handleNavMeshCheckVersion(); LLHTTPClient::ResponderPtr navMeshStatusResponder = new NavMeshStatusResponder(navMeshStatusURL, pRegion); LLHTTPClient::get(navMeshStatusURL, navMeshStatusResponder); #endif // DEPRECATED_UNVERSIONED_NAVMESH @@ -297,7 +299,7 @@ void LLPathfindingManager::handleNavMeshStatusRequest(const LLPathfindingNavMesh { if (navMeshPtr->hasNavMeshVersion(pNavMeshStatus.getVersion())) { - navMeshPtr->handleRefresh(); + navMeshPtr->handleRefresh(pNavMeshStatus.getVersion()); } else { diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp index 81fa7b24db..138295a8cf 100644 --- a/indra/newview/llpathfindingnavmesh.cpp +++ b/indra/newview/llpathfindingnavmesh.cpp @@ -56,12 +56,28 @@ LLPathfindingNavMesh::navmesh_slot_t LLPathfindingNavMesh::registerNavMeshListen bool LLPathfindingNavMesh::hasNavMeshVersion(U32 pNavMeshVersion) const { - return (((mNavMeshRequestStatus == kNavMeshRequestStarted) || (mNavMeshRequestStatus == kNavMeshRequestCompleted)) && (mNavMeshVersion == pNavMeshVersion)); + return ((mNavMeshVersion == pNavMeshVersion) && + ((mNavMeshRequestStatus == kNavMeshRequestStarted) || (mNavMeshRequestStatus == kNavMeshRequestCompleted) || + ((mNavMeshRequestStatus == kNavMeshRequestChecking) && !mNavMeshData.empty()))); } -void LLPathfindingNavMesh::handleRefresh() +void LLPathfindingNavMesh::handleRefresh(U32 pNavMeshVersion) { - mNavMeshSignal(mNavMeshRequestStatus, mRegionUUID, mNavMeshVersion, mNavMeshData); + llassert(pNavMeshVersion == mNavMeshVersion); + if (mNavMeshRequestStatus == kNavMeshRequestChecking) + { + llassert(!mNavMeshData.empty()); + setRequestStatus(kNavMeshRequestCompleted); + } + else + { + mNavMeshSignal(mNavMeshRequestStatus, mRegionUUID, mNavMeshVersion, mNavMeshData); + } +} + +void LLPathfindingNavMesh::handleNavMeshCheckVersion() +{ + setRequestStatus(kNavMeshRequestChecking); } void LLPathfindingNavMesh::handleNavMeshNewVersion(U32 pNavMeshVersion) diff --git a/indra/newview/llpathfindingnavmesh.h b/indra/newview/llpathfindingnavmesh.h index 3bdb485d37..46a114439a 100644 --- a/indra/newview/llpathfindingnavmesh.h +++ b/indra/newview/llpathfindingnavmesh.h @@ -50,6 +50,7 @@ class LLPathfindingNavMesh public: typedef enum { kNavMeshRequestUnknown, + kNavMeshRequestChecking, kNavMeshRequestNeedsUpdate, kNavMeshRequestStarted, kNavMeshRequestCompleted, @@ -72,7 +73,8 @@ public: bool hasNavMeshVersion(U32 pNavMeshVersion) const; - void handleRefresh(); + void handleNavMeshCheckVersion(); + void handleRefresh(U32 pNavMeshVersion); void handleNavMeshNewVersion(U32 pNavMeshVersion); void handleNavMeshStart(U32 pNavMeshVersion); void handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion); diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 83238ec869..8e558c3b00 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -140,6 +140,7 @@ void LLPathfindingNavMeshZone::handleNavMeshLocation() void LLPathfindingNavMeshZone::updateStatus() { bool hasRequestUnknown = false; + bool hasRequestChecking = false; bool hasRequestNeedsUpdate = false; bool hasRequestStarted = false; bool hasRequestCompleted = false; @@ -161,6 +162,9 @@ void LLPathfindingNavMeshZone::updateStatus() case LLPathfindingNavMesh::kNavMeshRequestUnknown : hasRequestUnknown = true; break; + case LLPathfindingNavMesh::kNavMeshRequestChecking : + hasRequestChecking = true; + break; case LLPathfindingNavMesh::kNavMeshRequestNeedsUpdate : hasRequestNeedsUpdate = true; break; @@ -189,6 +193,13 @@ void LLPathfindingNavMeshZone::updateStatus() zoneRequestStatus = kNavMeshZoneRequestNeedsUpdate; #ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE llinfos << "STINSON DEBUG: Navmesh zone update is NEEDS UPDATE" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestChecking) + { + zoneRequestStatus = kNavMeshZoneRequestChecking; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is CHECKING" << llendl; #endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestStarted) diff --git a/indra/newview/llpathfindingnavmeshzone.h b/indra/newview/llpathfindingnavmeshzone.h index 833f3ebb05..7b6583a663 100644 --- a/indra/newview/llpathfindingnavmeshzone.h +++ b/indra/newview/llpathfindingnavmeshzone.h @@ -45,6 +45,7 @@ class LLPathfindingNavMeshZone public: typedef enum { kNavMeshZoneRequestUnknown, + kNavMeshZoneRequestChecking, kNavMeshZoneRequestNeedsUpdate, kNavMeshZoneRequestStarted, kNavMeshZoneRequestCompleted, diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml index 75465f1aea..d23d62674f 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml @@ -14,6 +14,7 @@ Cannot find pathing library implementation. This region is not enabled for pathfinding. + Checking the status of the navmesh ... Downloading the navmesh ... The navmesh has changed on the server. Downloading the latest navmesh ... Navmesh received. -- cgit v1.2.3