Browse Source

Merge pull request #251 from dpogue/plresmgr-strings

Convert plRegistryNode stuff to plString.
Michael Hansen 12 years ago
parent
commit
2eb3648144
  1. 8
      Sources/Plasma/Apps/plClient/plClient.cpp
  2. 4
      Sources/Plasma/Apps/plPageInfo/plPageInfo.cpp
  3. 1
      Sources/Plasma/FeatureLib/pfConsole/pfConsoleDirSrc.h
  4. 2
      Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp
  5. 4
      Sources/Plasma/PubUtilLib/plAgeLoader/plAgeLoader.cpp
  6. 2
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientGroup.cpp
  7. 2
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp
  8. 9
      Sources/Plasma/PubUtilLib/plResMgr/CMakeLists.txt
  9. 9
      Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp
  10. 18
      Sources/Plasma/PubUtilLib/plResMgr/plPageInfo.cpp
  11. 12
      Sources/Plasma/PubUtilLib/plResMgr/plPageInfo.h
  12. 32
      Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.cpp
  13. 9
      Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.h
  14. 37
      Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp
  15. 4
      Sources/Plasma/PubUtilLib/plResMgr/plResManager.h
  16. 21
      Sources/Plasma/PubUtilLib/plResMgr/plResManagerHelper.cpp
  17. 2
      Sources/Tools/MaxComponent/plClothingComponent.cpp
  18. 4
      Sources/Tools/MaxComponent/plMiscComponents.cpp
  19. 2
      Sources/Tools/MaxConvert/plLightMapGen.cpp
  20. 28
      Sources/Tools/MaxMain/plPluginResManager.cpp
  21. 11
      Sources/Tools/MaxMain/plPluginResManager.h
  22. 6
      Sources/Tools/plResBrowser/plResTreeView.cpp

8
Sources/Plasma/Apps/plClient/plClient.cpp

@ -990,7 +990,7 @@ void plClient::SetHoldLoadRequests(bool hold)
void plClient::IQueueRoomLoad(const std::vector<plLocation>& locs, bool hold) void plClient::IQueueRoomLoad(const std::vector<plLocation>& locs, bool hold)
{ {
bool allSameAge = true; bool allSameAge = true;
const char* lastAgeName = nil; plString lastAgeName;
uint32_t numRooms = 0; uint32_t numRooms = 0;
for (int i = 0; i < locs.size(); i++) for (int i = 0; i < locs.size(); i++)
@ -1006,9 +1006,9 @@ void plClient::IQueueRoomLoad(const std::vector<plLocation>& locs, bool hold)
if (!info) if (!info)
hsStatusMessageF("Ignoring LoadRoom request for location 0x%x because we can't find the location", loc.GetSequenceNumber()); hsStatusMessageF("Ignoring LoadRoom request for location 0x%x because we can't find the location", loc.GetSequenceNumber());
else if (alreadyLoaded) else if (alreadyLoaded)
hsStatusMessageF("Ignoring LoadRoom request for %s-%s, since room is already loaded", info->GetAge(), info->GetPage()); hsStatusMessageF("Ignoring LoadRoom request for %s-%s, since room is already loaded", info->GetAge().c_str(), info->GetPage().c_str());
else if (isLoading) else if (isLoading)
hsStatusMessageF("Ignoring LoadRoom request for %s-%s, since room is currently loading", info->GetAge(), info->GetPage()); hsStatusMessageF("Ignoring LoadRoom request for %s-%s, since room is currently loading", info->GetAge().c_str(), info->GetPage().c_str());
#endif #endif
continue; continue;
@ -1016,7 +1016,7 @@ void plClient::IQueueRoomLoad(const std::vector<plLocation>& locs, bool hold)
fLoadRooms.push_back(new LoadRequest(loc, hold)); fLoadRooms.push_back(new LoadRequest(loc, hold));
if (!lastAgeName || strcmp(info->GetAge(), lastAgeName) == 0) if (lastAgeName.IsNull() || info->GetAge() == lastAgeName)
lastAgeName = info->GetAge(); lastAgeName = info->GetAge();
else else
allSameAge = false; allSameAge = false;

4
Sources/Plasma/Apps/plPageInfo/plPageInfo.cpp

@ -95,7 +95,7 @@ int PrintHelp( void )
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
if (argc >= 1 && strcmp(argv[1], "-v") == 0) if (argc >= 2 && strcmp(argv[1], "-v") == 0)
{ {
PrintVersion(); PrintVersion();
return 0; return 0;
@ -249,7 +249,7 @@ public:
const plPageInfo& info = page->GetPageInfo(); const plPageInfo& info = page->GetPageInfo();
char fileName[256]; char fileName[256];
sprintf(fileName, "%s%s_%s.csv", fOutputDir, info.GetAge(), info.GetPage()); sprintf(fileName, "%s%s_%s.csv", fOutputDir, info.GetAge().c_str(), info.GetPage().c_str());
fStream.Open(fileName, "wt"); fStream.Open(fileName, "wt");
page->LoadKeys(); page->LoadKeys();

1
Sources/Plasma/FeatureLib/pfConsole/pfConsoleDirSrc.h

@ -57,6 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "HeadSpin.h" #include "HeadSpin.h"
#include <vector> #include <vector>
#include <string>
#include "pfConsoleCore/pfConsoleEngine.h" #include "pfConsoleCore/pfConsoleEngine.h"

2
Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp

@ -298,7 +298,7 @@ static bool DumpSpecificMsgInfo(plMessage* msg, plString& info)
const plPageInfo* pageInfo = plKeyFinder::Instance().GetLocationInfo(loc); const plPageInfo* pageInfo = plKeyFinder::Instance().GetLocationInfo(loc);
if (pageInfo) if (pageInfo)
info += plString::Format("%s-%s ", pageInfo->GetAge(), pageInfo->GetPage()); info += plString::Format("%s-%s ", pageInfo->GetAge().c_str(), pageInfo->GetPage().c_str());
} }
} }
break; break;

4
Sources/Plasma/PubUtilLib/plAgeLoader/plAgeLoader.cpp

