Browse Source

Convert plRegistryNode stuff to plString.

Darryl Pogue 12 years ago
parent
commit
4dd06d1e7e
  1. 4
      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. 4
      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. 12
      Sources/Plasma/PubUtilLib/plResMgr/plPageInfo.cpp
  11. 18
      Sources/Plasma/PubUtilLib/plResMgr/plPageInfo.h
  12. 36
      Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.cpp
  13. 9
      Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.h
  14. 41
      Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp
  15. 4
      Sources/Plasma/PubUtilLib/plResMgr/plResManager.h
  16. 21
      Sources/Plasma/PubUtilLib/plResMgr/plResManagerHelper.cpp
  17. 4
      Sources/Tools/MaxComponent/plMiscComponents.cpp
  18. 4
      Sources/Tools/MaxConvert/plLightMapGen.cpp
  19. 24
      Sources/Tools/MaxMain/plPluginResManager.cpp
  20. 11
      Sources/Tools/MaxMain/plPluginResManager.h
  21. 6
      Sources/Tools/plResBrowser/plResTreeView.cpp

4
Sources/Plasma/Apps/plClient/plClient.cpp

@ -1006,9 +1006,9 @@ void plClient::IQueueRoomLoad(const std::vector<plLocation>& locs, bool hold)
if (!info)
hsStatusMessageF("Ignoring LoadRoom request for location 0x%x because we can't find the location", loc.GetSequenceNumber());
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)
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
continue;

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

@ -95,7 +95,7 @@ int PrintHelp( void )
int main(int argc, char* argv[])
{
if (argc >= 1 && strcmp(argv[1], "-v") == 0)
if (argc >= 2 && strcmp(argv[1], "-v") == 0)
{
PrintVersion();
return 0;
@ -249,7 +249,7 @@ public:
const plPageInfo& info = page->GetPageInfo();
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");
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 <vector>
#include <string>
#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);
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;

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

@ -337,7 +337,7 @@ class plUnloadAgeCollector : public plRegistryPageIterator
virtual bool EatPage( plRegistryPageNode *page )
{
if( fAge && stricmp( page->GetPageInfo().GetAge(), fAge ) == 0 )
if( fAge && page->GetPageInfo().GetAge().CompareI(fAge) == 0 )
{
fPages.Append( page );
}
@ -382,7 +382,7 @@ bool plAgeLoader::IUnloadAge()
plKey roomKey = plKeyFinder::Instance().FindSceneNodeKey( page->GetPageInfo().GetLocation() );
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);
}
}

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

