diff options
author | Leyla Farazha <leyla@lindenlab.com> | 2010-08-20 14:48:00 -0700 |
---|---|---|
committer | Leyla Farazha <leyla@lindenlab.com> | 2010-08-20 14:48:00 -0700 |
commit | 5fab3253f941c0e25b4b86e29ab7a34c4325f825 (patch) | |
tree | 8c79b64a284d18a2e316ee3fc881629dff35617d /indra/newview/llviewerregion.cpp | |
parent | ab320a12e62152907bbec150972a9ac8a0e244fb (diff) | |
parent | cde71ddc88293a752787b710f6d03aba1ec0b15e (diff) |
Merge from dessie/viewer-release
Diffstat (limited to 'indra/newview/llviewerregion.cpp')
-rw-r--r-- | indra/newview/llviewerregion.cpp | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 9964c67afc..9307ee151e 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -81,6 +81,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; @@ -328,13 +330,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, ®ion_x, ®ion_y); + filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, + llformat(OBJECT_CACHE_FILENAME, region_x, region_y)); + + return filename; +} + +void LLViewerRegion::loadObjectCache() { if (mCacheLoaded) { @@ -346,9 +360,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) @@ -419,7 +432,7 @@ void LLViewerRegion::loadCache() } -void LLViewerRegion::saveCache() +void LLViewerRegion::saveObjectCache() { if (!mCacheLoaded) { @@ -432,9 +445,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) @@ -1459,7 +1471,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. |