@ -337,7 +337,7 @@ class plUnloadAgeCollector : public plRegistryPageIterator
virtual bool EatPage( plRegistryPageNode *page ) virtual bool EatPage( plRegistryPageNode *page )
{ {
if( fAge && stricmp( page->GetPageInfo().GetAge(), fAge ) == 0 ) if( fAge && page->GetPageInfo().GetAge().CompareI(fAge) == 0 )
{ {
fPages.Append( page ); fPages.Append( page );
} }
@ -382,7 +382,7 @@ bool plAgeLoader::IUnloadAge()
plKey roomKey = plKeyFinder::Instance().FindSceneNodeKey( page->GetPageInfo().GetLocation() ); plKey roomKey = plKeyFinder::Instance().FindSceneNodeKey( page->GetPageInfo().GetLocation() );
if( roomKey != nil && roomKey->ObjectIsLoaded() ) if( roomKey != nil && roomKey->ObjectIsLoaded() )
{ {
nc->DebugMsg( "\tPaging out room %s\n", page->GetPageInfo().GetPage() ); nc->DebugMsg( "\tPaging out room %s\n", page->GetPageInfo().GetPage().c_str() );
newPageOuts.push_back(roomKey); newPageOuts.push_back(roomKey);
} }
} }

2
Sources/Plasma/PubUtilLib/plNetClient/plNetClientGroup.cpp

@ -66,6 +66,6 @@ void plNetClientGroups::ISetGroupDesc(plNetGroupId& grpId)
else else
{ {
const plPageInfo* pageInfo=plKeyFinder::Instance().GetLocationInfo(grpId.Room()); const plPageInfo* pageInfo=plKeyFinder::Instance().GetLocationInfo(grpId.Room());
grpId.SetDesc(pageInfo->GetPage()); grpId.SetDesc(pageInfo->GetPage().c_str());
} }
} }

2
Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp

@ -1236,7 +1236,7 @@ bool plNetClientMgr::ObjectInLocalAge(const plSynchedObject* obj) const
{ {
plLocation loc = obj->GetKey()->GetUoid().GetLocation(); plLocation loc = obj->GetKey()->GetUoid().GetLocation();
const plPageInfo* pageInfo = plKeyFinder::Instance().GetLocationInfo(loc); const plPageInfo* pageInfo = plKeyFinder::Instance().GetLocationInfo(loc);
bool ret= IsLocalAge(pageInfo->GetAge()); bool ret= IsLocalAge(pageInfo->GetAge().c_str());
return ret; return ret;
} }

9
Sources/Plasma/PubUtilLib/plResMgr/CMakeLists.txt

@ -34,7 +34,14 @@ set(plResMgr_HEADERS
) )
add_library(plResMgr STATIC ${plResMgr_SOURCES} ${plResMgr_HEADERS}) add_library(plResMgr STATIC ${plResMgr_SOURCES} ${plResMgr_HEADERS})
target_link_libraries(plResMgr CoreLib pnDispatch pnFactory pnKeyedObject pnMessage pnTimer plFile plStatusLog) target_link_libraries(plResMgr CoreLib)
target_link_libraries(plResMgr pnDispatch)
target_link_libraries(plResMgr pnFactory)
target_link_libraries(plResMgr pnKeyedObject)
target_link_libraries(plResMgr pnMessage)
target_link_libraries(plResMgr pnTimer)
target_link_libraries(plResMgr plFile)
target_link_libraries(plResMgr plStatusLog)
source_group("Source Files" FILES ${plResMgr_SOURCES}) source_group("Source Files" FILES ${plResMgr_SOURCES})
source_group("Header Files" FILES ${plResMgr_HEADERS}) source_group("Header Files" FILES ${plResMgr_HEADERS})

9
Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp

