summaryrefslogtreecommitdiff
path: root/indra/newview/llpathfindingnavmeshzone.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpathfindingnavmeshzone.cpp')
-rw-r--r--indra/newview/llpathfindingnavmeshzone.cpp137
1 files changed, 42 insertions, 95 deletions
diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp
index 816c94e25e..e190dbba65 100644
--- a/indra/newview/llpathfindingnavmeshzone.cpp
+++ b/indra/newview/llpathfindingnavmeshzone.cpp
@@ -1,46 +1,51 @@
/**
- * @file llpathfindingnavmeshzone.cpp
- * @author William Todd Stinson
- * @brief A class for representing the zone of navmeshes containing and possible surrounding the current region.
- *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
+* @file llpathfindingnavmeshzone.cpp
+* @brief Implementation of llpathfindingnavmeshzone
+* @author Stinson@lindenlab.com
+*
+* $LicenseInfo:firstyear=2012&license=viewerlgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 2012, Linden Research, Inc.
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation;
+* version 2.1 of the License only.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*
+* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+* $/LicenseInfo$
+*/
+
#include "llviewerprecompiledheaders.h"
-#include "llsd.h"
-#include "lluuid.h"
-#include "llagent.h"
-#include "llviewerregion.h"
-#include "llpathfindingnavmesh.h"
-#include "llpathfindingnavmeshzone.h"
-#include "llpathfindingmanager.h"
-#include "llviewercontrol.h"
-#include "llpathinglib.h"
+#include "llpathfindingnavmeshzone.h"
-#include <string>
#include <vector>
#include <boost/bind.hpp>
+#include <boost/function.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/signals2.hpp>
+
+#include "llagent.h"
+#include "llpathfindingmanager.h"
+#include "llpathfindingnavmesh.h"
+#include "llpathfindingnavmeshstatus.h"
+#include "llpathinglib.h"
+#include "llsd.h"
+#include "lluuid.h"
+#include "llviewercontrol.h"
+#include "llviewerregion.h"
#define CENTER_REGION 99
@@ -68,28 +73,10 @@ void LLPathfindingNavMeshZone::initialize()
{
mNavMeshLocationPtrs.clear();
-#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE
- LLViewerRegion *currentRegion = gAgent.getRegion();
- if (currentRegion != NULL)
- {
- llinfos << "STINSON DEBUG: currentRegion: '" << currentRegion->getName() << "' (" << currentRegion->getRegionID().asString() << ")" << llendl;
- std::vector<S32> availableRegions;
- currentRegion->getNeighboringRegionsStatus( availableRegions );
- std::vector<LLViewerRegion*> neighborRegionsPtrs;
- currentRegion->getNeighboringRegions( neighborRegionsPtrs );
- for (std::vector<S32>::const_iterator statusIter = availableRegions.begin();
- statusIter != availableRegions.end(); ++statusIter)
- {
- LLViewerRegion *region = neighborRegionsPtrs[statusIter - availableRegions.begin()];
- llinfos << "STINSON DEBUG: region #" << *statusIter << ": '" << region->getName() << "' (" << region->getRegionID().asString() << ")" << llendl;
- }
- }
-
-#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE
NavMeshLocationPtr centerNavMeshPtr(new NavMeshLocation(CENTER_REGION, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this)));
mNavMeshLocationPtrs.push_back(centerNavMeshPtr);
- U32 neighborRegionDir = gSavedSettings.getU32("RetrieveNeighboringRegion");
+ U32 neighborRegionDir = gSavedSettings.getU32("PathfindingRetrieveNeighboringRegion");
if (neighborRegionDir != CENTER_REGION)
{
NavMeshLocationPtr neighborNavMeshPtr(new NavMeshLocation(neighborRegionDir, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this)));
@@ -119,7 +106,6 @@ void LLPathfindingNavMeshZone::disable()
void LLPathfindingNavMeshZone::refresh()
{
- llassert(LLPathingLib::getInstance() != NULL);
if (LLPathingLib::getInstance() != NULL)
{
LLPathingLib::getInstance()->cleanupResidual();
@@ -214,16 +200,10 @@ void LLPathfindingNavMeshZone::updateStatus()
bool hasRequestNotEnabled = false;
bool hasRequestError = false;
-#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE
- llinfos << "STINSON DEBUG: Navmesh zone update BEGIN" << llendl;
-#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE
for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin();
navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter)
{
const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter;
-#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE
- llinfos << "STINSON DEBUG: region #" << navMeshLocationPtr->getDirection() << ": region(" << navMeshLocationPtr->getRegionUUID().asString() << ") status:" << navMeshLocationPtr->getRequestStatus() << llendl;
-#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE
switch (navMeshLocationPtr->getRequestStatus())
{
case LLPathfindingNavMesh::kNavMeshRequestUnknown :
@@ -261,82 +241,49 @@ void LLPathfindingNavMeshZone::updateStatus()
if (hasRequestWaiting)
{
zoneRequestStatus = kNavMeshZoneRequestWaiting;
-#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE
- llinfos << "STINSON DEBUG: Navmesh zone update is WAITING" << llendl;
-#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE
}
else if (hasRequestNeedsUpdate)
{
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)
{
zoneRequestStatus = kNavMeshZoneRequestStarted;
-#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE
- llinfos << "STINSON DEBUG: Navmesh zone update is STARTED" << llendl;
-#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE
}
else if (hasRequestError)
{
zoneRequestStatus = kNavMeshZoneRequestError;
-#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE
- llinfos << "STINSON DEBUG: Navmesh zone update is ERROR" << llendl;
-#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE
}
else if (hasRequestUnknown)
{
zoneRequestStatus = kNavMeshZoneRequestUnknown;
-#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE
- llinfos << "STINSON DEBUG: Navmesh zone update is UNKNOWN" << llendl;
-#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE
}
else if (hasRequestCompleted)
{
zoneRequestStatus = kNavMeshZoneRequestCompleted;
-#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE
- llinfos << "STINSON DEBUG: Navmesh zone update is COMPLETED" << llendl;
-#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE
}
else if (hasRequestNotEnabled)
{
zoneRequestStatus = kNavMeshZoneRequestNotEnabled;
-#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE
- llinfos << "STINSON DEBUG: Navmesh zone update is NOT ENABLED" << llendl;
-#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE
}
else
{
zoneRequestStatus = kNavMeshZoneRequestError;
-#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE
- llinfos << "STINSON DEBUG: Navmesh zone update is BAD ERROR" << llendl;
-#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE
llassert(0);
}
if ((mNavMeshZoneRequestStatus != kNavMeshZoneRequestCompleted) &&
(zoneRequestStatus == kNavMeshZoneRequestCompleted))
{
-#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE
- llinfos << "STINSON DEBUG: Navmesh zone update is stitching" << llendl;
-#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE
llassert(LLPathingLib::getInstance() != NULL);
if (LLPathingLib::getInstance() != NULL)
{
LLPathingLib::getInstance()->processNavMeshData();
}
-#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE
- llinfos << "STINSON DEBUG: Navmesh zone update stitching is done" << llendl;
-#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE
}
mNavMeshZoneRequestStatus = zoneRequestStatus;
@@ -393,7 +340,7 @@ void LLPathfindingNavMeshZone::NavMeshLocation::refresh()
else
{
llassert(mRegionUUID == region->getRegionID());
- LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(region);
+ LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(region, false);
}
}