示例#1
0
void plAgeDescInterface::IGetAgeFiles(std::vector<plAgeFile*>& ageFiles)
{
    IClearAgeFiles(ageFiles);

    char agePath[MAX_PATH];

    // Make list of "local" ages. This might contain copies of those in AssetMan, so we make the
    // list first and take out the ones that are in AssetMan
    char localPath[MAX_PATH];
    if (IGetLocalAgePath(localPath))
    {
        hsFolderIterator ageFolder(localPath);
        while (ageFolder.NextFileSuffix(".age"))
        {
            ageFolder.GetPathAndName(agePath);

            plAgeFile* age = new plAgeFile(plAgeFile::kLocalFile, agePath);
            ageFiles.push_back(age);
        }
    }

#ifdef MAXASS_AVAILABLE
    // Add AssetMan ages, if available (since we're static, go thru the main MaxAss interface)
    // Hoikas (many years later) does not believe the above comment...
    MaxAssInterface *assetMan = GetMaxAssInterface();
    if( assetMan!= nil )
    {
        hsTArray<jvUniqueId> doneAssets;

        jvArray<jvUniqueId>* assets = assetMan->GetAssetsByType(MaxAssInterface::kTypeAge);
        for (int i = 0; i < assets->Size(); i++)
        {
            if( doneAssets.Find( (*assets)[ i ] ) == doneAssets.kMissingIndex )
            {
                if (assetMan->GetLatestVersionFile((*assets)[i], agePath, sizeof(agePath)))
                {
                    plAgeFile* age = new plAgeFile(plAgeFile::kAssetFile, agePath, (*assets)[i]);

                    int existing = IFindAge(age->fAgeName.c_str(), ageFiles);
                    // Remove it from our "local" list if there, since it's a duplicate
                    if (existing != -1)
                    {
                        delete ageFiles[existing];
                        ageFiles[existing] = age;
                    }
                    else
                        ageFiles.push_back(age);

                    doneAssets.Append( (*assets)[ i ] );
                }
            }
        }
        assets->DeleteSelf();
    }
#endif
}