@ -159,7 +159,7 @@ public:
try try
{ {
#endif #endif
if( stricmp( pageNode->GetPageInfo().GetAge(), fAgeName ) == 0 ) if (pageNode->GetPageInfo().GetAge().CompareI(fAgeName) == 0)
{ {
// Try loading and searching thru this page // Try loading and searching thru this page
hsTArray<plKey> keyRefs; hsTArray<plKey> keyRefs;
@ -353,8 +353,7 @@ class plPageFinder : public plRegistryPageIterator
// Are we searching by age/page? // Are we searching by age/page?
if( fAgeString != nil ) if( fAgeString != nil )
{ {
if( stricmp( info.GetAge(), fAgeString ) == 0 && if (info.GetAge().CompareI(fAgeString) == 0 && info.GetPage().CompareI(fFindString) == 0)
stricmp( info.GetPage(), fFindString ) == 0 )
{ {
*fPagePtr = node; *fPagePtr = node;
return false; return false;
@ -363,14 +362,14 @@ class plPageFinder : public plRegistryPageIterator
} }
// Try for page only // Try for page only
if( stricmp( info.GetPage(), fFindString ) == 0 ) if (info.GetPage().CompareI(fFindString) == 0)
{ {
*fPagePtr = node; *fPagePtr = node;
return false; return false;
} }
// Try for full location // Try for full location
sprintf( str, "%s_%s", info.GetAge(), info.GetPage() ); sprintf( str, "%s_%s", info.GetAge().c_str(), info.GetPage().c_str() );
if( stricmp( str, fFindString ) == 0 ) if( stricmp( str, fFindString ) == 0 )
{ {
*fPagePtr = node; *fPagePtr = node;

18
Sources/Plasma/PubUtilLib/plResMgr/plPageInfo.cpp

@ -98,13 +98,10 @@ void plPageInfo::ISetFrom( const plPageInfo &src )
fIndexStart = src.fIndexStart; fIndexStart = src.fIndexStart;
} }
void plPageInfo::SetStrings( const char *age, const char *page ) void plPageInfo::SetStrings(const plString& age, const plString& page)
{ {
delete [] fAge; fAge = age;
delete [] fPage; fPage = page;
fAge = ( age == nil ) ? nil : hsStrcpy( age );
fPage = ( page == nil ) ? nil : hsStrcpy( page );
} }
void plPageInfo::SetLocation( const plLocation &loc ) void plPageInfo::SetLocation( const plLocation &loc )
@ -122,9 +119,6 @@ void plPageInfo::AddClassVersion(uint16_t classIdx, uint16_t version)
void plPageInfo::Read( hsStream *s ) void plPageInfo::Read( hsStream *s )
{ {
delete [] fAge;
delete [] fPage;
IInit(); IInit();
// 5 is the earliest version since we began working again on the P20 codebase in Sep 2005, // 5 is the earliest version since we began working again on the P20 codebase in Sep 2005,
@ -139,10 +133,10 @@ void plPageInfo::Read( hsStream *s )
if (version >= 5) if (version >= 5)
{ {
fLocation.Read( s ); fLocation.Read( s );
fAge = s->ReadSafeString(); fAge = s->ReadSafeString_TEMP();
if (version < 6) if (version < 6)
delete s->ReadSafeString(); // fChapter was never used, and always "District". s->ReadSafeString_TEMP(); // fChapter was never used, and always "District".
fPage = s->ReadSafeString(); fPage = s->ReadSafeString_TEMP();
s->ReadLE( &fMajorVersion ); s->ReadLE( &fMajorVersion );

12
Sources/Plasma/PubUtilLib/plResMgr/plPageInfo.h

@ -53,6 +53,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
class hsStream; class hsStream;
class plLocation; class plLocation;
class plString;
class plPageInfo class plPageInfo
{ {
public: public:
@ -61,8 +63,8 @@ public:
protected: protected:
plLocation fLocation; plLocation fLocation;
char* fAge; plString fAge;
char* fPage; plString fPage;
uint16_t fMajorVersion; uint16_t fMajorVersion;
ClassVerVec fClassVersions; ClassVerVec fClassVersions;
uint32_t fChecksum; uint32_t fChecksum;
@ -78,8 +80,8 @@ public:
plPageInfo( const plPageInfo &src ); plPageInfo( const plPageInfo &src );
virtual ~plPageInfo(); virtual ~plPageInfo();
const char* GetAge() const { return fAge; } const plString& GetAge() const { return fAge; }
const char* GetPage() const { return fPage; } const plString& GetPage() const { return fPage; }
plPageInfo &operator=( const plPageInfo &src ); plPageInfo &operator=( const plPageInfo &src );
@ -87,7 +89,7 @@ public:
void AddClassVersion(uint16_t classIdx, uint16_t version); void AddClassVersion(uint16_t classIdx, uint16_t version);
const ClassVerVec& GetClassVersions() const { return fClassVersions; } const ClassVerVec& GetClassVersions() const { return fClassVersions; }
void SetStrings( const char *age, const char *page ); void SetStrings(const plString& age, const plString& page);
void SetLocation(const plLocation& loc); void SetLocation(const plLocation& loc);
const plLocation& GetLocation() const { return fLocation; } const plLocation& GetLocation() const { return fLocation; }

32
Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.cpp

@ -43,23 +43,23 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plRegistryKeyList.h" #include "plRegistryKeyList.h"
#include "plRegistryHelpers.h" #include "plRegistryHelpers.h"
#include "plString.h"
#include "pnKeyedObject/plKeyImp.h" #include "pnKeyedObject/plKeyImp.h"
#include "plStatusLog/plStatusLog.h" #include "plStatusLog/plStatusLog.h"
#include "pnFactory/plFactory.h" #include "pnFactory/plFactory.h"
#include "plFile/hsFiles.h"
#include "plFile/plFileUtils.h" #include "plFile/plFileUtils.h"
#include "plVersion.h" #include "plVersion.h"
plRegistryPageNode::plRegistryPageNode(const char* path) plRegistryPageNode::plRegistryPageNode(const plString& path)
: fValid(kPageCorrupt) : fValid(kPageCorrupt)
, fPath(nil) , fPath(path)
, fDynLoadedTypes(0) , fDynLoadedTypes(0)
, fStaticLoadedTypes(0) , fStaticLoadedTypes(0)
, fOpenRequests(0) , fOpenRequests(0)
, fIsNewPage(false) , fIsNewPage(false)
{ {
fPath = hsStrcpy(path);
hsStream* stream = OpenStream(); hsStream* stream = OpenStream();
if (stream) if (stream)
{ {
@ -69,7 +69,7 @@ plRegistryPageNode::plRegistryPageNode(const char* path)
} }
} }
plRegistryPageNode::plRegistryPageNode(const plLocation& location, const char* age, const char* page, const char* dataPath) plRegistryPageNode::plRegistryPageNode(const plLocation& location, const plString& age, const plString& page, const plString& dataPath)
: fValid(kPageOk) : fValid(kPageOk)
, fPath(nil) , fPath(nil)
, fPageInfo(location) , fPageInfo(location)
@ -80,25 +80,13 @@ plRegistryPageNode::plRegistryPageNode(const plLocation& location, const char* a
{ {
fPageInfo.SetStrings(age, page); fPageInfo.SetStrings(age, page);
char filePath[512];
// Copy the path over
strncpy(filePath, dataPath, sizeof(filePath));
plFileUtils::AddSlash(filePath);
// Time to construct our actual file name. For now, we'll use the same old format // Time to construct our actual file name. For now, we'll use the same old format
// of age_page.extension // of age_page.extension
strncat(filePath, fPageInfo.GetAge(), sizeof(filePath)); fPath = plString::Format("%s" PATH_SEPARATOR_STR "%s_District_%s.prp", dataPath.c_str(), fPageInfo.GetAge().c_str(), fPageInfo.GetPage().c_str());
strncat(filePath, "_District_", sizeof(filePath));
strncat(filePath, fPageInfo.GetPage(), sizeof(filePath));
strncat(filePath, ".prp", sizeof(filePath));
fPath = hsStrcpy(filePath);
} }
plRegistryPageNode::~plRegistryPageNode() plRegistryPageNode::~plRegistryPageNode()
{ {
delete [] fPath;
UnloadKeys(); UnloadKeys();
} }
@ -141,7 +129,7 @@ hsStream* plRegistryPageNode::OpenStream()
{ {
if (fOpenRequests == 0) if (fOpenRequests == 0)
{ {
if (!fStream.Open(fPath, "rb")) if (!fStream.Open_TEMP(fPath, "rb"))
return nil; return nil;
} }
fOpenRequests++; fOpenRequests++;
@ -168,7 +156,7 @@ void plRegistryPageNode::LoadKeys()
if (!stream) if (!stream)
{ {
hsAssert(0, plString::Format("plRegistryPageNode::LoadKeysFromSource - bad stream %s,%s", hsAssert(0, plString::Format("plRegistryPageNode::LoadKeysFromSource - bad stream %s,%s",
GetPageInfo().GetAge(), GetPageInfo().GetPage()).c_str()); GetPageInfo().GetAge().c_str(), GetPageInfo().GetPage().c_str()).c_str());
return; return;
} }
@ -232,7 +220,7 @@ void plRegistryPageNode::Write()
{ {
hsAssert(fOpenRequests == 0, "Trying to write while the page is open for reading"); hsAssert(fOpenRequests == 0, "Trying to write while the page is open for reading");
if (!fStream.Open(fPath, "wb")) if (!fStream.Open(fPath.c_str(), "wb"))
{ {
hsAssert(0, "Couldn't open file for writing"); hsAssert(0, "Couldn't open file for writing");
return; return;
@ -412,6 +400,6 @@ plRegistryKeyList* plRegistryPageNode::IGetKeyList(uint16_t classType) const
void plRegistryPageNode::DeleteSource() void plRegistryPageNode::DeleteSource()
{ {
hsAssert(fOpenRequests == 0, "Deleting a stream that's open for reading"); hsAssert(fOpenRequests == 0, "Deleting a stream that's open for reading");
plFileUtils::RemoveFile(fPath); plFileUtils::RemoveFile(fPath.c_str());
} }

9
Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.h

@ -52,6 +52,7 @@ class plRegistryKeyList;
class hsStream; class hsStream;
class plKeyImp; class plKeyImp;
class plRegistryKeyIterator; class plRegistryKeyIterator;
class plString;
enum PageCond enum PageCond
{ {
@ -77,7 +78,7 @@ protected:
int fStaticLoadedTypes; // The number of key types that have all their keys loaded int fStaticLoadedTypes; // The number of key types that have all their keys loaded
PageCond fValid; // Condition of the page PageCond fValid; // Condition of the page
char* fPath; // Path to the page file plString fPath; // Path to the page file
plPageInfo fPageInfo; // Info about this page plPageInfo fPageInfo; // Info about this page
hsBufferedStream fStream; // Stream for reading/writing our page hsBufferedStream fStream; // Stream for reading/writing our page
@ -92,10 +93,10 @@ protected:
public: public:
// For reading a page off disk // For reading a page off disk
plRegistryPageNode(const char* path); plRegistryPageNode(const plString& path);
// For creating a new page. // For creating a new page.
plRegistryPageNode(const plLocation& location, const char* age, const char* page, const char* dataPath); plRegistryPageNode(const plLocation& location, const plString& age, const plString& page, const plString& dataPath);
~plRegistryPageNode(); ~plRegistryPageNode();
bool IsValid() const { return fValid == kPageOk; } bool IsValid() const { return fValid == kPageOk; }
@ -142,7 +143,7 @@ public:
void Write(); void Write();
void DeleteSource(); void DeleteSource();
const char* GetPagePath() const { return fPath; } const plString& GetPagePath() const { return fPath; }
}; };
#endif // plRegistryNode_h_inc #endif // plRegistryNode_h_inc

37
Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp

@ -243,7 +243,7 @@ plRegistryPageNode* plResManager::FindSinglePage(const char* path) const
PageMap::const_iterator it; PageMap::const_iterator it;
for (it = fAllPages.begin(); it != fAllPages.end(); it++) for (it = fAllPages.begin(); it != fAllPages.end(); it++)
{ {
if (stricmp((it->second)->GetPagePath(), path) == 0) if ((it->second)->GetPagePath().CompareI(path) == 0)
return it->second; return it->second;
} }
@ -626,9 +626,9 @@ void plResManager::GetLocationStrings(const plLocation& loc, char* ageBuffer, ch
// Those buffers better be big enough... // Those buffers better be big enough...
if (ageBuffer) if (ageBuffer)
hsStrcpy(ageBuffer, info.GetAge()); hsStrcpy(ageBuffer, info.GetAge().c_str());
if (pageBuffer) if (pageBuffer)
hsStrcpy(pageBuffer, info.GetPage()); hsStrcpy(pageBuffer, info.GetPage().c_str());
} }
bool plResManager::AddViaNotify(plRefMsg* msg, plRefFlags::Type flags) bool plResManager::AddViaNotify(plRefMsg* msg, plRefFlags::Type flags)
@ -1041,7 +1041,7 @@ public:
virtual bool EatPage(plRegistryPageNode* page) virtual bool EatPage(plRegistryPageNode* page)
{ {
if (stricmp(page->GetPageInfo().GetAge(), fAgeName) == 0) if (page->GetPageInfo().GetAge().CompareI(fAgeName) == 0)
{ {
fResMgr->LoadPageKeys(page); fResMgr->LoadPageKeys(page);
plKeyCollector collector(fKeys); plKeyCollector collector(fKeys);
@ -1176,23 +1176,23 @@ void plResManager::PageInRoom(const plLocation& page, uint16_t objClassToRef, pl
return; return;
} }
kResMgrLog(2, ILog(2, "...Found, page is ID'd as %s>%s", pageNode->GetPageInfo().GetAge(), pageNode->GetPageInfo().GetPage())); kResMgrLog(2, ILog(2, "...Found, page is ID'd as %s>%s", pageNode->GetPageInfo().GetAge().c_str(), pageNode->GetPageInfo().GetPage().c_str()));
// Step 0.5: Verify the page, just to make sure we really should be loading it // Step 0.5: Verify the page, just to make sure we really should be loading it
PageCond cond = pageNode->GetPageCondition(); PageCond cond = pageNode->GetPageCondition();
if (cond != kPageOk) if (cond != kPageOk)
{ {
std::string condStr ="Checksum invalid"; plString condStr = "Checksum invalid";
if (cond == kPageTooNew) if (cond == kPageTooNew) {
condStr = "Page Version too new"; condStr = "Page Version too new";
else } else if (cond == kPageOutOfDate) {
if (cond == kPageOutOfDate)
condStr = "Page Version out of date"; condStr = "Page Version out of date";
}
kResMgrLog(1, ILog(1, "...IGNORING pageIn request; verification failed! (%s)", condStr.c_str())); kResMgrLog(1, ILog(1, "...IGNORING pageIn request; verification failed! (%s)", condStr.c_str()));
plString msg = plString::Format("Data Problem: Age:%s Page:%s Error:%s", plString msg = plString::Format("Data Problem: Age:%s Page:%s Error:%s",
pageNode->GetPageInfo().GetAge(), pageNode->GetPageInfo().GetPage(), condStr.c_str()); pageNode->GetPageInfo().GetAge().c_str(), pageNode->GetPageInfo().GetPage().c_str(), condStr.c_str());
hsMessageBox(msg.c_str(), "Error", hsMessageBoxNormal, hsMessageBoxIconError); hsMessageBox(msg.c_str(), "Error", hsMessageBoxNormal, hsMessageBoxIconError);
hsRefCnt_SafeUnRef(refMsg); hsRefCnt_SafeUnRef(refMsg);
@ -1250,7 +1250,7 @@ void plResManager::PageInRoom(const plLocation& page, uint16_t objClassToRef, pl
readRoomTime = hsTimer::GetFullTickCount() - readRoomTime; readRoomTime = hsTimer::GetFullTickCount() - readRoomTime;
plStatusLog::AddLineS("readtimings.log", plStatusLog::kWhite, "----- Reading page %s>%s took %.1f ms", plStatusLog::AddLineS("readtimings.log", plStatusLog::kWhite, "----- Reading page %s>%s took %.1f ms",
pageNode->GetPageInfo().GetAge(), pageNode->GetPageInfo().GetPage(), pageNode->GetPageInfo().GetAge().c_str(), pageNode->GetPageInfo().GetPage().c_str(),
hsTimer::FullTicksToMs(readRoomTime)); hsTimer::FullTicksToMs(readRoomTime));
} }
} }
@ -1275,7 +1275,7 @@ public:
} }
virtual bool EatPage(plRegistryPageNode* page) virtual bool EatPage(plRegistryPageNode* page)
{ {
if (stricmp(page->GetPageInfo().GetAge(), fAgeName) == 0) if (page->GetPageInfo().GetAge().CompareI(fAgeName) == 0)
{ {
plUoid uoid(page->GetPageInfo().GetLocation(), 0, ""); plUoid uoid(page->GetPageInfo().GetLocation(), 0, "");
fLocations.push_back(uoid.GetLocation()); fLocations.push_back(uoid.GetLocation());
@ -1406,7 +1406,7 @@ static void ICatPageNames(hsTArray<plRegistryPageNode*>& pages, char* buf, int b
break; break;
} }
const char* pagePath = pages[i]->GetPagePath(); const char* pagePath = pages[i]->GetPagePath().c_str();
const char* pageFile = plFileUtils::GetFileName(pagePath); const char* pageFile = plFileUtils::GetFileName(pagePath);
if (strlen(buf) + strlen(pageFile) > bufSize - 5) if (strlen(buf) + strlen(pageFile) > bufSize - 5)
@ -1578,7 +1578,7 @@ static void sIReportLeak(plKeyImp* key, plRegistryPageNode* page)
if (!alreadyDone) if (!alreadyDone)
{ {
// Print out page header // Print out page header
hsStatusMessageF(" Leaks in page %s>%s[%08x]:\n", lastPage->GetPageInfo().GetAge(), lastPage->GetPageInfo().GetPage(), lastPage->GetPageInfo().GetLocation().GetSequenceNumber()); hsStatusMessageF(" Leaks in page %s>%s[%08x]:\n", lastPage->GetPageInfo().GetAge().c_str(), lastPage->GetPageInfo().GetPage().c_str(), lastPage->GetPageInfo().GetLocation().GetSequenceNumber());
alreadyDone = true; alreadyDone = true;
} }
@ -1650,14 +1650,13 @@ plRegistryPageNode* plResManager::FindPage(const plLocation& location) const
//// FindPage //////////////////////////////////////////////////////////////// //// FindPage ////////////////////////////////////////////////////////////////
plRegistryPageNode* plResManager::FindPage(const char* age, const char* page) const plRegistryPageNode* plResManager::FindPage(const plString& age, const plString& page) const
{ {
PageMap::const_iterator it; PageMap::const_iterator it;
for (it = fAllPages.begin(); it != fAllPages.end(); ++it) for (it = fAllPages.begin(); it != fAllPages.end(); ++it)
{ {
const plPageInfo& info = (it->second)->GetPageInfo(); const plPageInfo& info = (it->second)->GetPageInfo();
if (stricmp(info.GetAge(), age) == 0 && if (info.GetAge().CompareI(age) == 0 && info.GetPage().CompareI(page) == 0)
stricmp(info.GetPage(), page) == 0)
return it->second; return it->second;
} }
@ -1760,7 +1759,7 @@ bool plResManager::IterateKeys(plRegistryKeyIterator* iterator, const plLocation
//// IteratePages //////////////////////////////////////////////////////////// //// IteratePages ////////////////////////////////////////////////////////////
// Iterate through all LOADED pages // Iterate through all LOADED pages
bool plResManager::IteratePages(plRegistryPageIterator* iterator, const char* ageToRestrictTo) bool plResManager::IteratePages(plRegistryPageIterator* iterator, const plString& ageToRestrictTo)
{ {
ILockPages(); ILockPages();
@ -1771,7 +1770,7 @@ bool plResManager::IteratePages(plRegistryPageIterator* iterator, const char* ag
if (page->GetPageInfo().GetLocation() == plLocation::kGlobalFixedLoc) if (page->GetPageInfo().GetLocation() == plLocation::kGlobalFixedLoc)
continue; continue;
if (!ageToRestrictTo || stricmp(page->GetPageInfo().GetAge(), ageToRestrictTo) == 0) if (ageToRestrictTo.IsNull() || page->GetPageInfo().GetAge().CompareI(ageToRestrictTo) == 0)
{ {
if (!iterator->EatPage(page)) if (!iterator->EatPage(page))
{ {

4
Sources/Plasma/PubUtilLib/plResMgr/plResManager.h

@ -155,7 +155,7 @@ public:
// Single page version // Single page version
bool IterateKeys(plRegistryKeyIterator* iterator, const plLocation& pageToRestrictTo); bool IterateKeys(plRegistryKeyIterator* iterator, const plLocation& pageToRestrictTo);
// Iterate through loaded pages // Iterate through loaded pages
bool IteratePages(plRegistryPageIterator* iterator, const char* ageToRestrictTo = nil); bool IteratePages(plRegistryPageIterator* iterator, const plString& ageToRestrictTo = "");
// Iterate through ALL pages, loaded or not // Iterate through ALL pages, loaded or not
bool IterateAllPages(plRegistryPageIterator* iterator); bool IterateAllPages(plRegistryPageIterator* iterator);
@ -164,7 +164,7 @@ public:
void UnloadPageObjects(plRegistryPageNode* pageNode, uint16_t classIndexHint); void UnloadPageObjects(plRegistryPageNode* pageNode, uint16_t classIndexHint);
void DumpUnusedKeys(plRegistryPageNode* page) const; void DumpUnusedKeys(plRegistryPageNode* page) const;
plRegistryPageNode* FindPage(const plLocation& location) const; plRegistryPageNode* FindPage(const plLocation& location) const;
plRegistryPageNode* FindPage(const char* age, const char* page) const; plRegistryPageNode* FindPage(const plString& age, const plString& page) const;
// Runs through all the pages and verifies that the data versions are good // Runs through all the pages and verifies that the data versions are good
bool VerifyPages(); bool VerifyPages();

21
Sources/Plasma/PubUtilLib/plResMgr/plResManagerHelper.cpp

@ -183,10 +183,10 @@ void plResManagerHelper::LoadAndHoldPageKeys( plRegistryPageNode *page )
// Load and ref the keys // Load and ref the keys
#ifdef HS_DEBUGGING #ifdef HS_DEBUGGING
char msg[ 256 ]; char msg[ 256 ];
sprintf( msg, "*** Temporarily loading keys for room %s>%s based on FindKey() query, will drop in 1 sec ***", page->GetPageInfo().GetAge(), page->GetPageInfo().GetPage() ); sprintf( msg, "*** Temporarily loading keys for room %s>%s based on FindKey() query, will drop in 1 sec ***", page->GetPageInfo().GetAge().c_str(), page->GetPageInfo().GetPage().c_str());
hsStatusMessage( msg ); hsStatusMessage( msg );
#endif #endif
kResMgrLog( 2 ) 0xff80ff80, "Temporarily loading keys for room %s>%s, will drop in 1 sec", page->GetPageInfo().GetAge(), page->GetPageInfo().GetPage() ); kResMgrLog( 2 ) 0xff80ff80, "Temporarily loading keys for room %s>%s, will drop in 1 sec", page->GetPageInfo().GetAge().c_str(), page->GetPageInfo().GetPage().c_str());
// Deliver the message to ourselves! // Deliver the message to ourselves!
refferMsg->SetTimeStamp( hsTimer::GetSysSeconds() + 1.f ); refferMsg->SetTimeStamp( hsTimer::GetSysSeconds() + 1.f );
@ -359,7 +359,7 @@ class plDebugPrintIterator : public plRegistryPageIterator, plRegistryKeyIterato
fHoldingCount++; fHoldingCount++;
// Changed ages? // Changed ages?
if( page == nil || strcmp( fCurrAge, page->GetPageInfo().GetAge() ) != 0 ) if( page == nil || page->GetPageInfo().GetAge() != fCurrAge )
{ {
// Print some info for the last age we were on // Print some info for the last age we were on
if( fCurrAge[ 0 ] != 0 ) if( fCurrAge[ 0 ] != 0 )
@ -385,7 +385,7 @@ class plDebugPrintIterator : public plRegistryPageIterator, plRegistryKeyIterato
} }
fPageCount = 0; fPageCount = 0;
if( page != nil ) if( page != nil )
strncpy( fCurrAge, page->GetPageInfo().GetAge(), sizeof( fCurrAge ) - 1 ); strncpy( fCurrAge, page->GetPageInfo().GetAge().c_str(), sizeof( fCurrAge ) - 1 );
else else
fCurrAge[ 0 ] = 0; fCurrAge[ 0 ] = 0;
@ -417,9 +417,9 @@ class plDebugPrintIterator : public plRegistryPageIterator, plRegistryKeyIterato
if( fLines < kLogSize - 4 ) if( fLines < kLogSize - 4 )
{ {
if( fParent->fDebugDisplayType == plResManagerHelper::kSizes ) if( fParent->fDebugDisplayType == plResManagerHelper::kSizes )
fLog->AddLineF( plStatusLog::kWhite, " %s (%d keys @ %4.1fk, %d loaded @ %4.1fk)", page->GetPageInfo().GetPage(), fTotalKeys, fTotalSize / 1024.f, fLoadedKeys, fLoadedSize / 1024.f ); fLog->AddLineF( plStatusLog::kWhite, " %s (%d keys @ %4.1fk, %d loaded @ %4.1fk)", page->GetPageInfo().GetPage().c_str(), fTotalKeys, fTotalSize / 1024.f, fLoadedKeys, fLoadedSize / 1024.f );
else if( fParent->fDebugDisplayType == plResManagerHelper::kPercents ) else if( fParent->fDebugDisplayType == plResManagerHelper::kPercents )
fLog->AddLineF( plStatusLog::kWhite, " %s (%d%% loaded of %d keys @ %4.1fk)", page->GetPageInfo().GetPage(), fLoadedSize * 100 / ( fTotalSize > 0 ? fTotalSize : -1 ), fTotalKeys, fTotalSize / 1024.f ); fLog->AddLineF( plStatusLog::kWhite, " %s (%d%% loaded of %d keys @ %4.1fk)", page->GetPageInfo().GetPage().c_str(), fLoadedSize * 100 / ( fTotalSize > 0 ? fTotalSize : -1 ), fTotalKeys, fTotalSize / 1024.f );
else //if( fParent->fDebugDisplayType == plResManagerHelper::kBars ) else //if( fParent->fDebugDisplayType == plResManagerHelper::kBars )
{ {
const int startPos = 20, length = 32; const int startPos = 20, length = 32;
@ -427,10 +427,10 @@ class plDebugPrintIterator : public plRegistryPageIterator, plRegistryKeyIterato
char line[ 128 ]; char line[ 128 ];
memset( line, ' ', sizeof( line ) - 1 ); memset( line, ' ', sizeof( line ) - 1 );
line[ 127 ] = 0; line[ 127 ] = 0;
if( strlen( page->GetPageInfo().GetPage() ) < startPos - 2 ) if(page->GetPageInfo().GetPage().GetSize() < startPos - 2 )
memcpy( line + 2, page->GetPageInfo().GetPage(), strlen( page->GetPageInfo().GetPage() ) ); memcpy( line + 2, page->GetPageInfo().GetPage().c_str(), page->GetPageInfo().GetPage().GetSize() );
else else
memcpy( line + 2, page->GetPageInfo().GetPage(), startPos - 2 ); memcpy( line + 2, page->GetPageInfo().GetPage().c_str(), startPos - 2 );
line[ startPos ] = '|'; line[ startPos ] = '|';
if( fTotalSize == 0 ) if( fTotalSize == 0 )
@ -490,13 +490,12 @@ void plResManagerHelper::IUpdateDebugScreen( bool force )
if( !fRefreshing ) if( !fRefreshing )
return; return;
plRegistry *reg = fResManager->IGetRegistry();
uint32_t loadedCnt, holdingCnt; uint32_t loadedCnt, holdingCnt;
fDebugScreen->Clear(); fDebugScreen->Clear();
plDebugPrintIterator iter( this, fDebugScreen, loadedCnt, holdingCnt ); plDebugPrintIterator iter( this, fDebugScreen, loadedCnt, holdingCnt );
reg->IterateAllPages( &iter ); fResManager->IterateAllPages( &iter );
iter.EatPage( nil ); // Force a final update iter.EatPage( nil ); // Force a final update
fDebugScreen->AddLineF( plStatusLog::kGreen, "%d pages loaded, %d holding", loadedCnt, holdingCnt ); fDebugScreen->AddLineF( plStatusLog::kGreen, "%d pages loaded, %d holding", loadedCnt, holdingCnt );

2
Sources/Tools/MaxComponent/plClothingComponent.cpp

@ -233,7 +233,7 @@ bool plClothingComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
} }
const plPageInfo* thisInfo = plKeyFinder::Instance().GetLocationInfo(locationNode ? locationNode->GetLocation() : node->GetLocation()); const plPageInfo* thisInfo = plKeyFinder::Instance().GetLocationInfo(locationNode ? locationNode->GetLocation() : node->GetLocation());
const plLocation &loc = plKeyFinder::Instance().FindLocation("GlobalClothing", thisInfo->GetPage()); const plLocation &loc = plKeyFinder::Instance().FindLocation("GlobalClothing", thisInfo->GetPage().c_str());
for (i = 0; i < fCompPB->Count(plClothingComponent::kMaterials); i++) for (i = 0; i < fCompPB->Count(plClothingComponent::kMaterials); i++)
{ {

4
Sources/Tools/MaxComponent/plMiscComponents.cpp

@ -472,7 +472,7 @@ bool plPageInfoComponent::SetupProperties(plMaxNode *pNode, plErrorMsg *pErrMsg)
"for playing over the network or released for external use.\n\n" "for playing over the network or released for external use.\n\n"
"\t(Original sequence #: 0x%X)\n\t(Temporary sequence #: 0x%X)", "\t(Original sequence #: 0x%X)\n\t(Temporary sequence #: 0x%X)",
age, room, pNode->GetName(), age, room, pNode->GetName(),
lastPage->GetAge(), lastPage->GetPage(), age, room, seqNum, newNum ); lastPage->GetAge().c_str(), lastPage->GetPage().c_str(), age, room, seqNum, newNum );
} }
else if( plPluginResManager::ResMgr()->GetLastVerifyError() == plPluginResManager::kErrSeqAlreadyTaken ) else if( plPluginResManager::ResMgr()->GetLastVerifyError() == plPluginResManager::kErrSeqAlreadyTaken )
{ {
@ -485,7 +485,7 @@ bool plPageInfoComponent::SetupProperties(plMaxNode *pNode, plErrorMsg *pErrMsg)
"for playing over the network or released for external use.\n\n" "for playing over the network or released for external use.\n\n"
"\t(Original sequence #: 0x%X)\n\t(Temporary sequence #: 0x%X)", "\t(Original sequence #: 0x%X)\n\t(Temporary sequence #: 0x%X)",
age, room, pNode->GetName(), age, room, pNode->GetName(),
lastPage->GetAge(), lastPage->GetPage(), age, room, seqNum, newNum ); lastPage->GetAge().c_str(), lastPage->GetPage().c_str(), age, room, seqNum, newNum );
} }
else if( plPluginResManager::ResMgr()->GetLastVerifyError() == plPluginResManager::kErrCantFindValid ) else if( plPluginResManager::ResMgr()->GetLastVerifyError() == plPluginResManager::kErrCantFindValid )
{ {

2
Sources/Tools/MaxConvert/plLightMapGen.cpp

@ -1293,7 +1293,7 @@ plLayerInterface* plLightMapGen::IMakeLightMapLayer(plMaxNode* node, plGeometryS
// Make sure layer (and mip) name are unique across pages by putting the page name in // Make sure layer (and mip) name are unique across pages by putting the page name in
const plPageInfo* pageInfo = plKeyFinder::Instance().GetLocationInfo(node->GetLocation()); const plPageInfo* pageInfo = plKeyFinder::Instance().GetLocationInfo(node->GetLocation());
plString layName = plString::Format("%s_%s_LIGHTMAPGEN", pageInfo->GetPage(), node->GetName()); plString layName = plString::Format("%s_%s_LIGHTMAPGEN", pageInfo->GetPage().c_str(), node->GetName());
plKey layKey = node->FindPageKey(plLayer::Index(), layName); plKey layKey = node->FindPageKey(plLayer::Index(), layName);

28
Sources/Tools/MaxMain/plPluginResManager.cpp

@ -58,7 +58,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pnKeyedObject/plKeyImp.h" #include "pnKeyedObject/plKeyImp.h"
#include "plAgeDescription/plAgeDescription.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 // Hack for now--always prefer paging out sceneNodes first
fPageOutHint = plSceneNode::Index(); 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"); 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) // 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); 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 // seqNumber, returns the page for that combo (either by preloading it or
// by creating it). // 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 // Find the location first, to see if it already exists
plRegistryPageNode* pageNode = FindPage(age, page); plRegistryPageNode* pageNode = FindPage(age, page);
@ -120,12 +120,12 @@ plRegistryPageNode* plPluginResManager::INameToPage(const char* age, const char*
if (sequenceNumber != uint32_t(-1)) if (sequenceNumber != uint32_t(-1))
{ {
const plLocation& newLoc = ICreateLocation(age, page, sequenceNumber, itinerant); const plLocation& newLoc = ICreateLocation(age, page, sequenceNumber, itinerant);
pageNode = CreatePage(newLoc, age, page); pageNode = CreatePage(newLoc, age.c_str(), page.c_str());
} }
else else
{ {
const plLocation& newLoc = ICreateLocation(age, page, itinerant); 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 // 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 // for the shared textures page
@ -196,7 +196,7 @@ void plPluginResManager::IPreLoadTextures(plRegistryPageNode* pageNode, int32_t
bool common = false; bool common = false;
for (int i = 0; i < plAgeDescription::kNumCommonPages; i++) 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; common = true;
break; 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); int32_t seqNum = VerifySeqNumber(0, age, page);
return ICreateLocation(age, page, seqNum, itinerant); 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; int32_t oldNum = seqNum;
seqNum = VerifySeqNumber(seqNum, age, page); seqNum = VerifySeqNumber(seqNum, age, page);
@ -352,7 +352,7 @@ plLocation plPluginResManager::ICreateLocation(const char* age, const char* page
// Flag common pages // Flag common pages
for (int i = 0; i < plAgeDescription::kNumCommonPages; i++) 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); newLoc.SetFlags(plLocation::kBuiltIn);
break; 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 // If we have an age description file for the age we're creating a location
// for, grab some extra flags from it // for, grab some extra flags from it
plAgeDescription* ageDesc = plPageInfoUtils::GetAgeDesc(age); plAgeDescription* ageDesc = plPageInfoUtils::GetAgeDesc(age.c_str());
plAgePage* agePage = ageDesc ? ageDesc->FindPage(page) : nil; plAgePage* agePage = ageDesc ? ageDesc->FindPage(page.c_str()) : nil;
if (agePage) if (agePage)
{ {
if (agePage->GetFlags() & plAgePage::kIsLocalOnly) 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 // 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) if (sequenceNumber < 0)
{ {
sequenceNumber = -sequenceNumber; sequenceNumber = -sequenceNumber;

11
Sources/Tools/MaxMain/plPluginResManager.h

@ -50,6 +50,7 @@ class plLocation;
class plPageInfo; class plPageInfo;
class plRegistryPageNode; class plRegistryPageNode;
class plSceneNode; class plSceneNode;
class plString;
class plPluginResManager : public plResManager 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. // 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 // 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 enum VerifyErrors
{ {
@ -97,10 +98,10 @@ public:
void EndExport(); void EndExport();
protected: protected:
plLocation ICreateLocation(const char* age, const char* page, bool itinerant); plLocation ICreateLocation(const plString& age, const plString& page, bool itinerant);
plLocation ICreateLocation(const char* age, const char* page, int32_t seqNum, 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); void IPreLoadTextures(plRegistryPageNode* pageNode, int32_t origSeqNumber);

6
Sources/Tools/plResBrowser/plResTreeView.cpp

@ -145,7 +145,7 @@ class plResDlgLoader : public plRegistryPageIterator, public plRegistryKeyIterat
fCurrPage = page; fCurrPage = page;
const plPageInfo &info = page->GetPageInfo(); const plPageInfo &info = page->GetPageInfo();
sprintf( str, "%s->%s", info.GetAge(), info.GetPage() ); sprintf( str, "%s->%s", info.GetAge().c_str(), info.GetPage().c_str());
fCurrItem = AddLeaf( fTree, NULL, str, new plKeyInfo( nil, fCurrPage ) ); fCurrItem = AddLeaf( fTree, NULL, str, new plKeyInfo( nil, fCurrPage ) );
fCurrType = (uint16_t)-1; fCurrType = (uint16_t)-1;
@ -393,8 +393,8 @@ void plResTreeView::UpdateInfoDlg( HWND treeCtrl )
const plPageInfo &pageInfo = info->fPage->GetPageInfo(); const plPageInfo &pageInfo = info->fPage->GetPageInfo();
char tempStr[ 32 ]; char tempStr[ 32 ];
SetDlgItemText( fInfoDlg, IDC_AGE, pageInfo.GetAge() ); SetDlgItemText( fInfoDlg, IDC_AGE, pageInfo.GetAge().c_str());
SetDlgItemText( fInfoDlg, IDC_PAGE, pageInfo.GetPage() ); SetDlgItemText( fInfoDlg, IDC_PAGE, pageInfo.GetPage().c_str());
SetDlgItemText( fInfoDlg, IDC_LOCATION, pageInfo.GetLocation().StringIze().c_str() ); SetDlgItemText( fInfoDlg, IDC_LOCATION, pageInfo.GetLocation().StringIze().c_str() );

Loading…
Cancel
Save