plKey plKeyFinder::StupidSearch(const plString & age, const plString & rm, uint16_t classType, const plString &obName, bool subString) { if (obName.IsNull()) return nil; plUoid newOid; fLastError = kOk; uint16_t maxClasses = plFactory::GetNumClasses(); uint16_t ty = classType; if (ty == maxClasses) // error { fLastError = kInvalidClass; return nil; } if (!age.IsNull() && !rm.IsNull()) { const plLocation &loc = IGetResMgr()->FindLocation( age, rm ); if( !loc.IsValid() ) { fLastError = kPageNotFound; return nil; } plKeyFinderIter keyFinder( classType, obName, subString ); if( !IGetResMgr()->IterateKeys( &keyFinder, loc ) ) // Return value of false means it stopped somewhere, i.e. found something return keyFinder.GetFoundKey(); } else if (!age.IsNull()) { plKeyFinderIter keyFinder(classType, obName, subString, age); if( !IGetResMgr()->IterateAllPages( &keyFinder ) ) return keyFinder.GetFoundKey(); } else { plKeyFinderIter keyFinder( classType, obName, subString ); if( !IGetResMgr()->IterateKeys( &keyFinder ) ) // Return value of false means it stopped somewhere, i.e. found something return keyFinder.GetFoundKey(); } fLastError = kObjectNotFound; return nil; }
virtual bool EatPage( plRegistryPageNode *node ) { const plPageInfo &info = node->GetPageInfo(); // Are we searching by age/page? if (!fAgeString.IsNull()) { if (info.GetAge().CompareI(fAgeString) == 0 && info.GetPage().CompareI(fFindString) == 0) { *fPagePtr = node; return false; } return true; } // Try for page only if (info.GetPage().CompareI(fFindString) == 0) { *fPagePtr = node; return false; } // Try for full location if (plString::Format("%s_%s", info.GetAge().c_str(), info.GetPage().c_str()).CompareI(fFindString) == 0) { *fPagePtr = node; return false; } return true; // Keep searching }
void plMouseDevice::AddNameToCursor(const plString& name) { if (fInstance && !name.IsNull()) { plDebugText &txt = plDebugText::Instance(); txt.DrawString(fInstance->fWXPos + 12 ,fInstance->fWYPos - 7,name.c_str()); } }
void plAutoProfileImp::INextProfile() { // Haven't linked to our first age yet, do that before we start profiling if (fNextAge == 0) { if (!INextAge()) IShutdown(); } else { // Log the stats for this spawn point if (!fLastSpawnPointName.IsNull()) { plString ageName = NetCommGetAge()->ageDatasetName; plProfileManagerFull::Instance().LogStats(ageName, fLastSpawnPointName); plMipmap mipmap; if (plClient::GetInstance()->GetPipeline()->CaptureScreen(&mipmap)) { plString fileName = plFormat("{}\\{}_{}.jpg", plProfileManagerFull::Instance().GetProfilePath(), ageName, fLastSpawnPointName); plJPEG::Instance().SetWriteQuality(100); plJPEG::Instance().WriteToFile(fileName.c_str(), &mipmap); } fLastSpawnPointName = plString::Null; } // Try to go to the next spawn point if (!INextSpawnPoint()) { // Link to the next age if (!INextAge()) { // We've done all the ages, shut down IShutdown(); } } } }
bool GetSegMapAnimTime(const plString &animName, SegmentMap *segMap, SegmentSpec::SegType type, float& begin, float& end) { if (segMap) { if (!animName.IsNull() && segMap->find(animName) != segMap->end()) { SegmentSpec *spec = (*segMap)[animName]; if (spec->fType == type) { if (spec->fStart != -1) begin = spec->fStart; if (spec->fEnd != -1) end = spec->fEnd; return true; } } } return false; }
// // override for plLoggable // bool plNetClientMgr::Log(const plString& str) const { if (str.IsNull() || str.IsEmpty()) { return true; } // prepend raw time plString buf2 = plFormat("{.2f} {}", hsTimer::GetSeconds(), ProcessTab(str.c_str())); if ( GetConsoleOutput() ) hsStatusMessage(buf2.c_str()); GetLog(); plNetObjectDebugger::GetInstance()->LogMsgIfMatch(buf2.c_str()); if (fStatusLog) { return fStatusLog->AddLine(buf2); } return true; }
void plKeyFinder::ReallyStupidSubstringSearch(const plString &name, uint16_t objType, std::vector<plKey>& foundKeys, const plLocation &hintLocation ) { if (name.IsNull()) return; plKeyFinderIterator collector( objType, name, foundKeys ); if( hintLocation.IsValid() ) { plRegistryPageNode *hintPage = IGetResMgr()->FindPage( hintLocation ); if( hintPage != nil ) { // Try all pages in the same age as that page IGetResMgr()->IteratePages( &collector, hintPage->GetPageInfo().GetAge() ); } if (foundKeys.size() > 0) { return; } } //fpReg->IterateKeys( &collector ); IGetResMgr()->IterateAllPages( &collector ); }