aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerregion.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewerregion.cpp69
1 files changed, 48 insertions, 21 deletions
diff --git a/linden/indra/newview/llviewerregion.cpp b/linden/indra/newview/llviewerregion.cpp
index 9c741b4..88d8a40 100644
--- a/linden/indra/newview/llviewerregion.cpp
+++ b/linden/indra/newview/llviewerregion.cpp
@@ -178,14 +178,14 @@ void LLViewerRegion::loadCache()
178 178
179 LLVOCacheEntry *entry; 179 LLVOCacheEntry *entry;
180 180
181 char filename[256]; 181 char filename[256]; /* Flawfinder: ignore */
182 sprintf(filename, "%s%sobjects_%d_%d.slc", 182 snprintf(filename, sizeof(filename), "%s%sobjects_%d_%d.slc", /* Flawfinder: ignore */
183 gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"").c_str(), 183 gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"").c_str(),
184 gDirUtilp->getDirDelimiter().c_str(), 184 gDirUtilp->getDirDelimiter().c_str(),
185 U32(mHandle>>32)/REGION_WIDTH_UNITS, 185 U32(mHandle>>32)/REGION_WIDTH_UNITS,
186 U32(mHandle)/REGION_WIDTH_UNITS ); 186 U32(mHandle)/REGION_WIDTH_UNITS );
187 187
188 FILE *fp = LLFile::fopen(filename, "rb"); 188 FILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */
189 if (!fp) 189 if (!fp)
190 { 190 {
191 // might not have a file, which is normal 191 // might not have a file, which is normal
@@ -259,14 +259,14 @@ void LLViewerRegion::saveCache()
259 return; 259 return;
260 } 260 }
261 261
262 char filename[256]; 262 char filename[256]; /* Flawfinder: ignore */
263 sprintf(filename, "%s%sobjects_%d_%d.slc", 263 snprintf(filename, sizeof(filename), "%s%sobjects_%d_%d.slc", /* Flawfinder: ignore */
264 gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"").c_str(), 264 gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"").c_str(),
265 gDirUtilp->getDirDelimiter().c_str(), 265 gDirUtilp->getDirDelimiter().c_str(),
266 U32(mHandle>>32)/REGION_WIDTH_UNITS, 266 U32(mHandle>>32)/REGION_WIDTH_UNITS,
267 U32(mHandle)/REGION_WIDTH_UNITS ); 267 U32(mHandle)/REGION_WIDTH_UNITS );
268 268
269 FILE *fp = LLFile::fopen(filename, "wb"); 269 FILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */
270 if (!fp) 270 if (!fp)
271 { 271 {
272 llwarns << "Unable to write cache file " << filename << llendl; 272 llwarns << "Unable to write cache file " << filename << llendl;
@@ -500,9 +500,9 @@ char* SIM_ACCESS_STR[] = { "Free Trial",
500 "Unknown" }; 500 "Unknown" };
501 501
502// static 502// static
503const char* LLViewerRegion::accessToString(U8 access) 503const char* LLViewerRegion::accessToString(U8 access) /* Flawfinder: ignore */
504{ 504{
505 switch(access) 505 switch(access) /* Flawfinder: ignore */
506 { 506 {
507 case SIM_ACCESS_TRIAL: 507 case SIM_ACCESS_TRIAL:
508 return SIM_ACCESS_STR[0]; 508 return SIM_ACCESS_STR[0];
@@ -538,13 +538,13 @@ U8 LLViewerRegion::stringToAccess(const char* access_str)
538 { 538 {
539 access = SIM_ACCESS_MATURE; 539 access = SIM_ACCESS_MATURE;
540 } 540 }
541 return access; 541 return access; /* Flawfinder: ignore */
542} 542}
543 543
544// static 544// static
545const char* LLViewerRegion::accessToShortString(U8 access) 545const char* LLViewerRegion::accessToShortString(U8 access) /* Flawfinder: ignore */
546{ 546{
547 switch(access) 547 switch(access) /* Flawfinder: ignore */
548 { 548 {
549 case SIM_ACCESS_PG: 549 case SIM_ACCESS_PG:
550 return "PG"; 550 return "PG";
@@ -594,23 +594,25 @@ void LLViewerRegion::dirtyHeights()
594 } 594 }
595} 595}
596 596
597BOOL LLViewerRegion::idleUpdate(LLTimer &timer, const F32 max_time) 597BOOL LLViewerRegion::idleUpdate(F32 max_update_time)
598{ 598{
599 BOOL done = mLandp->idleUpdate(); 599 // did_update returns TRUE if we did at least one significant update
600 600 BOOL did_update = mLandp->idleUpdate(max_update_time);
601
601 if (mParcelOverlay) 602 if (mParcelOverlay)
602 { 603 {
604 // Hopefully not a significant time sink...
603 mParcelOverlay->idleUpdate(); 605 mParcelOverlay->idleUpdate();
604 } 606 }
605 607
606 return done; 608 return did_update;
607} 609}
608 610
609 611
610// As above, but forcibly do the update. 612// As above, but forcibly do the update.
611void LLViewerRegion::forceUpdate() 613void LLViewerRegion::forceUpdate()
612{ 614{
613 mLandp->idleUpdate(); 615 mLandp->idleUpdate(0.f);
614 616
615 if (mParcelOverlay) 617 if (mParcelOverlay)
616 { 618 {
@@ -845,7 +847,7 @@ LLVector3 LLViewerRegion::getPosAgentFromRegion(const LLVector3 &pos_region) con
845 847
846LLVector3 LLViewerRegion::getPosRegionFromAgent(const LLVector3 &pos_agent) const 848LLVector3 LLViewerRegion::getPosRegionFromAgent(const LLVector3 &pos_agent) const
847{ 849{
848 return getPosRegionFromGlobal(gAgent.getPosGlobalFromAgent(pos_agent)); 850 return pos_agent - getOriginAgent();
849} 851}
850 852
851F32 LLViewerRegion::getLandHeightRegion(const LLVector3& region_pos) 853F32 LLViewerRegion::getLandHeightRegion(const LLVector3& region_pos)
@@ -916,7 +918,7 @@ void LLViewerRegion::updateCoarseLocations(LLMessageSystem* msg)
916 918
917LLString LLViewerRegion::getInfoString() 919LLString LLViewerRegion::getInfoString()
918{ 920{
919 char tmp_buf[256]; 921 char tmp_buf[256]; /* Flawfinder: ignore */
920 LLString info; 922 LLString info;
921 923
922 info = "Region: "; 924 info = "Region: ";
@@ -928,7 +930,7 @@ LLString LLViewerRegion::getInfoString()
928 930
929 U32 x, y; 931 U32 x, y;
930 from_region_handle(getHandle(), &x, &y); 932 from_region_handle(getHandle(), &x, &y);
931 sprintf(tmp_buf, "%d:%d", x, y); 933 snprintf(tmp_buf, sizeof(tmp_buf), "%d:%d", x, y); /* Flawfinder: ignore */
932 info += "Handle:"; 934 info += "Handle:";
933 info += tmp_buf; 935 info += tmp_buf;
934 info += "\n"; 936 info += "\n";
@@ -1140,7 +1142,7 @@ void LLViewerRegion::unpackRegionHandshake()
1140 const S32 SIM_NAME_BUF = 256; 1142 const S32 SIM_NAME_BUF = 256;
1141 U32 region_flags; 1143 U32 region_flags;
1142 U8 sim_access; 1144 U8 sim_access;
1143 char sim_name[SIM_NAME_BUF]; 1145 char sim_name[SIM_NAME_BUF]; /* Flawfinder: ignore */
1144 LLUUID sim_owner; 1146 LLUUID sim_owner;
1145 BOOL is_estate_manager; 1147 BOOL is_estate_manager;
1146 F32 water_height; 1148 F32 water_height;
@@ -1277,8 +1279,20 @@ void LLViewerRegion::setSeedCapability(const std::string& url)
1277 LLSD capabilityNames = LLSD::emptyArray(); 1279 LLSD capabilityNames = LLSD::emptyArray();
1278 capabilityNames.append("MapLayer"); 1280 capabilityNames.append("MapLayer");
1279 capabilityNames.append("MapLayerGod"); 1281 capabilityNames.append("MapLayerGod");
1280 capabilityNames.append("NewAgentInventory"); 1282 capabilityNames.append("NewFileAgentInventory");
1281 capabilityNames.append("EventQueueGet"); 1283 capabilityNames.append("EventQueueGet");
1284 capabilityNames.append("UpdateGestureAgentInventory");
1285 capabilityNames.append("UpdateNotecardAgentInventory");
1286 capabilityNames.append("UpdateScriptAgentInventory");
1287 capabilityNames.append("UpdateGestureTaskInventory");
1288 capabilityNames.append("UpdateNotecardTaskInventory");
1289 capabilityNames.append("UpdateScriptTaskInventory");
1290 capabilityNames.append("SendPostcard");
1291 capabilityNames.append("ViewerStartAuction");
1292 capabilityNames.append("ParcelGodReserveForNewbie");
1293 capabilityNames.append("SendUserReport");
1294 capabilityNames.append("SendUserReportWithScreenshot");
1295 capabilityNames.append("RequestTextureDownload");
1282 LLHTTPClient::post(url, capabilityNames, BaseCapabilitiesComplete::build(this)); 1296 LLHTTPClient::post(url, capabilityNames, BaseCapabilitiesComplete::build(this));
1283} 1297}
1284 1298
@@ -1320,3 +1334,16 @@ std::string LLViewerRegion::getCapability(const std::string& name) const
1320 return iter->second; 1334 return iter->second;
1321} 1335}
1322 1336
1337void LLViewerRegion::logActiveCapabilities() const
1338{
1339 CapabilityMap::const_iterator iter;
1340 for (iter = mCapabilities.begin(); iter != mCapabilities.end(); iter++)
1341 {
1342 if (!iter->second.empty())
1343 {
1344 // llinfos << "Active capability is " << iter->first << llendl;
1345 llinfos << iter->first << " URL is " << iter->second << llendl;
1346 }
1347 }
1348}
1349