aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lllandmarklist.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/lllandmarklist.cpp
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/lllandmarklist.cpp')
-rw-r--r--linden/indra/newview/lllandmarklist.cpp135
1 files changed, 135 insertions, 0 deletions
diff --git a/linden/indra/newview/lllandmarklist.cpp b/linden/indra/newview/lllandmarklist.cpp
new file mode 100644
index 0000000..a1c658d
--- /dev/null
+++ b/linden/indra/newview/lllandmarklist.cpp
@@ -0,0 +1,135 @@
1/**
2 * @file lllandmarklist.cpp
3 * @brief Landmark asset list class
4 *
5 * Copyright (c) 2002-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28#include "llviewerprecompiledheaders.h"
29
30#include "lllandmarklist.h"
31
32#include "message.h"
33#include "llassetstorage.h"
34
35#include "llagent.h"
36#include "llnotify.h"
37#include "llvfile.h"
38#include "llviewerstats.h"
39
40// Globals
41LLLandmarkList gLandmarkList;
42
43
44////////////////////////////////////////////////////////////////////////////
45// LLLandmarkList
46
47LLLandmarkList::~LLLandmarkList()
48{
49 std::for_each(mList.begin(), mList.end(), DeletePairedPointer());
50}
51
52LLLandmark* LLLandmarkList::getAsset( const LLUUID& asset_uuid )
53{
54 LLLandmark* landmark = get_ptr_in_map(mList, asset_uuid);
55 if(landmark)
56 {
57 return landmark;
58 }
59 else
60 {
61 if ( gLandmarkList.mBadList.find(asset_uuid) == gLandmarkList.mBadList.end() )
62 {
63 gAssetStorage->getAssetData(
64 asset_uuid,
65 LLAssetType::AT_LANDMARK,
66 LLLandmarkList::processGetAssetReply,
67 NULL);
68 }
69 }
70 return NULL;
71}
72
73// static
74void LLLandmarkList::processGetAssetReply(
75 LLVFS *vfs,
76 const LLUUID& uuid,
77 LLAssetType::EType type,
78 void* user_data,
79 S32 status)
80{
81 if( status == 0 )
82 {
83 LLVFile file(vfs, uuid, type);
84 S32 file_length = file.getSize();
85
86 char* buffer = new char[ file_length + 1 ];
87 file.read( (U8*)buffer, file_length);
88 buffer[ file_length ] = 0;
89
90 LLLandmark* landmark = LLLandmark::constructFromString(buffer);
91 if (landmark)
92 {
93 LLVector3d pos;
94 if(!landmark->getGlobalPos(pos))
95 {
96 LLUUID region_id;
97 if(landmark->getRegionID(region_id))
98 {
99 LLLandmark::requestRegionHandle(
100 gMessageSystem,
101 gAgent.getRegionHost(),
102 region_id,
103 NULL);
104 }
105 }
106 gLandmarkList.mList[ uuid ] = landmark;
107 }
108
109 delete[] buffer;
110 }
111 else
112 {
113 if( gViewerStats )
114 {
115 gViewerStats->incStat( LLViewerStats::ST_DOWNLOAD_FAILED );
116 }
117
118 if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status )
119 {
120 LLNotifyBox::showXml("LandmarkMissing");
121 }
122 else
123 {
124 LLNotifyBox::showXml("UnableToLoadLandmark");
125 }
126
127 gLandmarkList.mBadList.insert(uuid);
128 }
129
130}
131
132BOOL LLLandmarkList::assetExists(const LLUUID& asset_uuid)
133{
134 return mList.count(asset_uuid) != 0 || mBadList.count(asset_uuid) != 0;
135}