From 73aa47f391341e6d6ef5136ef73302be689d3e9d Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 23 Feb 2012 16:51:06 -0800 Subject: PATH-292: Reworking how and where linksets are requested and managed. --- indra/newview/llpathfindinglinksetlist.cpp | 103 +++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 indra/newview/llpathfindinglinksetlist.cpp (limited to 'indra/newview/llpathfindinglinksetlist.cpp') diff --git a/indra/newview/llpathfindinglinksetlist.cpp b/indra/newview/llpathfindinglinksetlist.cpp new file mode 100644 index 0000000000..e67b7b800c --- /dev/null +++ b/indra/newview/llpathfindinglinksetlist.cpp @@ -0,0 +1,103 @@ +/** + * @file llpathfindinglinksetlist.cpp + * @author William Todd Stinson + * @brief Class to implement the list of a set of pathfinding linksets + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include +#include + +#include "llsd.h" +#include "lluuid.h" +#include "llpathfindinglinkset.h" +#include "llpathfindinglinksetlist.h" + +//--------------------------------------------------------------------------- +// LLPathfindingLinksetList +//--------------------------------------------------------------------------- + +LLPathfindingLinksetList::LLPathfindingLinksetList() + : LLPathfindingLinksetMap() +{ +} + +LLPathfindingLinksetList::LLPathfindingLinksetList(const LLSD& pLinksetItems) + : LLPathfindingLinksetMap() +{ + for (LLSD::map_const_iterator linksetItemIter = pLinksetItems.beginMap(); + linksetItemIter != pLinksetItems.endMap(); ++linksetItemIter) + { + const std::string& uuid(linksetItemIter->first); + const LLSD& linksetData = linksetItemIter->second; + LLPathfindingLinksetPtr linkset(new LLPathfindingLinkset(uuid, linksetData)); + insert(std::pair(uuid, linkset)); + } +} + +LLPathfindingLinksetList::~LLPathfindingLinksetList() +{ + clear(); +} + +void LLPathfindingLinksetList::update(const LLSD& pLinksetItems) +{ + for (LLSD::map_const_iterator linksetItemIter = pLinksetItems.beginMap(); + linksetItemIter != pLinksetItems.endMap(); ++linksetItemIter) + { + const std::string& uuid(linksetItemIter->first); + const LLSD& linksetData = linksetItemIter->second; + LLPathfindingLinksetMap::iterator linksetIter = this->find(uuid); + if (linksetIter == end()) + { + LLPathfindingLinksetPtr linkset(new LLPathfindingLinkset(uuid, linksetData)); + insert(std::pair(uuid, linkset)); + } + else + { + LLPathfindingLinksetPtr linksetPtr = linksetIter->second; + const LLPathfindingLinkset newLinkset(uuid, linksetData); + *linksetPtr = newLinkset; + } + } +} + +LLSD LLPathfindingLinksetList::encodeAlteredFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const +{ + LLSD listData; + + for (LLPathfindingLinksetMap::const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter) + { + const LLPathfindingLinksetPtr linksetPtr = linksetIter->second; + LLSD linksetData = linksetPtr->encodeAlteredFields(pLinksetUse, pA, pB, pC, pD); + if (!linksetData.isUndefined()) + { + const std::string& uuid(linksetIter->first); + listData[uuid] = linksetData; + } + } + + return listData; +} -- cgit v1.2.3 From 05a49dd4252930fbfbb61a7e88ef5ef253cceca6 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 23 Feb 2012 17:12:44 -0800 Subject: PATH-292: Fixing the post-modify update handler to update the linkset list rather than overwrite it. --- indra/newview/llpathfindinglinksetlist.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'indra/newview/llpathfindinglinksetlist.cpp') diff --git a/indra/newview/llpathfindinglinksetlist.cpp b/indra/newview/llpathfindinglinksetlist.cpp index e67b7b800c..7facf88c40 100644 --- a/indra/newview/llpathfindinglinksetlist.cpp +++ b/indra/newview/llpathfindinglinksetlist.cpp @@ -62,24 +62,23 @@ LLPathfindingLinksetList::~LLPathfindingLinksetList() clear(); } -void LLPathfindingLinksetList::update(const LLSD& pLinksetItems) +void LLPathfindingLinksetList::update(const LLPathfindingLinksetList &pUpdateLinksetList) { - for (LLSD::map_const_iterator linksetItemIter = pLinksetItems.beginMap(); - linksetItemIter != pLinksetItems.endMap(); ++linksetItemIter) + for (LLPathfindingLinksetList::const_iterator updateLinksetIter = pUpdateLinksetList.begin(); + updateLinksetIter != pUpdateLinksetList.end(); ++updateLinksetIter) { - const std::string& uuid(linksetItemIter->first); - const LLSD& linksetData = linksetItemIter->second; - LLPathfindingLinksetMap::iterator linksetIter = this->find(uuid); + const std::string &uuid = updateLinksetIter->first; + const LLPathfindingLinksetPtr updateLinksetPtr = updateLinksetIter->second; + + LLPathfindingLinksetList::iterator linksetIter = find(uuid); if (linksetIter == end()) { - LLPathfindingLinksetPtr linkset(new LLPathfindingLinkset(uuid, linksetData)); - insert(std::pair(uuid, linkset)); + insert(std::pair(uuid, updateLinksetPtr)); } else { LLPathfindingLinksetPtr linksetPtr = linksetIter->second; - const LLPathfindingLinkset newLinkset(uuid, linksetData); - *linksetPtr = newLinkset; + *linksetPtr = *updateLinksetPtr; } } } -- cgit v1.2.3 From 9b06300e2c94eae83a29637073f65d4ffc73bf6d Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Sat, 25 Feb 2012 22:27:06 -0800 Subject: PATH-292: Adding the ability to view and edit pathfinding attributes of the terrain. --- indra/newview/llpathfindinglinksetlist.cpp | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'indra/newview/llpathfindinglinksetlist.cpp') diff --git a/indra/newview/llpathfindinglinksetlist.cpp b/indra/newview/llpathfindinglinksetlist.cpp index 7facf88c40..57febbf0f2 100644 --- a/indra/newview/llpathfindinglinksetlist.cpp +++ b/indra/newview/llpathfindinglinksetlist.cpp @@ -83,20 +83,40 @@ void LLPathfindingLinksetList::update(const LLPathfindingLinksetList &pUpdateLin } } -LLSD LLPathfindingLinksetList::encodeAlteredFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const +LLSD LLPathfindingLinksetList::encodeObjectFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const { LLSD listData; for (LLPathfindingLinksetMap::const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter) { const LLPathfindingLinksetPtr linksetPtr = linksetIter->second; - LLSD linksetData = linksetPtr->encodeAlteredFields(pLinksetUse, pA, pB, pC, pD); - if (!linksetData.isUndefined()) + if (!linksetPtr->isTerrain()) { - const std::string& uuid(linksetIter->first); - listData[uuid] = linksetData; + LLSD linksetData = linksetPtr->encodeAlteredFields(pLinksetUse, pA, pB, pC, pD); + if (!linksetData.isUndefined()) + { + const std::string& uuid(linksetIter->first); + listData[uuid] = linksetData; + } } } return listData; } + +LLSD LLPathfindingLinksetList::encodeTerrainFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const +{ + LLSD terrainData; + + for (LLPathfindingLinksetMap::const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter) + { + const LLPathfindingLinksetPtr linksetPtr = linksetIter->second; + if (linksetPtr->isTerrain()) + { + terrainData = linksetPtr->encodeAlteredFields(pLinksetUse, pA, pB, pC, pD); + break; + } + } + + return terrainData; +} -- cgit v1.2.3 From cbebd682f7b9b0cff120bc36d9db9bb170dc1b2a Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 25 Apr 2012 13:04:13 -0700 Subject: Removing windows line endings from .h and .cpp files. --- indra/newview/llpathfindinglinksetlist.cpp | 244 ++++++++++++++--------------- 1 file changed, 122 insertions(+), 122 deletions(-) (limited to 'indra/newview/llpathfindinglinksetlist.cpp') diff --git a/indra/newview/llpathfindinglinksetlist.cpp b/indra/newview/llpathfindinglinksetlist.cpp index 57febbf0f2..19a99ef444 100644 --- a/indra/newview/llpathfindinglinksetlist.cpp +++ b/indra/newview/llpathfindinglinksetlist.cpp @@ -1,122 +1,122 @@ -/** - * @file llpathfindinglinksetlist.cpp - * @author William Todd Stinson - * @brief Class to implement the list of a set of pathfinding linksets - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include -#include - -#include "llsd.h" -#include "lluuid.h" -#include "llpathfindinglinkset.h" -#include "llpathfindinglinksetlist.h" - -//--------------------------------------------------------------------------- -// LLPathfindingLinksetList -//--------------------------------------------------------------------------- - -LLPathfindingLinksetList::LLPathfindingLinksetList() - : LLPathfindingLinksetMap() -{ -} - -LLPathfindingLinksetList::LLPathfindingLinksetList(const LLSD& pLinksetItems) - : LLPathfindingLinksetMap() -{ - for (LLSD::map_const_iterator linksetItemIter = pLinksetItems.beginMap(); - linksetItemIter != pLinksetItems.endMap(); ++linksetItemIter) - { - const std::string& uuid(linksetItemIter->first); - const LLSD& linksetData = linksetItemIter->second; - LLPathfindingLinksetPtr linkset(new LLPathfindingLinkset(uuid, linksetData)); - insert(std::pair(uuid, linkset)); - } -} - -LLPathfindingLinksetList::~LLPathfindingLinksetList() -{ - clear(); -} - -void LLPathfindingLinksetList::update(const LLPathfindingLinksetList &pUpdateLinksetList) -{ - for (LLPathfindingLinksetList::const_iterator updateLinksetIter = pUpdateLinksetList.begin(); - updateLinksetIter != pUpdateLinksetList.end(); ++updateLinksetIter) - { - const std::string &uuid = updateLinksetIter->first; - const LLPathfindingLinksetPtr updateLinksetPtr = updateLinksetIter->second; - - LLPathfindingLinksetList::iterator linksetIter = find(uuid); - if (linksetIter == end()) - { - insert(std::pair(uuid, updateLinksetPtr)); - } - else - { - LLPathfindingLinksetPtr linksetPtr = linksetIter->second; - *linksetPtr = *updateLinksetPtr; - } - } -} - -LLSD LLPathfindingLinksetList::encodeObjectFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const -{ - LLSD listData; - - for (LLPathfindingLinksetMap::const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter) - { - const LLPathfindingLinksetPtr linksetPtr = linksetIter->second; - if (!linksetPtr->isTerrain()) - { - LLSD linksetData = linksetPtr->encodeAlteredFields(pLinksetUse, pA, pB, pC, pD); - if (!linksetData.isUndefined()) - { - const std::string& uuid(linksetIter->first); - listData[uuid] = linksetData; - } - } - } - - return listData; -} - -LLSD LLPathfindingLinksetList::encodeTerrainFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const -{ - LLSD terrainData; - - for (LLPathfindingLinksetMap::const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter) - { - const LLPathfindingLinksetPtr linksetPtr = linksetIter->second; - if (linksetPtr->isTerrain()) - { - terrainData = linksetPtr->encodeAlteredFields(pLinksetUse, pA, pB, pC, pD); - break; - } - } - - return terrainData; -} +/** + * @file llpathfindinglinksetlist.cpp + * @author William Todd Stinson + * @brief Class to implement the list of a set of pathfinding linksets + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include +#include + +#include "llsd.h" +#include "lluuid.h" +#include "llpathfindinglinkset.h" +#include "llpathfindinglinksetlist.h" + +//--------------------------------------------------------------------------- +// LLPathfindingLinksetList +//--------------------------------------------------------------------------- + +LLPathfindingLinksetList::LLPathfindingLinksetList() + : LLPathfindingLinksetMap() +{ +} + +LLPathfindingLinksetList::LLPathfindingLinksetList(const LLSD& pLinksetItems) + : LLPathfindingLinksetMap() +{ + for (LLSD::map_const_iterator linksetItemIter = pLinksetItems.beginMap(); + linksetItemIter != pLinksetItems.endMap(); ++linksetItemIter) + { + const std::string& uuid(linksetItemIter->first); + const LLSD& linksetData = linksetItemIter->second; + LLPathfindingLinksetPtr linkset(new LLPathfindingLinkset(uuid, linksetData)); + insert(std::pair(uuid, linkset)); + } +} + +LLPathfindingLinksetList::~LLPathfindingLinksetList() +{ + clear(); +} + +void LLPathfindingLinksetList::update(const LLPathfindingLinksetList &pUpdateLinksetList) +{ + for (LLPathfindingLinksetList::const_iterator updateLinksetIter = pUpdateLinksetList.begin(); + updateLinksetIter != pUpdateLinksetList.end(); ++updateLinksetIter) + { + const std::string &uuid = updateLinksetIter->first; + const LLPathfindingLinksetPtr updateLinksetPtr = updateLinksetIter->second; + + LLPathfindingLinksetList::iterator linksetIter = find(uuid); + if (linksetIter == end()) + { + insert(std::pair(uuid, updateLinksetPtr)); + } + else + { + LLPathfindingLinksetPtr linksetPtr = linksetIter->second; + *linksetPtr = *updateLinksetPtr; + } + } +} + +LLSD LLPathfindingLinksetList::encodeObjectFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const +{ + LLSD listData; + + for (LLPathfindingLinksetMap::const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter) + { + const LLPathfindingLinksetPtr linksetPtr = linksetIter->second; + if (!linksetPtr->isTerrain()) + { + LLSD linksetData = linksetPtr->encodeAlteredFields(pLinksetUse, pA, pB, pC, pD); + if (!linksetData.isUndefined()) + { + const std::string& uuid(linksetIter->first); + listData[uuid] = linksetData; + } + } + } + + return listData; +} + +LLSD LLPathfindingLinksetList::encodeTerrainFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const +{ + LLSD terrainData; + + for (LLPathfindingLinksetMap::const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter) + { + const LLPathfindingLinksetPtr linksetPtr = linksetIter->second; + if (linksetPtr->isTerrain()) + { + terrainData = linksetPtr->encodeAlteredFields(pLinksetUse, pA, pB, pC, pD); + break; + } + } + + return terrainData; +} -- cgit v1.2.3 From 3c2be426e5e905076d00b9492c0e66c8b31caf19 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 30 May 2012 18:47:12 -0700 Subject: First pass at refactoring the pathfinding linksets and pathfinding characters classes to reduce code duplication, as both functionalities were heavily duplicated. --- indra/newview/llpathfindinglinksetlist.cpp | 162 +++++++++++++++++++++-------- 1 file changed, 116 insertions(+), 46 deletions(-) (limited to 'indra/newview/llpathfindinglinksetlist.cpp') diff --git a/indra/newview/llpathfindinglinksetlist.cpp b/indra/newview/llpathfindinglinksetlist.cpp index 19a99ef444..0ba6ef07f3 100644 --- a/indra/newview/llpathfindinglinksetlist.cpp +++ b/indra/newview/llpathfindinglinksetlist.cpp @@ -27,72 +27,44 @@ #include "llviewerprecompiledheaders.h" -#include -#include +#include "llpathfindinglinksetlist.h" #include "llsd.h" -#include "lluuid.h" #include "llpathfindinglinkset.h" -#include "llpathfindinglinksetlist.h" +#include "llpathfindingobject.h" +#include "llpathfindingobjectlist.h" //--------------------------------------------------------------------------- // LLPathfindingLinksetList //--------------------------------------------------------------------------- LLPathfindingLinksetList::LLPathfindingLinksetList() - : LLPathfindingLinksetMap() + : LLPathfindingObjectList() { } -LLPathfindingLinksetList::LLPathfindingLinksetList(const LLSD& pLinksetItems) - : LLPathfindingLinksetMap() +LLPathfindingLinksetList::LLPathfindingLinksetList(const LLSD& pLinksetListData) + : LLPathfindingObjectList() { - for (LLSD::map_const_iterator linksetItemIter = pLinksetItems.beginMap(); - linksetItemIter != pLinksetItems.endMap(); ++linksetItemIter) - { - const std::string& uuid(linksetItemIter->first); - const LLSD& linksetData = linksetItemIter->second; - LLPathfindingLinksetPtr linkset(new LLPathfindingLinkset(uuid, linksetData)); - insert(std::pair(uuid, linkset)); - } + parseLinksetListData(pLinksetListData); } LLPathfindingLinksetList::~LLPathfindingLinksetList() { - clear(); -} - -void LLPathfindingLinksetList::update(const LLPathfindingLinksetList &pUpdateLinksetList) -{ - for (LLPathfindingLinksetList::const_iterator updateLinksetIter = pUpdateLinksetList.begin(); - updateLinksetIter != pUpdateLinksetList.end(); ++updateLinksetIter) - { - const std::string &uuid = updateLinksetIter->first; - const LLPathfindingLinksetPtr updateLinksetPtr = updateLinksetIter->second; - - LLPathfindingLinksetList::iterator linksetIter = find(uuid); - if (linksetIter == end()) - { - insert(std::pair(uuid, updateLinksetPtr)); - } - else - { - LLPathfindingLinksetPtr linksetPtr = linksetIter->second; - *linksetPtr = *updateLinksetPtr; - } - } } LLSD LLPathfindingLinksetList::encodeObjectFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const { LLSD listData; - for (LLPathfindingLinksetMap::const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter) + for (const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter) { - const LLPathfindingLinksetPtr linksetPtr = linksetIter->second; - if (!linksetPtr->isTerrain()) + const LLPathfindingObjectPtr objectPtr = linksetIter->second; + const LLPathfindingLinkset *linkset = dynamic_cast(objectPtr.get()); + + if (!linkset->isTerrain()) { - LLSD linksetData = linksetPtr->encodeAlteredFields(pLinksetUse, pA, pB, pC, pD); + LLSD linksetData = linkset->encodeAlteredFields(pLinksetUse, pA, pB, pC, pD); if (!linksetData.isUndefined()) { const std::string& uuid(linksetIter->first); @@ -107,16 +79,114 @@ LLSD LLPathfindingLinksetList::encodeObjectFields(LLPathfindingLinkset::ELinkset LLSD LLPathfindingLinksetList::encodeTerrainFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const { LLSD terrainData; - - for (LLPathfindingLinksetMap::const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter) + + for (const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter) { - const LLPathfindingLinksetPtr linksetPtr = linksetIter->second; - if (linksetPtr->isTerrain()) + const LLPathfindingObjectPtr objectPtr = linksetIter->second; + const LLPathfindingLinkset *linkset = dynamic_cast(objectPtr.get()); + + if (linkset->isTerrain()) { - terrainData = linksetPtr->encodeAlteredFields(pLinksetUse, pA, pB, pC, pD); + terrainData = linkset->encodeAlteredFields(pLinksetUse, pA, pB, pC, pD); break; } } return terrainData; } + +bool LLPathfindingLinksetList::isShowUnmodifiablePhantomWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const +{ + bool isShowWarning = false; + + for (const_iterator objectIter = begin(); !isShowWarning && (objectIter != end()); ++objectIter) + { + const LLPathfindingObjectPtr objectPtr = objectIter->second; + const LLPathfindingLinkset *linkset = dynamic_cast(objectPtr.get()); + isShowWarning = linkset->isShowUnmodifiablePhantomWarning(pLinksetUse); + } + + return isShowWarning; +} + +bool LLPathfindingLinksetList::isShowCannotBeVolumeWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const +{ + bool isShowWarning = false; + + for (const_iterator objectIter = begin(); !isShowWarning && (objectIter != end()); ++objectIter) + { + const LLPathfindingObjectPtr objectPtr = objectIter->second; + const LLPathfindingLinkset *linkset = dynamic_cast(objectPtr.get()); + isShowWarning = linkset->isShowCannotBeVolumeWarning(pLinksetUse); + } + + return isShowWarning; +} + +void LLPathfindingLinksetList::determinePossibleStates(BOOL &pCanBeWalkable, BOOL &pCanBeStaticObstacle, BOOL &pCanBeDynamicObstacle, + BOOL &pCanBeMaterialVolume, BOOL &pCanBeExclusionVolume, BOOL &pCanBeDynamicPhantom) const +{ + pCanBeWalkable = FALSE; + pCanBeStaticObstacle = FALSE; + pCanBeDynamicObstacle = FALSE; + pCanBeMaterialVolume = FALSE; + pCanBeExclusionVolume = FALSE; + pCanBeDynamicPhantom = FALSE; + + for (const_iterator objectIter = begin(); + !(pCanBeWalkable && pCanBeStaticObstacle && pCanBeDynamicObstacle && pCanBeMaterialVolume && pCanBeExclusionVolume && pCanBeDynamicPhantom) && (objectIter != end()); + ++objectIter) + { + const LLPathfindingObjectPtr objectPtr = objectIter->second; + const LLPathfindingLinkset *linkset = dynamic_cast(objectPtr.get()); + + if (linkset->isTerrain()) + { + pCanBeWalkable = TRUE; + } + else + { + if (linkset->isModifiable()) + { + pCanBeWalkable = TRUE; + pCanBeStaticObstacle = TRUE; + pCanBeDynamicObstacle = TRUE; + pCanBeDynamicPhantom = TRUE; + if (linkset->canBeVolume()) + { + pCanBeMaterialVolume = TRUE; + pCanBeExclusionVolume = TRUE; + } + } + else if (linkset->isPhantom()) + { + pCanBeDynamicPhantom = TRUE; + if (linkset->canBeVolume()) + { + pCanBeMaterialVolume = TRUE; + pCanBeExclusionVolume = TRUE; + } + } + else + { + pCanBeWalkable = TRUE; + pCanBeStaticObstacle = TRUE; + pCanBeDynamicObstacle = TRUE; + } + } + } +} + +void LLPathfindingLinksetList::parseLinksetListData(const LLSD& pLinksetListData) +{ + LLPathfindingObjectMap &objectMap = getObjectMap(); + + for (LLSD::map_const_iterator linksetDataIter = pLinksetListData.beginMap(); + linksetDataIter != pLinksetListData.endMap(); ++linksetDataIter) + { + const std::string& uuid(linksetDataIter->first); + const LLSD& linksetData = linksetDataIter->second; + LLPathfindingObjectPtr linksetPtr(new LLPathfindingLinkset(uuid, linksetData)); + objectMap.insert(std::pair(uuid, linksetPtr)); + } +} -- cgit v1.2.3 From 3352a1eac15f752535b636866eeb966ec3900c62 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 30 May 2012 19:39:08 -0700 Subject: Cleaning up some unreferenced headers and classes definitions from previous refactoring. --- indra/newview/llpathfindinglinksetlist.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpathfindinglinksetlist.cpp') diff --git a/indra/newview/llpathfindinglinksetlist.cpp b/indra/newview/llpathfindinglinksetlist.cpp index 0ba6ef07f3..5323635438 100644 --- a/indra/newview/llpathfindinglinksetlist.cpp +++ b/indra/newview/llpathfindinglinksetlist.cpp @@ -29,10 +29,13 @@ #include "llpathfindinglinksetlist.h" -#include "llsd.h" +#include +#include + #include "llpathfindinglinkset.h" #include "llpathfindingobject.h" #include "llpathfindingobjectlist.h" +#include "llsd.h" //--------------------------------------------------------------------------- // LLPathfindingLinksetList -- cgit v1.2.3 From 78910cf3016fc55eaf8214640b348df0f8bcdeda Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 26 Jun 2012 18:04:19 -0700 Subject: Updating the header licensing comments. --- indra/newview/llpathfindinglinksetlist.cpp | 51 +++++++++++++++--------------- 1 file changed, 26 insertions(+), 25 deletions(-) (limited to 'indra/newview/llpathfindinglinksetlist.cpp') diff --git a/indra/newview/llpathfindinglinksetlist.cpp b/indra/newview/llpathfindinglinksetlist.cpp index 5323635438..746fa342a1 100644 --- a/indra/newview/llpathfindinglinksetlist.cpp +++ b/indra/newview/llpathfindinglinksetlist.cpp @@ -1,29 +1,30 @@ /** - * @file llpathfindinglinksetlist.cpp - * @author William Todd Stinson - * @brief Class to implement the list of a set of pathfinding linksets - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ +* @file llpathfindinglinksetlist.cpp +* @brief Implementation of llpathfindinglinksetlist +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + #include "llviewerprecompiledheaders.h" -- cgit v1.2.3