From 798d367d54a6c6379ad355bd8345fa40e31e7fe9 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Sat, 6 Sep 2008 18:24:57 -0500 Subject: Second Life viewer sources 1.21.0-RC --- linden/indra/newview/llviewerregion.cpp | 108 ++++++++++++++++++-------------- 1 file changed, 62 insertions(+), 46 deletions(-) (limited to 'linden/indra/newview/llviewerregion.cpp') diff --git a/linden/indra/newview/llviewerregion.cpp b/linden/indra/newview/llviewerregion.cpp index f745aca..08dc979 100644 --- a/linden/indra/newview/llviewerregion.cpp +++ b/linden/indra/newview/llviewerregion.cpp @@ -50,7 +50,6 @@ #include "lldir.h" #include "lleventpoll.h" #include "llfloatergodtools.h" -#include "llfloaterreleasemsg.h" #include "llfloaterreporter.h" #include "llfloaterregioninfo.h" #include "llhttpnode.h" @@ -108,7 +107,7 @@ public: void result(const LLSD& content) { - if(!mRegion || this != mRegion->getHttpResponderPtr())//region is removed or responder is not created. + if(!mRegion || LLHTTPClient::ResponderPtr(this) != mRegion->getHttpResponderPtr()) //region is removed or responder is not created. { return ; } @@ -121,10 +120,9 @@ public: << iter->first << LL_ENDL; /* HACK we're waiting for the ServerReleaseNotes */ - if ((iter->first == "ServerReleaseNotes") && (LLFloaterReleaseMsg::sDisplayMessage)) + if (iter->first == "ServerReleaseNotes" && mRegion->getReleaseNotesRequested()) { - LLFloaterReleaseMsg::show(); - LLFloaterReleaseMsg::sDisplayMessage = false; + mRegion->showReleaseNotes(); } } @@ -163,11 +161,12 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mRegionFlags( REGION_FLAGS_DEFAULT ), mSimAccess( SIM_ACCESS_MIN ), mBillableFactor(1.0), - mMaxTasks(MAX_TASKS_PER_REGION), + mMaxTasks(DEFAULT_MAX_REGION_WIDE_PRIM_COUNT), mCacheLoaded(FALSE), mCacheEntriesCount(0), mCacheID(), - mEventPoll(NULL) + mEventPoll(NULL), + mReleaseNotesRequested(FALSE) { mWidth = region_width_meters; mOriginGlobal = from_region_handle(handle); @@ -233,7 +232,7 @@ void LLViewerRegion::initStats() mPacketsLost = 0; mLastPacketsLost = 0; mPingDelay = 0; - mAlive = FALSE; // can become false if circuit disconnects + mAlive = false; // can become false if circuit disconnects } LLViewerRegion::~LLViewerRegion() @@ -276,12 +275,9 @@ void LLViewerRegion::loadCache() LLVOCacheEntry *entry; - char filename[256]; /* Flawfinder: ignore */ - snprintf(filename, sizeof(filename), "%s%sobjects_%d_%d.slc", /* Flawfinder: ignore */ - gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"").c_str(), - gDirUtilp->getDirDelimiter().c_str(), - U32(mHandle>>32)/REGION_WIDTH_UNITS, - U32(mHandle)/REGION_WIDTH_UNITS ); + 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 ); LLFILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ if (!fp) @@ -365,12 +361,9 @@ void LLViewerRegion::saveCache() return; } - char filename[256]; /* Flawfinder: ignore */ - snprintf(filename, sizeof(filename), "%s%sobjects_%d_%d.slc", /* Flawfinder: ignore */ - gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"").c_str(), - gDirUtilp->getDirDelimiter().c_str(), - U32(mHandle>>32)/REGION_WIDTH_UNITS, - U32(mHandle)/REGION_WIDTH_UNITS ); + std::string filename; + filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"") + gDirUtilp->getDirDelimiter() + + llformat("sobjects_%d_%d.slc", U32(mHandle>>32)/REGION_WIDTH_UNITS, U32(mHandle)/REGION_WIDTH_UNITS ); LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ if (!fp) @@ -495,9 +488,8 @@ LLVector3 LLViewerRegion::getCenterAgent() const return gAgent.getPosAgentFromGlobal(mCenterGlobal); } -void LLViewerRegion::setRegionNameAndZone(const char* name_and_zone) +void LLViewerRegion::setRegionNameAndZone (const std::string& name_zone) { - LLString name_zone(name_and_zone); std::string::size_type pipe_pos = name_zone.find('|'); S32 length = name_zone.size(); if (pipe_pos != std::string::npos) @@ -511,8 +503,8 @@ void LLViewerRegion::setRegionNameAndZone(const char* name_and_zone) mZoning = ""; } - LLString::stripNonprintable(mName); - LLString::stripNonprintable(mZoning); + LLStringUtil::stripNonprintable(mName); + LLStringUtil::stripNonprintable(mZoning); } BOOL LLViewerRegion::canManageEstate() const @@ -522,7 +514,7 @@ BOOL LLViewerRegion::canManageEstate() const || gAgent.getID() == getOwner(); } -const char* LLViewerRegion::getSimAccessString() const +const std::string LLViewerRegion::getSimAccessString() const { return accessToString(mSimAccess); } @@ -547,16 +539,16 @@ std::string LLViewerRegion::regionFlagsToString(U32 flags) } // *TODO:Translate -char* SIM_ACCESS_STR[] = { "Free Trial", +const char* SIM_ACCESS_STR[] = { "Free Trial", "PG", "Mature", "Offline", "Unknown" }; // static -const char* LLViewerRegion::accessToString(U8 access) /* Flawfinder: ignore */ +std::string LLViewerRegion::accessToString(U8 sim_access) { - switch(access) /* Flawfinder: ignore */ + switch(sim_access) { case SIM_ACCESS_TRIAL: return SIM_ACCESS_STR[0]; @@ -577,28 +569,28 @@ const char* LLViewerRegion::accessToString(U8 access) /* Flawfinder: ignore */ } // static -U8 LLViewerRegion::stringToAccess(const char* access_str) +U8 LLViewerRegion::stringToAccess(const std::string& access_str) { - U8 access = SIM_ACCESS_MIN; - if (0 == strcmp(access_str, SIM_ACCESS_STR[0])) + U8 sim_access = SIM_ACCESS_MIN; + if (access_str == SIM_ACCESS_STR[0]) { - access = SIM_ACCESS_TRIAL; + sim_access = SIM_ACCESS_TRIAL; } - else if (0 == strcmp(access_str, SIM_ACCESS_STR[1])) + else if (access_str == SIM_ACCESS_STR[1]) { - access = SIM_ACCESS_PG; + sim_access = SIM_ACCESS_PG; } - else if (0 == strcmp(access_str, SIM_ACCESS_STR[2])) + else if (access_str == SIM_ACCESS_STR[2]) { - access = SIM_ACCESS_MATURE; + sim_access = SIM_ACCESS_MATURE; } - return access; /* Flawfinder: ignore */ + return sim_access; } // static -const char* LLViewerRegion::accessToShortString(U8 access) /* Flawfinder: ignore */ +std::string LLViewerRegion::accessToShortString(U8 sim_access) { - switch(access) /* Flawfinder: ignore */ + switch(sim_access) /* Flawfinder: ignore */ { case SIM_ACCESS_PG: return "PG"; @@ -815,11 +807,11 @@ void LLViewerRegion::updateNetStats() LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(mHost); if (!cdp) { - mAlive = FALSE; + mAlive = false; return; } - mAlive = TRUE; + mAlive = true; mDeltaTime = dt; mLastPacketsIn = mPacketsIn; @@ -907,6 +899,11 @@ F32 LLViewerRegion::getLandHeightRegion(const LLVector3& region_pos) return mLandp->resolveHeightRegion( region_pos ); } +bool LLViewerRegion::isAlive() +{ + return mAlive; +} + BOOL LLViewerRegion::isOwnedSelf(const LLVector3& pos) { if (mParcelOverlay) @@ -1277,10 +1274,9 @@ void LLViewerRegion::unpackRegionHandshake() { LLMessageSystem *msg = gMessageSystem; - const S32 SIM_NAME_BUF = 256; U32 region_flags; U8 sim_access; - char sim_name[SIM_NAME_BUF]; /* Flawfinder: ignore */ + std::string sim_name; LLUUID sim_owner; BOOL is_estate_manager; F32 water_height; @@ -1289,7 +1285,7 @@ void LLViewerRegion::unpackRegionHandshake() msg->getU32 ("RegionInfo", "RegionFlags", region_flags); msg->getU8 ("RegionInfo", "SimAccess", sim_access); - msg->getString ("RegionInfo", "SimName", SIM_NAME_BUF, sim_name); + msg->getString ("RegionInfo", "SimName", sim_name); msg->getUUID ("RegionInfo", "SimOwner", sim_owner); msg->getBOOL ("RegionInfo", "IsEstateManager", is_estate_manager); msg->getF32 ("RegionInfo", "WaterHeight", water_height); @@ -1408,12 +1404,13 @@ void LLViewerRegion::setSeedCapability(const std::string& url) capabilityNames.append("SendUserReportWithScreenshot"); capabilityNames.append("ServerReleaseNotes"); capabilityNames.append("StartGroupProposal"); + capabilityNames.append("UpdateAgentLanguage"); capabilityNames.append("UpdateGestureAgentInventory"); capabilityNames.append("UpdateNotecardAgentInventory"); - capabilityNames.append("UpdateScriptAgentInventory"); + capabilityNames.append("UpdateScriptAgent"); capabilityNames.append("UpdateGestureTaskInventory"); capabilityNames.append("UpdateNotecardTaskInventory"); - capabilityNames.append("UpdateScriptTaskInventory"); + capabilityNames.append("UpdateScriptTask"); capabilityNames.append("ViewerStartAuction"); capabilityNames.append("UntrustedSimulatorMessage"); capabilityNames.append("ViewerStats"); @@ -1444,6 +1441,11 @@ void LLViewerRegion::setCapability(const std::string& name, const std::string& u } } +bool LLViewerRegion::isSpecialCapabilityName(const std::string &name) +{ + return name == "EventQueueGet" || name == "UntrustedSimulatorMessage"; +} + std::string LLViewerRegion::getCapability(const std::string& name) const { CapabilityMap::const_iterator iter = mCapabilities.find(name); @@ -1477,3 +1479,17 @@ LLSpatialPartition* LLViewerRegion::getSpatialPartition(U32 type) return NULL; } +void LLViewerRegion::showReleaseNotes() +{ + std::string url = this->getCapability("ServerReleaseNotes"); + + if (url.empty()) { + // HACK haven't received the capability yet, we'll wait until + // it arives. + mReleaseNotesRequested = TRUE; + return; + } + + LLWeb::loadURL(url); + mReleaseNotesRequested = FALSE; +} -- cgit v1.1