diff options
Diffstat (limited to 'indra/newview/llviewerregion.cpp')
-rwxr-xr-x | indra/newview/llviewerregion.cpp | 107 |
1 files changed, 51 insertions, 56 deletions
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index f98336240c..57d96f4f1b 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -100,14 +100,11 @@ const S32 MAX_CAP_REQUEST_ATTEMPTS = 30; const U32 DEFAULT_MAX_REGION_WIDE_PRIM_COUNT = 15000; -BOOL LLViewerRegion::sVOCacheCullingEnabled = FALSE; +bool LLViewerRegion::sVOCacheCullingEnabled = false; S32 LLViewerRegion::sLastCameraUpdated = 0; S32 LLViewerRegion::sNewObjectCreationThrottle = -1; LLViewerRegion::vocache_entry_map_t LLViewerRegion::sRegionCacheCleanup; -const std::string LLViewerRegion::IL_MODE_DEFAULT = "default"; -const std::string LLViewerRegion::IL_MODE_360 = "360"; - typedef std::map<std::string, std::string> CapabilityMap; static void log_capabilities(const CapabilityMap &capmap); @@ -139,7 +136,7 @@ public: bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web) { // make sure that we at least have a region name - int num_params = params.size(); + auto num_params = params.size(); if (num_params < 1) { return false; @@ -153,7 +150,7 @@ public: } boost::regex name_rx("[A-Za-z0-9()_%]+"); boost::regex coord_rx("[0-9]+"); - for (int i = 0; i < num_params; i++) + for (size_t i = 0; i < num_params; i++) { if (i > 0) { @@ -626,7 +623,7 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mTimeDilation(1.0f), mName(""), mZoning(""), - mIsEstateManager(FALSE), + mIsEstateManager(false), mRegionFlags( REGION_FLAGS_DEFAULT ), mRegionProtocols( 0 ), mSimAccess( SIM_ACCESS_MIN ), @@ -639,17 +636,17 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mProductSKU("unknown"), mProductName("unknown"), mViewerAssetUrl(""), - mCacheLoaded(FALSE), - mCacheDirty(FALSE), - mReleaseNotesRequested(FALSE), + mCacheLoaded(false), + mCacheDirty(false), + mReleaseNotesRequested(false), mCapabilitiesState(CAPABILITIES_STATE_INIT), mSimulatorFeaturesReceived(false), mBitsReceived(0.f), mPacketsReceived(0.f), - mDead(FALSE), + mDead(false), mLastVisitedEntry(NULL), mInvisibilityCheckHistory(-1), - mPaused(FALSE), + mPaused(false), mRegionCacheHitCount(0), mRegionCacheMissCount(0), mInterestListMode(IL_MODE_DEFAULT) @@ -725,7 +722,7 @@ static LLTrace::BlockTimerStatHandle FTM_SAVE_REGION_CACHE("Save Region Cache"); LLViewerRegion::~LLViewerRegion() { LL_PROFILE_ZONE_SCOPED; - mDead = TRUE; + mDead = true; mImpl->mActiveSet.clear(); mImpl->mVisibleEntries.clear(); mImpl->mVisibleGroups.clear(); @@ -789,7 +786,7 @@ void LLViewerRegion::loadObjectCache() } // Presume success. If it fails, we don't want to try again. - mCacheLoaded = TRUE; + mCacheLoaded = true; if(LLVOCache::instanceExists()) { @@ -799,7 +796,7 @@ void LLViewerRegion::loadObjectCache() if (mImpl->mCacheMap.empty()) { - mCacheDirty = TRUE; + mCacheDirty = true; } } } @@ -826,7 +823,7 @@ void LLViewerRegion::saveObjectCache() instance.writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty, removal_enabled); instance.writeGenericExtrasToCache(mHandle, mImpl->mCacheID, mImpl->mGLTFOverridesLLSD, mCacheDirty, removal_enabled); - mCacheDirty = FALSE; + mCacheDirty = false; } if (LLAppViewer::instance()->isQuitting()) @@ -862,7 +859,7 @@ F32 LLViewerRegion::getWaterHeight() const return mImpl->mLandp->getWaterHeight(); } -BOOL LLViewerRegion::isVoiceEnabled() const +bool LLViewerRegion::isVoiceEnabled() const { return getRegionFlag(REGION_FLAGS_ALLOW_VOICE); } @@ -925,7 +922,7 @@ const LLUUID& LLViewerRegion::getOwner() const void LLViewerRegion::setRegionNameAndZone (const std::string& name_zone) { std::string::size_type pipe_pos = name_zone.find('|'); - S32 length = name_zone.size(); + auto length = name_zone.size(); if (pipe_pos != std::string::npos) { mName = name_zone.substr(0, pipe_pos); @@ -941,7 +938,7 @@ void LLViewerRegion::setRegionNameAndZone (const std::string& name_zone) LLStringUtil::stripNonprintable(mZoning); } -BOOL LLViewerRegion::canManageEstate() const +bool LLViewerRegion::canManageEstate() const { return gAgent.isGodlike() || isEstateManager() @@ -1162,7 +1159,7 @@ void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry, bool for_rendering) //will remove it from the object cache, real deletion entry->setState(LLVOCacheEntry::INACTIVE); entry->removeOctreeEntry(); - entry->setValid(FALSE); + entry->setValid(false); // TODO kill extras/material overrides cache too } @@ -1175,7 +1172,7 @@ void LLViewerRegion::killCacheEntry(U32 local_id) U32 LLViewerRegion::getNumOfActiveCachedObjects() const { - return mImpl->mActiveSet.size(); + return static_cast<U32>(mImpl->mActiveSet.size()); } void LLViewerRegion::addActiveCacheEntry(LLVOCacheEntry* entry) @@ -1262,7 +1259,7 @@ bool LLViewerRegion::addVisibleGroup(LLViewerOctreeGroup* group) U32 LLViewerRegion::getNumOfVisibleGroups() const { - return mImpl ? mImpl->mVisibleGroups.size() : 0; + return mImpl ? static_cast<U32>(mImpl->mVisibleGroups.size()) : 0; } void LLViewerRegion::updateReflectionProbes() @@ -1491,12 +1488,12 @@ void LLViewerRegion::createVisibleObjects(F32 max_time) } if(mImpl->mWaitingList.empty()) { - mImpl->mVOCachePartition->setCullHistory(FALSE); + mImpl->mVOCachePartition->setCullHistory(false); return; } S32 throttle = sNewObjectCreationThrottle; - BOOL has_new_obj = FALSE; + bool has_new_obj = false; LLTimer update_timer; for(LLVOCacheEntry::vocache_entry_priority_list_t::iterator iter = mImpl->mWaitingList.begin(); iter != mImpl->mWaitingList.end(); ++iter) @@ -1506,7 +1503,7 @@ void LLViewerRegion::createVisibleObjects(F32 max_time) if(vo_entry->getState() < LLVOCacheEntry::WAITING) { addNewObject(vo_entry); - has_new_obj = TRUE; + has_new_obj = true; if(throttle > 0 && !(--throttle) && update_timer.getElapsedTimeF32() > max_time) { break; @@ -1526,7 +1523,7 @@ void LLViewerRegion::clearCachedVisibleObjects() //reset all occluders mImpl->mVOCachePartition->resetOccluders(); - mPaused = TRUE; + mPaused = true; //clean visible entries for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); iter != mImpl->mVisibleEntries.end();) @@ -1626,7 +1623,7 @@ void LLViewerRegion::idleUpdate(F32 max_update_time) } if(mPaused) { - mPaused = FALSE; //unpause. + mPaused = false; //unpause. } LLViewerCamera::eCameraID old_camera_id = LLViewerCamera::sCurCameraID; @@ -1699,7 +1696,7 @@ void LLViewerRegion::calcNewObjectCreationThrottle() LLVOCacheEntry::updateDebugSettings(); } -BOOL LLViewerRegion::isViewerCameraStatic() +bool LLViewerRegion::isViewerCameraStatic() { return sLastCameraUpdated < LLViewerOctreeEntryData::getCurrentFrame(); } @@ -1738,7 +1735,7 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) } std::vector<LLDrawable*> delete_list; - S32 update_counter = llmin(max_update, mImpl->mActiveSet.size()); + auto update_counter = llmin(max_update, mImpl->mActiveSet.size()); LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(mLastVisitedEntry); for(; update_counter > 0; --update_counter, ++iter) @@ -1777,10 +1774,9 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) if(!delete_list.empty()) { mInvisibilityCheckHistory |= 1; - S32 count = delete_list.size(); - for(S32 i = 0; i < count; i++) + for (auto drawable : delete_list) { - gObjectList.killObject(delete_list[i]->getVObj()); + gObjectList.killObject(drawable->getVObj()); } delete_list.clear(); } @@ -2106,27 +2102,27 @@ S32 LLViewerRegion::getHttpResponderID() const return mImpl->mHttpResponderID; } -BOOL LLViewerRegion::pointInRegionGlobal(const LLVector3d &point_global) const +bool LLViewerRegion::pointInRegionGlobal(const LLVector3d &point_global) const { LLVector3 pos_region = getPosRegionFromGlobal(point_global); if (pos_region.mV[VX] < 0) { - return FALSE; + return false; } if (pos_region.mV[VX] >= mWidth) { - return FALSE; + return false; } if (pos_region.mV[VY] < 0) { - return FALSE; + return false; } if (pos_region.mV[VY] >= mWidth) { - return FALSE; + return false; } - return TRUE; + return true; } LLVector3 LLViewerRegion::getPosRegionFromGlobal(const LLVector3d &point_global) const @@ -2165,24 +2161,24 @@ bool LLViewerRegion::isAlive() return mAlive; } -BOOL LLViewerRegion::isOwnedSelf(const LLVector3& pos) +bool LLViewerRegion::isOwnedSelf(const LLVector3& pos) { if (mParcelOverlay) { return mParcelOverlay->isOwnedSelf(pos); } else { - return FALSE; + return false; } } // Owned by a group you belong to? (officer or member) -BOOL LLViewerRegion::isOwnedGroup(const LLVector3& pos) +bool LLViewerRegion::isOwnedGroup(const LLVector3& pos) { if (mParcelOverlay) { return mParcelOverlay->isOwnedGroup(pos); } else { - return FALSE; + return false; } } @@ -2227,7 +2223,7 @@ public: LLSD::array_iterator locs_it = locs.beginArray(), agents_it = agents.beginArray(); - BOOL has_agent_data = input["body"].has("AgentData"); + bool has_agent_data = input["body"].has("AgentData"); for(int i=0; locs_it != locs.endArray(); @@ -2295,7 +2291,7 @@ void LLViewerRegion::updateCoarseLocations(LLMessageSystem* msg) msg->getS16Fast(_PREHASH_Index, _PREHASH_You, agent_index); msg->getS16Fast(_PREHASH_Index, _PREHASH_Prey, target_index); - BOOL has_agent_data = msg->has(_PREHASH_AgentData); + bool has_agent_data = msg->has(_PREHASH_AgentData); S32 count = msg->getNumberOfBlocksFast(_PREHASH_Location); for(S32 i = 0; i < count; i++) { @@ -2579,10 +2575,9 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) if(iter != mOrphanMap.end()) { std::vector<U32>* orphans = &mOrphanMap[entry->getLocalID()]; - S32 size = orphans->size(); - for(S32 i = 0; i < size; i++) + for (U32 orphan : *orphans) { - LLVOCacheEntry* child = getCacheEntry((*orphans)[i]); + LLVOCacheEntry* child = getCacheEntry(orphan); if(child) { entry->addChild(child); @@ -2801,7 +2796,7 @@ void LLViewerRegion::requestCacheMisses() } LLMessageSystem* msg = gMessageSystem; - BOOL start_new_message = TRUE; + bool start_new_message = true; S32 blocks = 0; //send requests for all cache-missed objects @@ -2813,7 +2808,7 @@ void LLViewerRegion::requestCacheMisses() msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - start_new_message = FALSE; + start_new_message = false; } msg->nextBlockFast(_PREHASH_ObjectData); @@ -2827,7 +2822,7 @@ void LLViewerRegion::requestCacheMisses() if (blocks >= 255) { sendReliableMessage(); - start_new_message = TRUE; + start_new_message = true; blocks = 0; } } @@ -2838,9 +2833,9 @@ void LLViewerRegion::requestCacheMisses() sendReliableMessage(); } - mCacheDirty = TRUE ; + mCacheDirty = true ; // LL_INFOS() << "KILLDEBUG Sent cache miss full " << full_count << " crc " << crc_count << LL_ENDL; - LLViewerStatsRecorder::instance().requestCacheMissesEvent(mCacheMissList.size()); + LLViewerStatsRecorder::instance().requestCacheMissesEvent(static_cast<S32>(mCacheMissList.size())); mCacheMissList.clear(); } @@ -2894,7 +2889,7 @@ void LLViewerRegion::unpackRegionHandshake() U8 sim_access; std::string sim_name; LLUUID sim_owner; - BOOL is_estate_manager; + bool is_estate_manager; F32 water_height; F32 billable_factor; LLUUID cache_id; @@ -3442,7 +3437,7 @@ void LLViewerRegion::setInterestListMode(const std::string &new_mode) { mInterestListMode = new_mode; - if (mInterestListMode != std::string(IL_MODE_DEFAULT) && mInterestListMode != std::string(IL_MODE_360)) + if (mInterestListMode != IL_MODE_DEFAULT && mInterestListMode != IL_MODE_360) { LL_WARNS("360Capture") << "Region " << getRegionID() << " setInterestListMode() invalid interest list mode: " << mInterestListMode << ", setting to default" << LL_ENDL; @@ -3550,12 +3545,12 @@ void LLViewerRegion::showReleaseNotes() if (url.empty()) { // HACK haven't received the capability yet, we'll wait until // it arives. - mReleaseNotesRequested = TRUE; + mReleaseNotesRequested = true; return; } LLWeb::loadURL(url); - mReleaseNotesRequested = FALSE; + mReleaseNotesRequested = false; } std::string LLViewerRegion::getDescription() const |