diff options
author | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-05-22 19:04:52 +0200 |
---|---|---|
committer | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-05-22 19:04:52 +0200 |
commit | 1b67dd855c41f5a0cda7ec2a68d98071986ca703 (patch) | |
tree | ab243607f74f78200787bba5b9b88f07ef1b966f /indra/newview/llpathfindingnavmeshzone.cpp | |
parent | 6d6eabca44d08d5b97bfe3e941d2b9687c2246ea (diff) | |
parent | e1623bb276f83a43ce7a197e388720c05bdefe61 (diff) |
Merge remote-tracking branch 'origin/main' into DRTVWR-600-maint-A
# Conflicts:
# autobuild.xml
# indra/cmake/CMakeLists.txt
# indra/cmake/GoogleMock.cmake
# indra/llaudio/llaudioengine_fmodstudio.cpp
# indra/llaudio/llaudioengine_fmodstudio.h
# indra/llaudio/lllistener_fmodstudio.cpp
# indra/llaudio/lllistener_fmodstudio.h
# indra/llaudio/llstreamingaudio_fmodstudio.cpp
# indra/llaudio/llstreamingaudio_fmodstudio.h
# indra/llcharacter/llmultigesture.cpp
# indra/llcharacter/llmultigesture.h
# indra/llimage/llimage.cpp
# indra/llimage/llimagepng.cpp
# indra/llimage/llimageworker.cpp
# indra/llimage/tests/llimageworker_test.cpp
# indra/llmessage/tests/llmockhttpclient.h
# indra/llprimitive/llgltfmaterial.h
# indra/llrender/llfontfreetype.cpp
# indra/llui/llcombobox.cpp
# indra/llui/llfolderview.cpp
# indra/llui/llfolderviewmodel.h
# indra/llui/lllineeditor.cpp
# indra/llui/lllineeditor.h
# indra/llui/lltextbase.cpp
# indra/llui/lltextbase.h
# indra/llui/lltexteditor.cpp
# indra/llui/lltextvalidate.cpp
# indra/llui/lltextvalidate.h
# indra/llui/lluictrl.h
# indra/llui/llview.cpp
# indra/llwindow/llwindowmacosx.cpp
# indra/newview/app_settings/settings.xml
# indra/newview/llappearancemgr.cpp
# indra/newview/llappearancemgr.h
# indra/newview/llavatarpropertiesprocessor.cpp
# indra/newview/llavatarpropertiesprocessor.h
# indra/newview/llbreadcrumbview.cpp
# indra/newview/llbreadcrumbview.h
# indra/newview/llbreastmotion.cpp
# indra/newview/llbreastmotion.h
# indra/newview/llconversationmodel.h
# indra/newview/lldensityctrl.cpp
# indra/newview/lldensityctrl.h
# indra/newview/llface.inl
# indra/newview/llfloatereditsky.cpp
# indra/newview/llfloatereditwater.cpp
# indra/newview/llfloateremojipicker.h
# indra/newview/llfloaterimsessiontab.cpp
# indra/newview/llfloaterprofiletexture.cpp
# indra/newview/llfloaterprofiletexture.h
# indra/newview/llgesturemgr.cpp
# indra/newview/llgesturemgr.h
# indra/newview/llimpanel.cpp
# indra/newview/llimpanel.h
# indra/newview/llinventorybridge.cpp
# indra/newview/llinventorybridge.h
# indra/newview/llinventoryclipboard.cpp
# indra/newview/llinventoryclipboard.h
# indra/newview/llinventoryfunctions.cpp
# indra/newview/llinventoryfunctions.h
# indra/newview/llinventorygallery.cpp
# indra/newview/lllistbrowser.cpp
# indra/newview/lllistbrowser.h
# indra/newview/llpanelobjectinventory.cpp
# indra/newview/llpanelprofile.cpp
# indra/newview/llpanelprofile.h
# indra/newview/llpreviewgesture.cpp
# indra/newview/llsavedsettingsglue.cpp
# indra/newview/llsavedsettingsglue.h
# indra/newview/lltooldraganddrop.cpp
# indra/newview/llurllineeditorctrl.cpp
# indra/newview/llvectorperfoptions.cpp
# indra/newview/llvectorperfoptions.h
# indra/newview/llviewerparceloverlay.cpp
# indra/newview/llviewertexlayer.cpp
# indra/newview/llviewertexturelist.cpp
# indra/newview/macmain.h
# indra/test/test.cpp
Diffstat (limited to 'indra/newview/llpathfindingnavmeshzone.cpp')
-rw-r--r-- | indra/newview/llpathfindingnavmeshzone.cpp | 568 |
1 files changed, 284 insertions, 284 deletions
diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index e190dbba65..012cc11eee 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -1,4 +1,4 @@ -/** +/** * @file llpathfindingnavmeshzone.cpp * @brief Implementation of llpathfindingnavmeshzone * @author Stinson@lindenlab.com @@ -54,9 +54,9 @@ //--------------------------------------------------------------------------- LLPathfindingNavMeshZone::LLPathfindingNavMeshZone() - : mNavMeshLocationPtrs(), - mNavMeshZoneRequestStatus(kNavMeshZoneRequestUnknown), - mNavMeshZoneSignal() + : mNavMeshLocationPtrs(), + mNavMeshZoneRequestStatus(kNavMeshZoneRequestUnknown), + mNavMeshZoneSignal() { } @@ -66,228 +66,228 @@ LLPathfindingNavMeshZone::~LLPathfindingNavMeshZone() LLPathfindingNavMeshZone::navmesh_zone_slot_t LLPathfindingNavMeshZone::registerNavMeshZoneListener(navmesh_zone_callback_t pNavMeshZoneCallback) { - return mNavMeshZoneSignal.connect(pNavMeshZoneCallback); + return mNavMeshZoneSignal.connect(pNavMeshZoneCallback); } void LLPathfindingNavMeshZone::initialize() { - mNavMeshLocationPtrs.clear(); + mNavMeshLocationPtrs.clear(); - NavMeshLocationPtr centerNavMeshPtr(new NavMeshLocation(CENTER_REGION, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this))); - mNavMeshLocationPtrs.push_back(centerNavMeshPtr); + NavMeshLocationPtr centerNavMeshPtr(new NavMeshLocation(CENTER_REGION, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this))); + mNavMeshLocationPtrs.push_back(centerNavMeshPtr); - U32 neighborRegionDir = gSavedSettings.getU32("PathfindingRetrieveNeighboringRegion"); - if (neighborRegionDir != CENTER_REGION) - { - NavMeshLocationPtr neighborNavMeshPtr(new NavMeshLocation(neighborRegionDir, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this))); - mNavMeshLocationPtrs.push_back(neighborNavMeshPtr); - } + U32 neighborRegionDir = gSavedSettings.getU32("PathfindingRetrieveNeighboringRegion"); + if (neighborRegionDir != CENTER_REGION) + { + NavMeshLocationPtr neighborNavMeshPtr(new NavMeshLocation(neighborRegionDir, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this))); + mNavMeshLocationPtrs.push_back(neighborNavMeshPtr); + } } void LLPathfindingNavMeshZone::enable() { - for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); - navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) - { - NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; - navMeshLocationPtr->enable(); - } + for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) + { + NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + navMeshLocationPtr->enable(); + } } void LLPathfindingNavMeshZone::disable() { - for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); - navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) - { - NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; - navMeshLocationPtr->disable(); - } + for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) + { + NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + navMeshLocationPtr->disable(); + } } void LLPathfindingNavMeshZone::refresh() { - if (LLPathingLib::getInstance() != NULL) - { - LLPathingLib::getInstance()->cleanupResidual(); - } - - for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); - navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) - { - NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; - navMeshLocationPtr->refresh(); - } + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->cleanupResidual(); + } + + for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) + { + NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + navMeshLocationPtr->refresh(); + } } LLPathfindingNavMeshZone::ENavMeshZoneStatus LLPathfindingNavMeshZone::getNavMeshZoneStatus() const { - bool hasPending = false; - bool hasBuilding = false; - bool hasComplete = false; - bool hasRepending = false; - - for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); - navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) - { - const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; - - switch (navMeshLocationPtr->getNavMeshStatus()) - { - case LLPathfindingNavMeshStatus::kPending : - hasPending = true; - break; - case LLPathfindingNavMeshStatus::kBuilding : - hasBuilding = true; - break; - case LLPathfindingNavMeshStatus::kComplete : - hasComplete = true; - break; - case LLPathfindingNavMeshStatus::kRepending : - hasRepending = true; - break; - default : - hasPending = true; - llassert(0); - break; - } - } - - ENavMeshZoneStatus zoneStatus = kNavMeshZoneComplete; - if (hasRepending || (hasPending && hasBuilding)) - { - zoneStatus = kNavMeshZonePendingAndBuilding; - } - else if (hasComplete) - { - if (hasPending) - { - zoneStatus = kNavMeshZoneSomePending; - } - else if (hasBuilding) - { - zoneStatus = kNavMeshZoneSomeBuilding; - } - else - { - zoneStatus = kNavMeshZoneComplete; - } - } - else if (hasPending) - { - zoneStatus = kNavMeshZonePending; - } - else if (hasBuilding) - { - zoneStatus = kNavMeshZoneBuilding; - } - - return zoneStatus; + bool hasPending = false; + bool hasBuilding = false; + bool hasComplete = false; + bool hasRepending = false; + + for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) + { + const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + + switch (navMeshLocationPtr->getNavMeshStatus()) + { + case LLPathfindingNavMeshStatus::kPending : + hasPending = true; + break; + case LLPathfindingNavMeshStatus::kBuilding : + hasBuilding = true; + break; + case LLPathfindingNavMeshStatus::kComplete : + hasComplete = true; + break; + case LLPathfindingNavMeshStatus::kRepending : + hasRepending = true; + break; + default : + hasPending = true; + llassert(0); + break; + } + } + + ENavMeshZoneStatus zoneStatus = kNavMeshZoneComplete; + if (hasRepending || (hasPending && hasBuilding)) + { + zoneStatus = kNavMeshZonePendingAndBuilding; + } + else if (hasComplete) + { + if (hasPending) + { + zoneStatus = kNavMeshZoneSomePending; + } + else if (hasBuilding) + { + zoneStatus = kNavMeshZoneSomeBuilding; + } + else + { + zoneStatus = kNavMeshZoneComplete; + } + } + else if (hasPending) + { + zoneStatus = kNavMeshZonePending; + } + else if (hasBuilding) + { + zoneStatus = kNavMeshZoneBuilding; + } + + return zoneStatus; } void LLPathfindingNavMeshZone::handleNavMeshLocation() { - updateStatus(); + updateStatus(); } void LLPathfindingNavMeshZone::updateStatus() { - bool hasRequestUnknown = false; - bool hasRequestWaiting = false; - bool hasRequestChecking = false; - bool hasRequestNeedsUpdate = false; - bool hasRequestStarted = false; - bool hasRequestCompleted = false; - bool hasRequestNotEnabled = false; - bool hasRequestError = false; - - for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); - navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) - { - const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; - switch (navMeshLocationPtr->getRequestStatus()) - { - case LLPathfindingNavMesh::kNavMeshRequestUnknown : - hasRequestUnknown = true; - break; - case LLPathfindingNavMesh::kNavMeshRequestWaiting : - hasRequestWaiting = true; - break; - case LLPathfindingNavMesh::kNavMeshRequestChecking : - hasRequestChecking = true; - break; - case LLPathfindingNavMesh::kNavMeshRequestNeedsUpdate : - hasRequestNeedsUpdate = true; - break; - case LLPathfindingNavMesh::kNavMeshRequestStarted : - hasRequestStarted = true; - break; - case LLPathfindingNavMesh::kNavMeshRequestCompleted : - hasRequestCompleted = true; - break; - case LLPathfindingNavMesh::kNavMeshRequestNotEnabled : - hasRequestNotEnabled = true; - break; - case LLPathfindingNavMesh::kNavMeshRequestError : - hasRequestError = true; - break; - default : - hasRequestError = true; - llassert(0); - break; - } - } - - ENavMeshZoneRequestStatus zoneRequestStatus = kNavMeshZoneRequestUnknown; - if (hasRequestWaiting) - { - zoneRequestStatus = kNavMeshZoneRequestWaiting; - } - else if (hasRequestNeedsUpdate) - { - zoneRequestStatus = kNavMeshZoneRequestNeedsUpdate; - } - else if (hasRequestChecking) - { - zoneRequestStatus = kNavMeshZoneRequestChecking; - } - else if (hasRequestStarted) - { - zoneRequestStatus = kNavMeshZoneRequestStarted; - } - else if (hasRequestError) - { - zoneRequestStatus = kNavMeshZoneRequestError; - } - else if (hasRequestUnknown) - { - zoneRequestStatus = kNavMeshZoneRequestUnknown; - } - else if (hasRequestCompleted) - { - zoneRequestStatus = kNavMeshZoneRequestCompleted; - } - else if (hasRequestNotEnabled) - { - zoneRequestStatus = kNavMeshZoneRequestNotEnabled; - } - else - { - zoneRequestStatus = kNavMeshZoneRequestError; - llassert(0); - } - - if ((mNavMeshZoneRequestStatus != kNavMeshZoneRequestCompleted) && - (zoneRequestStatus == kNavMeshZoneRequestCompleted)) - { - llassert(LLPathingLib::getInstance() != NULL); - if (LLPathingLib::getInstance() != NULL) - { - LLPathingLib::getInstance()->processNavMeshData(); - } - } - - mNavMeshZoneRequestStatus = zoneRequestStatus; - mNavMeshZoneSignal(mNavMeshZoneRequestStatus); + bool hasRequestUnknown = false; + bool hasRequestWaiting = false; + bool hasRequestChecking = false; + bool hasRequestNeedsUpdate = false; + bool hasRequestStarted = false; + bool hasRequestCompleted = false; + bool hasRequestNotEnabled = false; + bool hasRequestError = false; + + for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) + { + const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + switch (navMeshLocationPtr->getRequestStatus()) + { + case LLPathfindingNavMesh::kNavMeshRequestUnknown : + hasRequestUnknown = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestWaiting : + hasRequestWaiting = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestChecking : + hasRequestChecking = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestNeedsUpdate : + hasRequestNeedsUpdate = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestStarted : + hasRequestStarted = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestCompleted : + hasRequestCompleted = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestNotEnabled : + hasRequestNotEnabled = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestError : + hasRequestError = true; + break; + default : + hasRequestError = true; + llassert(0); + break; + } + } + + ENavMeshZoneRequestStatus zoneRequestStatus = kNavMeshZoneRequestUnknown; + if (hasRequestWaiting) + { + zoneRequestStatus = kNavMeshZoneRequestWaiting; + } + else if (hasRequestNeedsUpdate) + { + zoneRequestStatus = kNavMeshZoneRequestNeedsUpdate; + } + else if (hasRequestChecking) + { + zoneRequestStatus = kNavMeshZoneRequestChecking; + } + else if (hasRequestStarted) + { + zoneRequestStatus = kNavMeshZoneRequestStarted; + } + else if (hasRequestError) + { + zoneRequestStatus = kNavMeshZoneRequestError; + } + else if (hasRequestUnknown) + { + zoneRequestStatus = kNavMeshZoneRequestUnknown; + } + else if (hasRequestCompleted) + { + zoneRequestStatus = kNavMeshZoneRequestCompleted; + } + else if (hasRequestNotEnabled) + { + zoneRequestStatus = kNavMeshZoneRequestNotEnabled; + } + else + { + zoneRequestStatus = kNavMeshZoneRequestError; + llassert(0); + } + + if ((mNavMeshZoneRequestStatus != kNavMeshZoneRequestCompleted) && + (zoneRequestStatus == kNavMeshZoneRequestCompleted)) + { + llassert(LLPathingLib::getInstance() != NULL); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->processNavMeshData(); + } + } + + mNavMeshZoneRequestStatus = zoneRequestStatus; + mNavMeshZoneSignal(mNavMeshZoneRequestStatus); } //--------------------------------------------------------------------------- @@ -295,14 +295,14 @@ void LLPathfindingNavMeshZone::updateStatus() //--------------------------------------------------------------------------- LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(S32 pDirection, navmesh_location_callback_t pLocationCallback) - : mDirection(pDirection), - mRegionUUID(), - mHasNavMesh(false), - mNavMeshVersion(0U), - mNavMeshStatus(LLPathfindingNavMeshStatus::kComplete), - mLocationCallback(pLocationCallback), - mRequestStatus(LLPathfindingNavMesh::kNavMeshRequestUnknown), - mNavMeshSlot() + : mDirection(pDirection), + mRegionUUID(), + mHasNavMesh(false), + mNavMeshVersion(0U), + mNavMeshStatus(LLPathfindingNavMeshStatus::kComplete), + mLocationCallback(pLocationCallback), + mRequestStatus(LLPathfindingNavMesh::kNavMeshRequestUnknown), + mNavMeshSlot() { } @@ -312,112 +312,112 @@ LLPathfindingNavMeshZone::NavMeshLocation::~NavMeshLocation() void LLPathfindingNavMeshZone::NavMeshLocation::enable() { - clear(); - - LLViewerRegion *region = getRegion(); - if (region == NULL) - { - mRegionUUID.setNull(); - } - else - { - mRegionUUID = region->getRegionID(); - mNavMeshSlot = LLPathfindingManager::getInstance()->registerNavMeshListenerForRegion(region, boost::bind(&LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh, this, _1, _2, _3)); - } + clear(); + + LLViewerRegion *region = getRegion(); + if (region == NULL) + { + mRegionUUID.setNull(); + } + else + { + mRegionUUID = region->getRegionID(); + mNavMeshSlot = LLPathfindingManager::getInstance()->registerNavMeshListenerForRegion(region, boost::bind(&LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh, this, _1, _2, _3)); + } } void LLPathfindingNavMeshZone::NavMeshLocation::refresh() { - LLViewerRegion *region = getRegion(); - - if (region == NULL) - { - llassert(mRegionUUID.isNull()); - LLPathfindingNavMeshStatus newNavMeshStatus(mRegionUUID); - LLSD::Binary nullData; - handleNavMesh(LLPathfindingNavMesh::kNavMeshRequestNotEnabled, newNavMeshStatus, nullData); - } - else - { - llassert(mRegionUUID == region->getRegionID()); - LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(region, false); - } + LLViewerRegion *region = getRegion(); + + if (region == NULL) + { + llassert(mRegionUUID.isNull()); + LLPathfindingNavMeshStatus newNavMeshStatus(mRegionUUID); + LLSD::Binary nullData; + handleNavMesh(LLPathfindingNavMesh::kNavMeshRequestNotEnabled, newNavMeshStatus, nullData); + } + else + { + llassert(mRegionUUID == region->getRegionID()); + LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(region, false); + } } void LLPathfindingNavMeshZone::NavMeshLocation::disable() { - clear(); + clear(); } LLPathfindingNavMesh::ENavMeshRequestStatus LLPathfindingNavMeshZone::NavMeshLocation::getRequestStatus() const { - return mRequestStatus; + return mRequestStatus; } LLPathfindingNavMeshStatus::ENavMeshStatus LLPathfindingNavMeshZone::NavMeshLocation::getNavMeshStatus() const { - return mNavMeshStatus; + return mNavMeshStatus; } void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLPathfindingNavMeshStatus &pNavMeshStatus, const LLSD::Binary &pNavMeshData) { - llassert(mRegionUUID == pNavMeshStatus.getRegionUUID()); - - if ((pNavMeshRequestStatus == LLPathfindingNavMesh::kNavMeshRequestCompleted) && - (!mHasNavMesh || (mNavMeshVersion != pNavMeshStatus.getVersion()))) - { - llassert(!pNavMeshData.empty()); - mHasNavMesh = true; - mNavMeshVersion = pNavMeshStatus.getVersion(); - llassert(LLPathingLib::getInstance() != NULL); - if (LLPathingLib::getInstance() != NULL) - { - LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection); - } - } - - mRequestStatus = pNavMeshRequestStatus; - mNavMeshStatus = pNavMeshStatus.getStatus(); - mLocationCallback(); + llassert(mRegionUUID == pNavMeshStatus.getRegionUUID()); + + if ((pNavMeshRequestStatus == LLPathfindingNavMesh::kNavMeshRequestCompleted) && + (!mHasNavMesh || (mNavMeshVersion != pNavMeshStatus.getVersion()))) + { + llassert(!pNavMeshData.empty()); + mHasNavMesh = true; + mNavMeshVersion = pNavMeshStatus.getVersion(); + llassert(LLPathingLib::getInstance() != NULL); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection); + } + } + + mRequestStatus = pNavMeshRequestStatus; + mNavMeshStatus = pNavMeshStatus.getStatus(); + mLocationCallback(); } void LLPathfindingNavMeshZone::NavMeshLocation::clear() { - mHasNavMesh = false; - mRequestStatus = LLPathfindingNavMesh::kNavMeshRequestUnknown; - mNavMeshStatus = LLPathfindingNavMeshStatus::kComplete; - if (mNavMeshSlot.connected()) - { - mNavMeshSlot.disconnect(); - } + mHasNavMesh = false; + mRequestStatus = LLPathfindingNavMesh::kNavMeshRequestUnknown; + mNavMeshStatus = LLPathfindingNavMeshStatus::kComplete; + if (mNavMeshSlot.connected()) + { + mNavMeshSlot.disconnect(); + } } LLViewerRegion *LLPathfindingNavMeshZone::NavMeshLocation::getRegion() const { - LLViewerRegion *region = NULL; - - LLViewerRegion *currentRegion = gAgent.getRegion(); - if (currentRegion != NULL) - { - if (mDirection == CENTER_REGION) - { - region = currentRegion; - } - else - { - //User wants to pull in a neighboring region - std::vector<S32> availableRegions; - currentRegion->getNeighboringRegionsStatus( availableRegions ); - //Is the desired region in the available list - std::vector<S32>::iterator foundElem = std::find(availableRegions.begin(),availableRegions.end(),mDirection); - if ( foundElem != availableRegions.end() ) - { - std::vector<LLViewerRegion*> neighborRegionsPtrs; - currentRegion->getNeighboringRegions( neighborRegionsPtrs ); - region = neighborRegionsPtrs[foundElem - availableRegions.begin()]; - } - } - } - - return region; + LLViewerRegion *region = NULL; + + LLViewerRegion *currentRegion = gAgent.getRegion(); + if (currentRegion != NULL) + { + if (mDirection == CENTER_REGION) + { + region = currentRegion; + } + else + { + //User wants to pull in a neighboring region + std::vector<S32> availableRegions; + currentRegion->getNeighboringRegionsStatus( availableRegions ); + //Is the desired region in the available list + std::vector<S32>::iterator foundElem = std::find(availableRegions.begin(),availableRegions.end(),mDirection); + if ( foundElem != availableRegions.end() ) + { + std::vector<LLViewerRegion*> neighborRegionsPtrs; + currentRegion->getNeighboringRegions( neighborRegionsPtrs ); + region = neighborRegionsPtrs[foundElem - availableRegions.begin()]; + } + } + } + + return region; } |