summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAimee Linden <aimee@lindenlab.com>2010-08-04 12:56:41 +0100
committerAimee Linden <aimee@lindenlab.com>2010-08-04 12:56:41 +0100
commite77ac4ca647f950a9c9f3ae79d6b7a37ab1b49e3 (patch)
treea0adf70a73117269e51d60df54a90071da948151
parentdea12663707b5c88c34bafd95c345e806702bc03 (diff)
parentd3db9dd2a17a7829e9e577caa5281ef4250c5f62 (diff)
Merge
-rw-r--r--indra/newview/llviewerregion.cpp32
-rw-r--r--indra/newview/llviewerregion.h10
2 files changed, 28 insertions, 14 deletions
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 004d138221..82fef1d916 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -79,6 +79,8 @@
// format changes. JC
const U32 INDRA_OBJECT_CACHE_VERSION = 14;
+// Format string used to construct filename for the object cache
+static const char OBJECT_CACHE_FILENAME[] = "objects_%d_%d.slc";
extern BOOL gNoRender;
@@ -323,13 +325,25 @@ LLViewerRegion::~LLViewerRegion()
delete mEventPoll;
LLHTTPSender::clearSender(mHost);
- saveCache();
+ saveObjectCache();
std::for_each(mObjectPartition.begin(), mObjectPartition.end(), DeletePointer());
}
-void LLViewerRegion::loadCache()
+const std::string LLViewerRegion::getObjectCacheFilename(U64 mHandle) const
+{
+ std::string filename;
+ U32 region_x, region_y;
+
+ grid_from_region_handle(mHandle, &region_x, &region_y);
+ filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,
+ llformat(OBJECT_CACHE_FILENAME, region_x, region_y));
+
+ return filename;
+}
+
+void LLViewerRegion::loadObjectCache()
{
if (mCacheLoaded)
{
@@ -341,9 +355,8 @@ void LLViewerRegion::loadCache()
LLVOCacheEntry *entry;
- std::string filename;
- filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"") + gDirUtilp->getDirDelimiter() +
- llformat("objects_%d_%d.slc",U32(mHandle>>32)/REGION_WIDTH_UNITS, U32(mHandle)/REGION_WIDTH_UNITS );
+ std::string filename = getObjectCacheFilename(mHandle);
+ LL_DEBUGS("ObjectCache") << filename << LL_ENDL;
LLFILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */
if (!fp)
@@ -414,7 +427,7 @@ void LLViewerRegion::loadCache()
}
-void LLViewerRegion::saveCache()
+void LLViewerRegion::saveObjectCache()
{
if (!mCacheLoaded)
{
@@ -427,9 +440,8 @@ void LLViewerRegion::saveCache()
return;
}
- std::string filename;
- filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"") + gDirUtilp->getDirDelimiter() +
- llformat("objects_%d_%d.slc", U32(mHandle>>32)/REGION_WIDTH_UNITS, U32(mHandle)/REGION_WIDTH_UNITS );
+ std::string filename = getObjectCacheFilename(mHandle);
+ LL_DEBUGS("ObjectCache") << filename << LL_ENDL;
LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */
if (!fp)
@@ -1454,7 +1466,7 @@ void LLViewerRegion::unpackRegionHandshake()
// Now that we have the name, we can load the cache file
// off disk.
- loadCache();
+ loadObjectCache();
// After loading cache, signal that simulator can start
// sending data.
diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h
index a9e7ef771c..e15609065c 100644
--- a/indra/newview/llviewerregion.h
+++ b/indra/newview/llviewerregion.h
@@ -99,9 +99,8 @@ public:
~LLViewerRegion();
// Call this after you have the region name and handle.
- void loadCache();
-
- void saveCache();
+ void loadObjectCache();
+ void saveObjectCache();
void sendMessage(); // Send the current message to this region's simulator
void sendReliableMessage(); // Send the current message to this region's simulator
@@ -330,6 +329,9 @@ public:
LLDynamicArray<LLUUID> mMapAvatarIDs;
private:
+ // determine the cache filename for the region from the region handle
+ const std::string LLViewerRegion::getObjectCacheFilename(U64 mHandle) const;
+
// The surfaces and other layers
LLSurface* mLandp;
@@ -404,7 +406,7 @@ private:
// Cache ID is unique per-region, across renames, moving locations,
// etc.
LLUUID mCacheID;
-
+
typedef std::map<std::string, std::string> CapabilityMap;
CapabilityMap mCapabilities;