aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerregion.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llviewerregion.cpp')
-rw-r--r--linden/indra/newview/llviewerregion.cpp108
1 files changed, 62 insertions, 46 deletions
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 @@
50#include "lldir.h" 50#include "lldir.h"
51#include "lleventpoll.h" 51#include "lleventpoll.h"
52#include "llfloatergodtools.h" 52#include "llfloatergodtools.h"
53#include "llfloaterreleasemsg.h"
54#include "llfloaterreporter.h" 53#include "llfloaterreporter.h"
55#include "llfloaterregioninfo.h" 54#include "llfloaterregioninfo.h"
56#include "llhttpnode.h" 55#include "llhttpnode.h"
@@ -108,7 +107,7 @@ public:
108 107
109 void result(const LLSD& content) 108 void result(const LLSD& content)
110 { 109 {
111 if(!mRegion || this != mRegion->getHttpResponderPtr())//region is removed or responder is not created. 110 if(!mRegion || LLHTTPClient::ResponderPtr(this) != mRegion->getHttpResponderPtr()) //region is removed or responder is not created.
112 { 111 {
113 return ; 112 return ;
114 } 113 }
@@ -121,10 +120,9 @@ public:
121 << iter->first << LL_ENDL; 120 << iter->first << LL_ENDL;
122 121
123 /* HACK we're waiting for the ServerReleaseNotes */ 122 /* HACK we're waiting for the ServerReleaseNotes */
124 if ((iter->first == "ServerReleaseNotes") && (LLFloaterReleaseMsg::sDisplayMessage)) 123 if (iter->first == "ServerReleaseNotes" && mRegion->getReleaseNotesRequested())
125 { 124 {
126 LLFloaterReleaseMsg::show(); 125 mRegion->showReleaseNotes();
127 LLFloaterReleaseMsg::sDisplayMessage = false;
128 } 126 }
129 } 127 }
130 128
@@ -163,11 +161,12 @@ LLViewerRegion::LLViewerRegion(const U64 &handle,
163 mRegionFlags( REGION_FLAGS_DEFAULT ), 161 mRegionFlags( REGION_FLAGS_DEFAULT ),
164 mSimAccess( SIM_ACCESS_MIN ), 162 mSimAccess( SIM_ACCESS_MIN ),
165 mBillableFactor(1.0), 163 mBillableFactor(1.0),
166 mMaxTasks(MAX_TASKS_PER_REGION), 164 mMaxTasks(DEFAULT_MAX_REGION_WIDE_PRIM_COUNT),
167 mCacheLoaded(FALSE), 165 mCacheLoaded(FALSE),
168 mCacheEntriesCount(0), 166 mCacheEntriesCount(0),
169 mCacheID(), 167 mCacheID(),
170 mEventPoll(NULL) 168 mEventPoll(NULL),
169 mReleaseNotesRequested(FALSE)
171{ 170{
172 mWidth = region_width_meters; 171 mWidth = region_width_meters;
173 mOriginGlobal = from_region_handle(handle); 172 mOriginGlobal = from_region_handle(handle);
@@ -233,7 +232,7 @@ void LLViewerRegion::initStats()
233 mPacketsLost = 0; 232 mPacketsLost = 0;
234 mLastPacketsLost = 0; 233 mLastPacketsLost = 0;
235 mPingDelay = 0; 234 mPingDelay = 0;
236 mAlive = FALSE; // can become false if circuit disconnects 235 mAlive = false; // can become false if circuit disconnects
237} 236}
238 237
239LLViewerRegion::~LLViewerRegion() 238LLViewerRegion::~LLViewerRegion()
@@ -276,12 +275,9 @@ void LLViewerRegion::loadCache()
276 275
277 LLVOCacheEntry *entry; 276 LLVOCacheEntry *entry;
278 277
279 char filename[256]; /* Flawfinder: ignore */ 278 std::string filename;
280 snprintf(filename, sizeof(filename), "%s%sobjects_%d_%d.slc", /* Flawfinder: ignore */ 279 filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"") + gDirUtilp->getDirDelimiter() +
281 gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"").c_str(), 280 llformat("objects_%d_%d.slc",U32(mHandle>>32)/REGION_WIDTH_UNITS, U32(mHandle)/REGION_WIDTH_UNITS );
282 gDirUtilp->getDirDelimiter().c_str(),
283 U32(mHandle>>32)/REGION_WIDTH_UNITS,
284 U32(mHandle)/REGION_WIDTH_UNITS );
285 281
286 LLFILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ 282 LLFILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */
287 if (!fp) 283 if (!fp)
@@ -365,12 +361,9 @@ void LLViewerRegion::saveCache()
365 return; 361 return;
366 } 362 }
367 363
368 char filename[256]; /* Flawfinder: ignore */ 364 std::string filename;
369 snprintf(filename, sizeof(filename), "%s%sobjects_%d_%d.slc", /* Flawfinder: ignore */ 365 filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"") + gDirUtilp->getDirDelimiter() +
370 gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"").c_str(), 366 llformat("sobjects_%d_%d.slc", U32(mHandle>>32)/REGION_WIDTH_UNITS, U32(mHandle)/REGION_WIDTH_UNITS );
371 gDirUtilp->getDirDelimiter().c_str(),
372 U32(mHandle>>32)/REGION_WIDTH_UNITS,
373 U32(mHandle)/REGION_WIDTH_UNITS );
374 367
375 LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ 368 LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */
376 if (!fp) 369 if (!fp)
@@ -495,9 +488,8 @@ LLVector3 LLViewerRegion::getCenterAgent() const
495 return gAgent.getPosAgentFromGlobal(mCenterGlobal); 488 return gAgent.getPosAgentFromGlobal(mCenterGlobal);
496} 489}
497 490
498void LLViewerRegion::setRegionNameAndZone(const char* name_and_zone) 491void LLViewerRegion::setRegionNameAndZone (const std::string& name_zone)
499{ 492{
500 LLString name_zone(name_and_zone);
501 std::string::size_type pipe_pos = name_zone.find('|'); 493 std::string::size_type pipe_pos = name_zone.find('|');
502 S32 length = name_zone.size(); 494 S32 length = name_zone.size();
503 if (pipe_pos != std::string::npos) 495 if (pipe_pos != std::string::npos)
@@ -511,8 +503,8 @@ void LLViewerRegion::setRegionNameAndZone(const char* name_and_zone)
511 mZoning = ""; 503 mZoning = "";
512 } 504 }
513 505
514 LLString::stripNonprintable(mName); 506 LLStringUtil::stripNonprintable(mName);
515 LLString::stripNonprintable(mZoning); 507 LLStringUtil::stripNonprintable(mZoning);
516} 508}
517 509
518BOOL LLViewerRegion::canManageEstate() const 510BOOL LLViewerRegion::canManageEstate() const
@@ -522,7 +514,7 @@ BOOL LLViewerRegion::canManageEstate() const
522 || gAgent.getID() == getOwner(); 514 || gAgent.getID() == getOwner();
523} 515}
524 516
525const char* LLViewerRegion::getSimAccessString() const 517const std::string LLViewerRegion::getSimAccessString() const
526{ 518{
527 return accessToString(mSimAccess); 519 return accessToString(mSimAccess);
528} 520}
@@ -547,16 +539,16 @@ std::string LLViewerRegion::regionFlagsToString(U32 flags)
547} 539}
548 540
549// *TODO:Translate 541// *TODO:Translate
550char* SIM_ACCESS_STR[] = { "Free Trial", 542const char* SIM_ACCESS_STR[] = { "Free Trial",
551 "PG", 543 "PG",
552 "Mature", 544 "Mature",
553 "Offline", 545 "Offline",
554 "Unknown" }; 546 "Unknown" };
555 547
556// static 548// static
557const char* LLViewerRegion::accessToString(U8 access) /* Flawfinder: ignore */ 549std::string LLViewerRegion::accessToString(U8 sim_access)
558{ 550{
559 switch(access) /* Flawfinder: ignore */ 551 switch(sim_access)
560 { 552 {
561 case SIM_ACCESS_TRIAL: 553 case SIM_ACCESS_TRIAL:
562 return SIM_ACCESS_STR[0]; 554 return SIM_ACCESS_STR[0];
@@ -577,28 +569,28 @@ const char* LLViewerRegion::accessToString(U8 access) /* Flawfinder: ignore */
577} 569}
578 570
579// static 571// static
580U8 LLViewerRegion::stringToAccess(const char* access_str) 572U8 LLViewerRegion::stringToAccess(const std::string& access_str)
581{ 573{
582 U8 access = SIM_ACCESS_MIN; 574 U8 sim_access = SIM_ACCESS_MIN;
583 if (0 == strcmp(access_str, SIM_ACCESS_STR[0])) 575 if (access_str == SIM_ACCESS_STR[0])
584 { 576 {
585 access = SIM_ACCESS_TRIAL; 577 sim_access = SIM_ACCESS_TRIAL;
586 } 578 }
587 else if (0 == strcmp(access_str, SIM_ACCESS_STR[1])) 579 else if (access_str == SIM_ACCESS_STR[1])
588 { 580 {
589 access = SIM_ACCESS_PG; 581 sim_access = SIM_ACCESS_PG;
590 } 582 }
591 else if (0 == strcmp(access_str, SIM_ACCESS_STR[2])) 583 else if (access_str == SIM_ACCESS_STR[2])
592 { 584 {
593 access = SIM_ACCESS_MATURE; 585 sim_access = SIM_ACCESS_MATURE;
594 } 586 }
595 return access; /* Flawfinder: ignore */ 587 return sim_access;
596} 588}
597 589
598// static 590// static
599const char* LLViewerRegion::accessToShortString(U8 access) /* Flawfinder: ignore */ 591std::string LLViewerRegion::accessToShortString(U8 sim_access)
600{ 592{
601 switch(access) /* Flawfinder: ignore */ 593 switch(sim_access) /* Flawfinder: ignore */
602 { 594 {
603 case SIM_ACCESS_PG: 595 case SIM_ACCESS_PG:
604 return "PG"; 596 return "PG";
@@ -815,11 +807,11 @@ void LLViewerRegion::updateNetStats()
815 LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(mHost); 807 LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(mHost);
816 if (!cdp) 808 if (!cdp)
817 { 809 {
818 mAlive = FALSE; 810 mAlive = false;
819 return; 811 return;
820 } 812 }
821 813
822 mAlive = TRUE; 814 mAlive = true;
823 mDeltaTime = dt; 815 mDeltaTime = dt;
824 816
825 mLastPacketsIn = mPacketsIn; 817 mLastPacketsIn = mPacketsIn;
@@ -907,6 +899,11 @@ F32 LLViewerRegion::getLandHeightRegion(const LLVector3& region_pos)
907 return mLandp->resolveHeightRegion( region_pos ); 899 return mLandp->resolveHeightRegion( region_pos );
908} 900}
909 901
902bool LLViewerRegion::isAlive()
903{
904 return mAlive;
905}
906
910BOOL LLViewerRegion::isOwnedSelf(const LLVector3& pos) 907BOOL LLViewerRegion::isOwnedSelf(const LLVector3& pos)
911{ 908{
912 if (mParcelOverlay) 909 if (mParcelOverlay)
@@ -1277,10 +1274,9 @@ void LLViewerRegion::unpackRegionHandshake()
1277{ 1274{
1278 LLMessageSystem *msg = gMessageSystem; 1275 LLMessageSystem *msg = gMessageSystem;
1279 1276
1280 const S32 SIM_NAME_BUF = 256;
1281 U32 region_flags; 1277 U32 region_flags;
1282 U8 sim_access; 1278 U8 sim_access;
1283 char sim_name[SIM_NAME_BUF]; /* Flawfinder: ignore */ 1279 std::string sim_name;
1284 LLUUID sim_owner; 1280 LLUUID sim_owner;
1285 BOOL is_estate_manager; 1281 BOOL is_estate_manager;
1286 F32 water_height; 1282 F32 water_height;
@@ -1289,7 +1285,7 @@ void LLViewerRegion::unpackRegionHandshake()
1289 1285
1290 msg->getU32 ("RegionInfo", "RegionFlags", region_flags); 1286 msg->getU32 ("RegionInfo", "RegionFlags", region_flags);
1291 msg->getU8 ("RegionInfo", "SimAccess", sim_access); 1287 msg->getU8 ("RegionInfo", "SimAccess", sim_access);
1292 msg->getString ("RegionInfo", "SimName", SIM_NAME_BUF, sim_name); 1288 msg->getString ("RegionInfo", "SimName", sim_name);
1293 msg->getUUID ("RegionInfo", "SimOwner", sim_owner); 1289 msg->getUUID ("RegionInfo", "SimOwner", sim_owner);
1294 msg->getBOOL ("RegionInfo", "IsEstateManager", is_estate_manager); 1290 msg->getBOOL ("RegionInfo", "IsEstateManager", is_estate_manager);
1295 msg->getF32 ("RegionInfo", "WaterHeight", water_height); 1291 msg->getF32 ("RegionInfo", "WaterHeight", water_height);
@@ -1408,12 +1404,13 @@ void LLViewerRegion::setSeedCapability(const std::string& url)
1408 capabilityNames.append("SendUserReportWithScreenshot"); 1404 capabilityNames.append("SendUserReportWithScreenshot");
1409 capabilityNames.append("ServerReleaseNotes"); 1405 capabilityNames.append("ServerReleaseNotes");
1410 capabilityNames.append("StartGroupProposal"); 1406 capabilityNames.append("StartGroupProposal");
1407 capabilityNames.append("UpdateAgentLanguage");
1411 capabilityNames.append("UpdateGestureAgentInventory"); 1408 capabilityNames.append("UpdateGestureAgentInventory");
1412 capabilityNames.append("UpdateNotecardAgentInventory"); 1409 capabilityNames.append("UpdateNotecardAgentInventory");
1413 capabilityNames.append("UpdateScriptAgentInventory"); 1410 capabilityNames.append("UpdateScriptAgent");
1414 capabilityNames.append("UpdateGestureTaskInventory"); 1411 capabilityNames.append("UpdateGestureTaskInventory");
1415 capabilityNames.append("UpdateNotecardTaskInventory"); 1412 capabilityNames.append("UpdateNotecardTaskInventory");
1416 capabilityNames.append("UpdateScriptTaskInventory"); 1413 capabilityNames.append("UpdateScriptTask");
1417 capabilityNames.append("ViewerStartAuction"); 1414 capabilityNames.append("ViewerStartAuction");
1418 capabilityNames.append("UntrustedSimulatorMessage"); 1415 capabilityNames.append("UntrustedSimulatorMessage");
1419 capabilityNames.append("ViewerStats"); 1416 capabilityNames.append("ViewerStats");
@@ -1444,6 +1441,11 @@ void LLViewerRegion::setCapability(const std::string& name, const std::string& u
1444 } 1441 }
1445} 1442}
1446 1443
1444bool LLViewerRegion::isSpecialCapabilityName(const std::string &name)
1445{
1446 return name == "EventQueueGet" || name == "UntrustedSimulatorMessage";
1447}
1448
1447std::string LLViewerRegion::getCapability(const std::string& name) const 1449std::string LLViewerRegion::getCapability(const std::string& name) const
1448{ 1450{
1449 CapabilityMap::const_iterator iter = mCapabilities.find(name); 1451 CapabilityMap::const_iterator iter = mCapabilities.find(name);
@@ -1477,3 +1479,17 @@ LLSpatialPartition* LLViewerRegion::getSpatialPartition(U32 type)
1477 return NULL; 1479 return NULL;
1478} 1480}
1479 1481
1482void LLViewerRegion::showReleaseNotes()
1483{
1484 std::string url = this->getCapability("ServerReleaseNotes");
1485
1486 if (url.empty()) {
1487 // HACK haven't received the capability yet, we'll wait until
1488 // it arives.
1489 mReleaseNotesRequested = TRUE;
1490 return;
1491 }
1492
1493 LLWeb::loadURL(url);
1494 mReleaseNotesRequested = FALSE;
1495}