diff options
author | Jacek Antonelli | 2008-08-15 23:45:11 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:11 -0500 |
commit | 215f423cbe18fe9ca14a26caef918d303bad28ff (patch) | |
tree | 0743442b286216cc8e19aa487c26f4e9345ffd64 /linden/indra/newview/llinventorymodel.cpp | |
parent | Second Life viewer sources 1.18.3.5-RC (diff) | |
download | meta-impy-215f423cbe18fe9ca14a26caef918d303bad28ff.zip meta-impy-215f423cbe18fe9ca14a26caef918d303bad28ff.tar.gz meta-impy-215f423cbe18fe9ca14a26caef918d303bad28ff.tar.bz2 meta-impy-215f423cbe18fe9ca14a26caef918d303bad28ff.tar.xz |
Second Life viewer sources 1.18.4.0-RC
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llinventorymodel.cpp | 68 |
1 files changed, 58 insertions, 10 deletions
diff --git a/linden/indra/newview/llinventorymodel.cpp b/linden/indra/newview/llinventorymodel.cpp index 9df8fa4..aa90538 100644 --- a/linden/indra/newview/llinventorymodel.cpp +++ b/linden/indra/newview/llinventorymodel.cpp | |||
@@ -2,6 +2,8 @@ | |||
2 | * @file llinventorymodel.cpp | 2 | * @file llinventorymodel.cpp |
3 | * @brief Implementation of the inventory model used to track agent inventory. | 3 | * @brief Implementation of the inventory model used to track agent inventory. |
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ | ||
6 | * | ||
5 | * Copyright (c) 2002-2007, Linden Research, Inc. | 7 | * Copyright (c) 2002-2007, Linden Research, Inc. |
6 | * | 8 | * |
7 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
@@ -24,6 +26,7 @@ | |||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | 26 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO |
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 27 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
26 | * COMPLETENESS OR PERFORMANCE. | 28 | * COMPLETENESS OR PERFORMANCE. |
29 | * $/LicenseInfo$ | ||
27 | */ | 30 | */ |
28 | 31 | ||
29 | #include "llviewerprecompiledheaders.h" | 32 | #include "llviewerprecompiledheaders.h" |
@@ -172,7 +175,8 @@ LLInventoryModel gInventory; | |||
172 | // Default constructor | 175 | // Default constructor |
173 | LLInventoryModel::LLInventoryModel() : | 176 | LLInventoryModel::LLInventoryModel() : |
174 | mModifyMask(LLInventoryObserver::ALL), | 177 | mModifyMask(LLInventoryObserver::ALL), |
175 | mLastItem(NULL) | 178 | mLastItem(NULL), |
179 | mIsAgentInvUsable(false) | ||
176 | { | 180 | { |
177 | } | 181 | } |
178 | 182 | ||
@@ -289,13 +293,9 @@ void LLInventoryModel::getDirectDescendentsOf(const LLUUID& cat_id, | |||
289 | LLUUID LLInventoryModel::findCategoryUUIDForType(LLAssetType::EType t) | 293 | LLUUID LLInventoryModel::findCategoryUUIDForType(LLAssetType::EType t) |
290 | { | 294 | { |
291 | LLUUID rv = findCatUUID(t); | 295 | LLUUID rv = findCatUUID(t); |
292 | if(rv.isNull()) | 296 | if(rv.isNull() && isInventoryUsable()) |
293 | { | 297 | { |
294 | rv = gAgent.getInventoryRootID(); | 298 | rv = createNewCategory(rv, t, NULL); |
295 | if(rv.notNull()) | ||
296 | { | ||
297 | rv = createNewCategory(rv, t, NULL); | ||
298 | } | ||
299 | } | 299 | } |
300 | return rv; | 300 | return rv; |
301 | } | 301 | } |
@@ -329,7 +329,7 @@ LLUUID LLInventoryModel::findCatUUID(LLAssetType::EType preferred_type) | |||
329 | } | 329 | } |
330 | 330 | ||
331 | // Convenience function to create a new category. You could call | 331 | // Convenience function to create a new category. You could call |
332 | // updateCatgory() with a newly generated UUID category, but this | 332 | // updateCategory() with a newly generated UUID category, but this |
333 | // version will take care of details like what the name should be | 333 | // version will take care of details like what the name should be |
334 | // based on preferred type. Returns the UUID of the new category. | 334 | // based on preferred type. Returns the UUID of the new category. |
335 | LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, | 335 | LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, |
@@ -337,6 +337,12 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, | |||
337 | const LLString& pname) | 337 | const LLString& pname) |
338 | { | 338 | { |
339 | LLUUID id; | 339 | LLUUID id; |
340 | if(!isInventoryUsable()) | ||
341 | { | ||
342 | llwarns << "Inventory is broken." << llendl; | ||
343 | return id; | ||
344 | } | ||
345 | |||
340 | id.generate(); | 346 | id.generate(); |
341 | LLString name = pname; | 347 | LLString name = pname; |
342 | if(!pname.empty()) | 348 | if(!pname.empty()) |
@@ -470,6 +476,16 @@ void LLInventoryModel::appendPath(const LLUUID& id, LLString& path) | |||
470 | path.append(temp); | 476 | path.append(temp); |
471 | } | 477 | } |
472 | 478 | ||
479 | bool LLInventoryModel::isInventoryUsable() | ||
480 | { | ||
481 | bool result = false; | ||
482 | if(gAgent.getInventoryRootID().notNull() && mIsAgentInvUsable) | ||
483 | { | ||
484 | result = true; | ||
485 | } | ||
486 | return result; | ||
487 | } | ||
488 | |||
473 | // Calling this method with an inventory item will either change an | 489 | // Calling this method with an inventory item will either change an |
474 | // existing item with a matching item_id, or will add the item to the | 490 | // existing item with a matching item_id, or will add the item to the |
475 | // current inventory. | 491 | // current inventory. |
@@ -480,6 +496,13 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item) | |||
480 | { | 496 | { |
481 | return mask; | 497 | return mask; |
482 | } | 498 | } |
499 | |||
500 | if(!isInventoryUsable()) | ||
501 | { | ||
502 | llwarns << "Inventory is broken." << llendl; | ||
503 | return mask; | ||
504 | } | ||
505 | |||
483 | LLViewerInventoryItem* old_item = getItem(item->getUUID()); | 506 | LLViewerInventoryItem* old_item = getItem(item->getUUID()); |
484 | if(old_item) | 507 | if(old_item) |
485 | { | 508 | { |
@@ -588,6 +611,13 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) | |||
588 | { | 611 | { |
589 | return; | 612 | return; |
590 | } | 613 | } |
614 | |||
615 | if(!isInventoryUsable()) | ||
616 | { | ||
617 | llwarns << "Inventory is broken." << llendl; | ||
618 | return; | ||
619 | } | ||
620 | |||
591 | LLViewerInventoryCategory* old_cat = getCategory(cat->getUUID()); | 621 | LLViewerInventoryCategory* old_cat = getCategory(cat->getUUID()); |
592 | if(old_cat) | 622 | if(old_cat) |
593 | { | 623 | { |
@@ -645,6 +675,12 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) | |||
645 | void LLInventoryModel::moveObject(const LLUUID& object_id, const LLUUID& cat_id) | 675 | void LLInventoryModel::moveObject(const LLUUID& object_id, const LLUUID& cat_id) |
646 | { | 676 | { |
647 | lldebugs << "LLInventoryModel::moveObject()" << llendl; | 677 | lldebugs << "LLInventoryModel::moveObject()" << llendl; |
678 | if(!isInventoryUsable()) | ||
679 | { | ||
680 | llwarns << "Inventory is broken." << llendl; | ||
681 | return; | ||
682 | } | ||
683 | |||
648 | if((object_id == cat_id) || !is_in_map(mCategoryMap, cat_id)) | 684 | if((object_id == cat_id) || !is_in_map(mCategoryMap, cat_id)) |
649 | { | 685 | { |
650 | llwarns << "Could not move inventory object " << object_id << " to " | 686 | llwarns << "Could not move inventory object " << object_id << " to " |
@@ -1086,7 +1122,7 @@ void LLInventoryModel::backgroundFetch(void*) | |||
1086 | { | 1122 | { |
1087 | // finished with this category, remove from queue | 1123 | // finished with this category, remove from queue |
1088 | sFetchQueue.pop_front(); | 1124 | sFetchQueue.pop_front(); |
1089 | 1125 | ||
1090 | // add all children to queue | 1126 | // add all children to queue |
1091 | parent_cat_map_t::iterator cat_it = gInventory.mParentChildCategoryTree.find(cat->getUUID()); | 1127 | parent_cat_map_t::iterator cat_it = gInventory.mParentChildCategoryTree.find(cat->getUUID()); |
1092 | if (cat_it != gInventory.mParentChildCategoryTree.end()) | 1128 | if (cat_it != gInventory.mParentChildCategoryTree.end()) |
@@ -1863,6 +1899,19 @@ void LLInventoryModel::buildParentChildMap() | |||
1863 | gAgent.sendReliableMessage(); | 1899 | gAgent.sendReliableMessage(); |
1864 | } | 1900 | } |
1865 | } | 1901 | } |
1902 | |||
1903 | const LLUUID& agent_inv_root_id = gAgent.getInventoryRootID(); | ||
1904 | if (agent_inv_root_id.notNull()) | ||
1905 | { | ||
1906 | cat_array_t* catsp = get_ptr_in_map(mParentChildCategoryTree, agent_inv_root_id); | ||
1907 | if(catsp) | ||
1908 | { | ||
1909 | // 'My Inventory', | ||
1910 | // root of the agent's inv found. | ||
1911 | // The inv tree is built. | ||
1912 | mIsAgentInvUsable = true; | ||
1913 | } | ||
1914 | } | ||
1866 | } | 1915 | } |
1867 | 1916 | ||
1868 | struct LLUUIDAndName | 1917 | struct LLUUIDAndName |
@@ -2695,7 +2744,6 @@ void LLInventoryModel::dumpInventory() | |||
2695 | llinfos << "\n**********************\nEnd Inventory Dump" << llendl; | 2744 | llinfos << "\n**********************\nEnd Inventory Dump" << llendl; |
2696 | } | 2745 | } |
2697 | 2746 | ||
2698 | |||
2699 | ///---------------------------------------------------------------------------- | 2747 | ///---------------------------------------------------------------------------- |
2700 | /// LLInventoryCollectFunctor implementations | 2748 | /// LLInventoryCollectFunctor implementations |
2701 | ///---------------------------------------------------------------------------- | 2749 | ///---------------------------------------------------------------------------- |