1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +00:00

Merge pull request #251 from dpogue/plresmgr-strings

Convert plRegistryNode stuff to plString.
This commit is contained in:
2013-01-07 21:59:09 -08:00
22 changed files with 116 additions and 125 deletions

View File

@ -58,7 +58,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pnKeyedObject/plKeyImp.h"
#include "plAgeDescription/plAgeDescription.h"
plKey plPluginResManager::NameToLoc(const char* age, const char* page, int32_t sequenceNumber, bool itinerant)
plKey plPluginResManager::NameToLoc(const plString& age, const plString& page, int32_t sequenceNumber, bool itinerant)
{
// Hack for now--always prefer paging out sceneNodes first
fPageOutHint = plSceneNode::Index();
@ -68,7 +68,7 @@ plKey plPluginResManager::NameToLoc(const char* age, const char* page, int32_t s
hsAssert(pageNode != nil, "No page returned from INameToPage(), shouldn't be possible");
// Go find the sceneNode now, since we know the page exists (go through our normal channels, though)
plString keyName = plString::Format("%s_%s", age, page);
plString keyName = plString::Format("%s_%s", age.c_str(), page.c_str());
plUoid nodeUoid(pageNode->GetPageInfo().GetLocation(), plSceneNode::Index(), keyName);
@ -110,7 +110,7 @@ plKey plPluginResManager::NameToLoc(const char* age, const char* page, int32_t s
// seqNumber, returns the page for that combo (either by preloading it or
// by creating it).
plRegistryPageNode* plPluginResManager::INameToPage(const char* age, const char* page, int32_t sequenceNumber, bool itinerant)
plRegistryPageNode* plPluginResManager::INameToPage(const plString& age, const plString& page, int32_t sequenceNumber, bool itinerant)
{
// Find the location first, to see if it already exists
plRegistryPageNode* pageNode = FindPage(age, page);
@ -120,12 +120,12 @@ plRegistryPageNode* plPluginResManager::INameToPage(const char* age, const char*
if (sequenceNumber != uint32_t(-1))
{
const plLocation& newLoc = ICreateLocation(age, page, sequenceNumber, itinerant);
pageNode = CreatePage(newLoc, age, page);
pageNode = CreatePage(newLoc, age.c_str(), page.c_str());
}
else
{
const plLocation& newLoc = ICreateLocation(age, page, itinerant);
pageNode = CreatePage(newLoc, age, page);
pageNode = CreatePage(newLoc, age.c_str(), page.c_str());
}
// Still preload textures on this guy. This should be a no-op for this page since it's new, but won't be
// for the shared textures page
@ -196,7 +196,7 @@ void plPluginResManager::IPreLoadTextures(plRegistryPageNode* pageNode, int32_t
bool common = false;
for (int i = 0; i < plAgeDescription::kNumCommonPages; i++)
{
if (strcmpi(plAgeDescription::GetCommonPage(i), pageNode->GetPageInfo().GetPage()) == 0)
if (pageNode->GetPageInfo().GetPage().CompareI(plAgeDescription::GetCommonPage(i)) == 0)
{
common = true;
break;
@ -320,15 +320,15 @@ public:
};
plLocation plPluginResManager::ICreateLocation(const char* age, const char* page, bool itinerant)
plLocation plPluginResManager::ICreateLocation(const plString& age, const plString& page, bool itinerant)
{
int32_t seqNum = VerifySeqNumber(0, age, page);
return ICreateLocation(age, page, seqNum, itinerant);
}
plLocation plPluginResManager::ICreateLocation(const char* age, const char* page, int32_t seqNum, bool itinerant)
plLocation plPluginResManager::ICreateLocation(const plString& age, const plString& page, int32_t seqNum, bool itinerant)
{
bool willBeReserved = strcmpi(age, "global") == 0;
bool willBeReserved = age.CompareI("global") == 0;
int32_t oldNum = seqNum;
seqNum = VerifySeqNumber(seqNum, age, page);
@ -352,7 +352,7 @@ plLocation plPluginResManager::ICreateLocation(const char* age, const char* page
// Flag common pages
for (int i = 0; i < plAgeDescription::kNumCommonPages; i++)
{
if (strcmp(plAgeDescription::GetCommonPage(i), page) == 0)
if (page.Compare(plAgeDescription::GetCommonPage(i)) == 0)
{
newLoc.SetFlags(plLocation::kBuiltIn);
break;
@ -361,8 +361,8 @@ plLocation plPluginResManager::ICreateLocation(const char* age, const char* page
// If we have an age description file for the age we're creating a location
// for, grab some extra flags from it
plAgeDescription* ageDesc = plPageInfoUtils::GetAgeDesc(age);
plAgePage* agePage = ageDesc ? ageDesc->FindPage(page) : nil;
plAgeDescription* ageDesc = plPageInfoUtils::GetAgeDesc(age.c_str());
plAgePage* agePage = ageDesc ? ageDesc->FindPage(page.c_str()) : nil;
if (agePage)
{
if (agePage->GetFlags() & plAgePage::kIsLocalOnly)
@ -427,9 +427,9 @@ void plPluginResManager::AddLooseEnd(plKey key)
}
}
// Verifies that the given sequence number belongs to the given string combo and ONLY that combo. Returns a new, unique sequenceNumber if not
int32_t plPluginResManager::VerifySeqNumber(int32_t sequenceNumber, const char* age, const char* page)
int32_t plPluginResManager::VerifySeqNumber(int32_t sequenceNumber, const plString& age, const plString& page)
{
bool negated = false, willBeReserved = strcmpi(age, "global") == 0;
bool negated = false, willBeReserved = age.CompareI("global") == 0;
if (sequenceNumber < 0)
{
sequenceNumber = -sequenceNumber;

View File

@ -50,6 +50,7 @@ class plLocation;
class plPageInfo;
class plRegistryPageNode;
class plSceneNode;
class plString;
class plPluginResManager : public plResManager
{
@ -61,10 +62,10 @@ public:
//------------------------
// Given a page string combo, returns the key of the sceneNode for that page. If the page does not exist, it creates one.
plKey NameToLoc(const char* age, const char* page, int32_t sequenceNumber, bool itinerant = false);
plKey NameToLoc(const plString& age, const plString& page, int32_t sequenceNumber, bool itinerant = false);
// Verifies that the given sequence number belongs to the given string combo and ONLY that combo. Returns a new, unique sequenceNumber if not
int32_t VerifySeqNumber(int32_t sequenceNumber, const char* age, const char* page);
int32_t VerifySeqNumber(int32_t sequenceNumber, const plString& age, const plString& page);
enum VerifyErrors
{
@ -97,10 +98,10 @@ public:
void EndExport();
protected:
plLocation ICreateLocation(const char* age, const char* page, bool itinerant);
plLocation ICreateLocation(const char* age, const char* page, int32_t seqNum, bool itinerant);
plLocation ICreateLocation(const plString& age, const plString& page, bool itinerant);
plLocation ICreateLocation(const plString& age, const plString& page, int32_t seqNum, bool itinerant);
plRegistryPageNode* INameToPage(const char* age, const char* page, int32_t sequenceNumber, bool itinerant = false);
plRegistryPageNode* INameToPage(const plString& age, const plString& page, int32_t sequenceNumber, bool itinerant = false);
void IPreLoadTextures(plRegistryPageNode* pageNode, int32_t origSeqNumber);