1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-18 19:29:09 +00:00

Merge pull request #371 from Hoikas/keycol-set

Fix plKeyCollector key trashing...
This commit is contained in:
Branan Purvine-Riley
2013-12-21 16:57:10 -08:00
6 changed files with 19 additions and 28 deletions

View File

@ -162,7 +162,7 @@ public:
if (pageNode->GetPageInfo().GetAge().CompareI(fAgeName) == 0)
{
// Try loading and searching thru this page
hsTArray<plKey> keyRefs;
std::set<plKey> keyRefs;
IGetResMgr()->LoadPageKeys( pageNode );
plKeyCollector coll( keyRefs );

View File

@ -42,16 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plRegistryHelpers.h"
#include "plRegistryNode.h"
plKeyCollector::plKeyCollector( hsTArray<plKey> &keys ) : fKeys( keys )
{
}
bool plKeyCollector::EatKey(const plKey& key)
{
fKeys.Append(key);
return true;
}
bool plIndirectUnloadIterator::EatPage(plRegistryPageNode* page)
{
page->IterateKeys(this);

View File

@ -53,8 +53,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define _plRegistryHelpers_h
#include "HeadSpin.h"
#include "hsTemplates.h"
#include "pnKeyedObject/plKey.h"
#include <set>
class plKey;
class plRegistryPageNode;
@ -76,16 +76,19 @@ public:
};
//// plKeyCollector //////////////////////////////////////////////////////////
// Helper key iterator that collects the given keys into the given hsTArray
/** Helper key iterator that collects keys into an std::set. */
class plKeyCollector : public plRegistryKeyIterator
{
protected:
hsTArray<plKey> &fKeys;
std::set<plKey>& fKeys;
public:
plKeyCollector(hsTArray<plKey>& keys);
virtual bool EatKey(const plKey& key);
plKeyCollector(std::set<plKey>& keys) : fKeys(keys) { }
virtual bool EatKey(const plKey& key)
{
fKeys.insert(key);
return true;
}
};
// If you loaded keys with another iterator, this will ensure that they're unloaded

View File

@ -990,12 +990,11 @@ void plResManager::SetProgressBarProc(plProgressProc proc)
class plResAgeHolder : public hsRefCnt
{
public:
hsTArray<plKey> fKeys;
std::set<plKey> fKeys;
plString fAge;
plResAgeHolder() {}
plResAgeHolder( const plString& age ) : fAge( age ) {}
~plResAgeHolder() { fKeys.Reset(); }
};
//// plResHolderIterator /////////////////////////////////////////////////////
@ -1003,12 +1002,12 @@ class plResAgeHolder : public hsRefCnt
class plResHolderIterator : public plRegistryPageIterator
{
protected:
hsTArray<plKey>& fKeys;
std::set<plKey>& fKeys;
plString fAgeName;
plResManager* fResMgr;
public:
plResHolderIterator(const plString& age, hsTArray<plKey>& keys, plResManager* resMgr)
plResHolderIterator(const plString& age, std::set<plKey>& keys, plResManager* resMgr)
: fAgeName(age), fKeys(keys), fResMgr(resMgr) {}
virtual bool EatPage(plRegistryPageNode* page)

View File

@ -135,12 +135,11 @@ class plResPageKeyRefList : public plKeyCollector
{
protected:
hsTArray<plKey> fKeyList;
std::set<plKey> fKeyList;
public:
plResPageKeyRefList() : plKeyCollector( fKeyList ) {}
virtual ~plResPageKeyRefList() { fKeyList.Reset(); }
};
#endif // _plResManagerHelper_h