void RFType::ScanRF() { // Validate pointers. ValidateThis_(); // Enumerate the resources of this type that are in the file. // (Assume that we're already in the right resource context.) SInt16 numRsrcs = ::Count1Resources(GetResType()); for (SInt16 i = 1; i <= numRsrcs; i++) { // Get a resource. Note that we cannot use the // ValidateHandle_ macro here because the resource // is *not* loaded. Handle theResourceH = ::Get1IndResource(GetResType(), i); ThrowIfNil_(theResourceH); // Create a resource object for this resource. RFResource* theResourceObj = new RFResource(*this, theResourceH); ValidateObject_(theResourceObj); // Add this resource to our list. First ensure that the // resource doesn't already exist in our map (which would be // an odd condition.) if (FindResource(theResourceObj->GetResID(), false)) { SignalCStr_("Duplicate resource found."); delete theResourceObj; } else { // Add it to the list. mResources.AddItem(&theResourceObj); // Broadcast a change message. RMMap_ChangeMessage msg = { &(GetRMMap()), this, theResourceObj }; GetRMMap().BroadcastMessage(Resource_Added, &msg); } } }
size_t CResourceQty::WriteNameSingle( TCHAR * pszArgs, int iQty ) const { ADDTOCALLSTACK("CResourceQty::WriteNameSingle"); if ( GetResType() == RES_ITEMDEF ) { const CItemBase * pItemBase = CItemBase::FindItemBase(static_cast<ITEMID_TYPE>(m_rid.GetResIndex())); //DEBUG_ERR(("pItemBase 0x%x m_rid 0%x m_rid.GetResIndex() 0%x\n",pItemBase,m_rid,m_rid.GetResIndex())); if ( pItemBase ) return( strcpylen( pszArgs, pItemBase->GetNamePluralize(pItemBase->GetTypeName(),(( iQty > 1 ) ? true : false))) ); } const CScriptObj * pResourceDef = g_Cfg.ResourceGetDef( m_rid ); if ( pResourceDef != NULL ) return( strcpylen( pszArgs, pResourceDef->GetName()) ); else return( strcpylen( pszArgs, g_Cfg.ResourceGetName( m_rid )) ); }