@ -66,6 +66,6 @@ void plNetClientGroups::ISetGroupDesc(plNetGroupId& grpId)
else
{
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

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

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

@ -34,7 +34,14 @@ set(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("Header Files" FILES ${plResMgr_HEADERS})

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

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

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

@ -98,13 +98,10 @@ void plPageInfo::ISetFrom( const plPageInfo &src )
fIndexStart = src.fIndexStart;
}
void plPageInfo::SetStrings( const char *age, const char *page )
void plPageInfo::SetStrings(const plString& age, const plString& page)
{
delete [] fAge;
delete [] fPage;
fAge = ( age == nil ) ? nil : hsStrcpy( age );
fPage = ( page == nil ) ? nil : hsStrcpy( page );
fAge = age;
fPage = page;
}
void plPageInfo::SetLocation( const plLocation &loc )
@ -122,9 +119,6 @@ void plPageInfo::AddClassVersion(uint16_t classIdx, uint16_t version)
void plPageInfo::Read( hsStream *s )
{
delete [] fAge;
delete [] fPage;
IInit();
// 5 is the earliest version since we began working again on the P20 codebase in Sep 2005,

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

@ -53,6 +53,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
class hsStream;
class plLocation;
class plString;
class plPageInfo
{
public:
@ -61,12 +63,12 @@ public:
protected:
plLocation fLocation;
char* fAge;
char* fPage;
uint16_t fMajorVersion;
plString fAge;
plString fPage;
uint16_t fMajorVersion;
ClassVerVec fClassVersions;
uint32_t fChecksum;
uint32_t fDataStart, fIndexStart;
uint32_t fChecksum;
uint32_t fDataStart, fIndexStart;
void IInit( void );
void ISetFrom( const plPageInfo &src );
@ -78,8 +80,8 @@ public:
plPageInfo( const plPageInfo &src );
virtual ~plPageInfo();
const char* GetAge() const { return fAge; }
const char* GetPage() const { return fPage; }
const plString& GetAge() const { return fAge; }
const plString& GetPage() const { return fPage; }
plPageInfo &operator=( const plPageInfo &src );
@ -87,7 +89,7 @@ public:
void AddClassVersion(uint16_t classIdx, uint16_t version);
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);
const plLocation& GetLocation() const { return fLocation; }

36
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 "plRegistryHelpers.h"
#include "plString.h"
#include "pnKeyedObject/plKeyImp.h"
#include "plStatusLog/plStatusLog.h"
#include "pnFactory/plFactory.h"
#include "plFile/hsFiles.h"
#include "plFile/plFileUtils.h"
#include "plVersion.h"
plRegistryPageNode::plRegistryPageNode(const char* path)
plRegistryPageNode::plRegistryPageNode(const plString& path)
: fValid(kPageCorrupt)
, fPath(nil)
, fPath(path)
, fDynLoadedTypes(0)
, fStaticLoadedTypes(0)
, fOpenRequests(0)
, fIsNewPage(false)
{
fPath = hsStrcpy(path);
hsStream* stream = OpenStream();
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)
, fPath(nil)
, fPageInfo(location)
@ -80,25 +80,21 @@ plRegistryPageNode::plRegistryPageNode(const plLocation& location, const char* a
{
fPageInfo.SetStrings(age, page);
char filePath[512];
// Copy the path over
strncpy(filePath, dataPath, sizeof(filePath));
plFileUtils::AddSlash(filePath);
plString path = dataPath;
path += PATH_SEPARATOR_STR;
// Time to construct our actual file name. For now, we'll use the same old format
// of age_page.extension
strncat(filePath, fPageInfo.GetAge(), sizeof(filePath));
strncat(filePath, "_District_", sizeof(filePath));
strncat(filePath, fPageInfo.GetPage(), sizeof(filePath));
strncat(filePath, ".prp", sizeof(filePath));
path += fPageInfo.GetAge();
path += "_District_";
path += fPageInfo.GetPage();
path += ".prp";
fPath = hsStrcpy(filePath);
fPath = path;
}
plRegistryPageNode::~plRegistryPageNode()
{
delete [] fPath;
UnloadKeys();
}
@ -141,7 +137,7 @@ hsStream* plRegistryPageNode::OpenStream()
{
if (fOpenRequests == 0)
{
if (!fStream.Open(fPath, "rb"))
if (!fStream.Open(fPath.c_str(), "rb"))
return nil;
}
fOpenRequests++;
@ -168,7 +164,7 @@ void plRegistryPageNode::LoadKeys()
if (!stream)
{
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;
}
@ -232,7 +228,7 @@ void plRegistryPageNode::Write()
{
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");
return;
@ -412,6 +408,6 @@ plRegistryKeyList* plRegistryPageNode::IGetKeyList(uint16_t classType) const
void plRegistryPageNode::DeleteSource()
{
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 plKeyImp;
class plRegistryKeyIterator;
class plString;
enum PageCond
{
@ -77,7 +78,7 @@ protected:
int fStaticLoadedTypes; // The number of key types that have all their keys loaded
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
hsBufferedStream fStream; // Stream for reading/writing our page
@ -92,10 +93,10 @@ protected:
public:
// For reading a page off disk
plRegistryPageNode(const char* path);
plRegistryPageNode(const plString& path);
// 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();
bool IsValid() const { return fValid == kPageOk; }
@ -142,7 +143,7 @@ public:
void Write();
void DeleteSource();
const char* GetPagePath() const { return fPath; }
const plString& GetPagePath() const { return fPath; }
};
#endif // plRegistryNode_h_inc

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

@ -243,7 +243,7 @@ plRegistryPageNode* plResManager::FindSinglePage(const char* path) const
PageMap::const_iterator 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;
}
@ -626,9 +626,9 @@ void plResManager::GetLocationStrings(const plLocation& loc, char* ageBuffer, ch
// Those buffers better be big enough...
if (ageBuffer)
hsStrcpy(ageBuffer, info.GetAge());
hsStrcpy(ageBuffer, info.GetAge().c_str());
if (pageBuffer)
hsStrcpy(pageBuffer, info.GetPage());
hsStrcpy(pageBuffer, info.GetPage().c_str());
}
bool plResManager::AddViaNotify(plRefMsg* msg, plRefFlags::Type flags)
@ -1041,7 +1041,7 @@ public:
virtual bool EatPage(plRegistryPageNode* page)
{
if (stricmp(page->GetPageInfo().GetAge(), fAgeName) == 0)
if (page->GetPageInfo().GetAge().CompareI(fAgeName) == 0)
{
fResMgr->LoadPageKeys(page);
plKeyCollector collector(fKeys);
@ -1176,25 +1176,25 @@ void plResManager::PageInRoom(const plLocation& page, uint16_t objClassToRef, pl
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
PageCond cond = pageNode->GetPageCondition();
if (cond != kPageOk)
{
std::string condStr ="Checksum invalid";
if (cond == kPageTooNew)
plString condStr = "Checksum invalid";
if (cond == kPageTooNew) {
condStr = "Page Version too new";
else
if (cond == kPageOutOfDate)
} else if (cond == kPageOutOfDate) {
condStr = "Page Version out of date";
}
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",
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);
hsRefCnt_SafeUnRef(refMsg);
return;
}
@ -1250,7 +1250,7 @@ void plResManager::PageInRoom(const plLocation& page, uint16_t objClassToRef, pl
readRoomTime = hsTimer::GetFullTickCount() - readRoomTime;
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));
}
}
@ -1275,7 +1275,7 @@ public:
}
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, "");
fLocations.push_back(uoid.GetLocation());
@ -1406,7 +1406,7 @@ static void ICatPageNames(hsTArray<plRegistryPageNode*>& pages, char* buf, int b
break;
}
const char* pagePath = pages[i]->GetPagePath();
const char* pagePath = pages[i]->GetPagePath().c_str();
const char* pageFile = plFileUtils::GetFileName(pagePath);
if (strlen(buf) + strlen(pageFile) > bufSize - 5)
@ -1578,7 +1578,7 @@ static void sIReportLeak(plKeyImp* key, plRegistryPageNode* page)
if (!alreadyDone)
{
// 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;
}
@ -1650,14 +1650,13 @@ plRegistryPageNode* plResManager::FindPage(const plLocation& location) const
//// 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;
for (it = fAllPages.begin(); it != fAllPages.end(); ++it)
{
const plPageInfo& info = (it->second)->GetPageInfo();
if (stricmp(info.GetAge(), age) == 0 &&
stricmp(info.GetPage(), page) == 0)
if (info.GetAge().CompareI(age) == 0 && info.GetPage().CompareI(page) == 0)
return it->second;
}
@ -1760,7 +1759,7 @@ bool plResManager::IterateKeys(plRegistryKeyIterator* iterator, const plLocation
//// IteratePages ////////////////////////////////////////////////////////////
// Iterate through all LOADED pages
bool plResManager::IteratePages(plRegistryPageIterator* iterator, const char* ageToRestrictTo)
bool plResManager::IteratePages(plRegistryPageIterator* iterator, const plString& ageToRestrictTo)
{
ILockPages();
@ -1771,7 +1770,7 @@ bool plResManager::IteratePages(plRegistryPageIterator* iterator, const char* ag
if (page->GetPageInfo().GetLocation() == plLocation::kGlobalFixedLoc)
continue;
if (!ageToRestrictTo || stricmp(page->GetPageInfo().GetAge(), ageToRestrictTo) == 0)
if (!ageToRestrictTo.IsNull() || page->GetPageInfo().GetAge().CompareI(ageToRestrictTo) == 0)
{
if (!iterator->EatPage(page))
{

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

@ -155,7 +155,7 @@ public:
// Single page version
bool IterateKeys(plRegistryKeyIterator* iterator, const plLocation& pageToRestrictTo);
// Iterate through loaded pages
bool IteratePages(plRegistryPageIterator* iterator, const char* ageToRestrictTo = nil);
bool IteratePages(plRegistryPageIterator* iterator, const plString& ageToRestrictTo = nil);
// Iterate through ALL pages, loaded or not
bool IterateAllPages(plRegistryPageIterator* iterator);
@ -164,7 +164,7 @@ public:
void UnloadPageObjects(plRegistryPageNode* pageNode, uint16_t classIndexHint);
void DumpUnusedKeys(plRegistryPageNode* page) 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
bool VerifyPages();

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

@ -183,10 +183,10 @@ void plResManagerHelper::LoadAndHoldPageKeys( plRegistryPageNode *page )
// Load and ref the keys
#ifdef HS_DEBUGGING
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 );
#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!
refferMsg->SetTimeStamp( hsTimer::GetSysSeconds() + 1.f );
@ -359,7 +359,7 @@ class plDebugPrintIterator : public plRegistryPageIterator, plRegistryKeyIterato
fHoldingCount++;
// 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
if( fCurrAge[ 0 ] != 0 )
@ -385,7 +385,7 @@ class plDebugPrintIterator : public plRegistryPageIterator, plRegistryKeyIterato
}
fPageCount = 0;
if( page != nil )
strncpy( fCurrAge, page->GetPageInfo().GetAge(), sizeof( fCurrAge ) - 1 );
strncpy( fCurrAge, page->GetPageInfo().GetAge().c_str(), sizeof( fCurrAge ) - 1 );
else
fCurrAge[ 0 ] = 0;
@ -417,9 +417,9 @@ class plDebugPrintIterator : public plRegistryPageIterator, plRegistryKeyIterato
if( fLines < kLogSize - 4 )
{
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 )
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 )
{
const int startPos = 20, length = 32;
@ -427,10 +427,10 @@ class plDebugPrintIterator : public plRegistryPageIterator, plRegistryKeyIterato
char line[ 128 ];
memset( line, ' ', sizeof( line ) - 1 );
line[ 127 ] = 0;
if( strlen( page->GetPageInfo().GetPage() ) < startPos - 2 )
memcpy( line + 2, page->GetPageInfo().GetPage(), strlen( page->GetPageInfo().GetPage() ) );
if(page->GetPageInfo().GetPage().GetSize() < startPos - 2 )
memcpy( line + 2, page->GetPageInfo().GetPage().c_str(), page->GetPageInfo().GetPage().GetSize() );
else
memcpy( line + 2, page->GetPageInfo().GetPage(), startPos - 2 );
memcpy( line + 2, page->GetPageInfo().GetPage().c_str(), startPos - 2 );
line[ startPos ] = '|';
if( fTotalSize == 0 )
@ -490,13 +490,12 @@ void plResManagerHelper::IUpdateDebugScreen( bool force )
if( !fRefreshing )
return;
plRegistry *reg = fResManager->IGetRegistry();
uint32_t loadedCnt, holdingCnt;
fDebugScreen->Clear();
plDebugPrintIterator iter( this, fDebugScreen, loadedCnt, holdingCnt );
reg->IterateAllPages( &iter );
fResManager->IterateAllPages( &iter );
iter.EatPage( nil ); // Force a final update
fDebugScreen->AddLineF( plStatusLog::kGreen, "%d pages loaded, %d holding", loadedCnt, holdingCnt );

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"
"\t(Original sequence #: 0x%X)\n\t(Temporary sequence #: 0x%X)",
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 )
{
@ -485,7 +485,7 @@ bool plPageInfoComponent::SetupProperties(plMaxNode *pNode, plErrorMsg *pErrMsg)
"for playing over the network or released for external use.\n\n"
"\t(Original sequence #: 0x%X)\n\t(Temporary sequence #: 0x%X)",
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 )
{

4
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
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);
@ -1626,4 +1626,4 @@ int plLightMapGen::IPowerOfTwo(int sz) const
p2sz >>= 1;
return p2sz;
}
}

24
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 "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);
@ -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;

11
Sources/Tools/MaxMain/plPluginResManager.h

@ -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);

6
Sources/Tools/plResBrowser/plResTreeView.cpp

@ -145,7 +145,7 @@ class plResDlgLoader : public plRegistryPageIterator, public plRegistryKeyIterat
fCurrPage = page;
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 ) );
fCurrType = (uint16_t)-1;
@ -393,8 +393,8 @@ void plResTreeView::UpdateInfoDlg( HWND treeCtrl )
const plPageInfo &pageInfo = info->fPage->GetPageInfo();
char tempStr[ 32 ];
SetDlgItemText( fInfoDlg, IDC_AGE, pageInfo.GetAge() );
SetDlgItemText( fInfoDlg, IDC_PAGE, pageInfo.GetPage() );
SetDlgItemText( fInfoDlg, IDC_AGE, pageInfo.GetAge().c_str());
SetDlgItemText( fInfoDlg, IDC_PAGE, pageInfo.GetPage().c_str());
SetDlgItemText( fInfoDlg, IDC_LOCATION, pageInfo.GetLocation().StringIze().c_str() );

Loading…
Cancel
Save