MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / GetPackStatus

Method GetPackStatus

neo/framework/FileSystem.cpp:2870–2920  ·  view source on GitHub ↗

=========== idFileSystemLocal::GetPackStatus =========== */

Source from the content-addressed store, hash-verified

2868===========
2869*/
2870pureStatus_t idFileSystemLocal::GetPackStatus( pack_t *pak ) {
2871 int i, l, hashindex;
2872 fileInPack_t *file;
2873 bool abrt;
2874 idStr name;
2875
2876 if ( pak->pureStatus != PURE_UNKNOWN ) {
2877 return pak->pureStatus;
2878 }
2879
2880 // check content for PURE_NEVER
2881 i = 0;
2882 file = pak->buildBuffer;
2883 for ( hashindex = 0; hashindex < FILE_HASH_SIZE; hashindex++ ) {
2884 abrt = false;
2885 file = pak->hashTable[ hashindex ];
2886 while ( file ) {
2887 abrt = true;
2888 l = file->name.Length();
2889 for ( int j = 0; pureExclusions[j].func != NULL; j++ ) {
2890 if ( pureExclusions[j].func( pureExclusions[j], l, file->name ) ) {
2891 abrt = false;
2892 break;
2893 }
2894 }
2895 if ( abrt ) {
2896 common->DPrintf( "pak '%s' candidate for pure: '%s'\n", pak->pakFilename.c_str(), file->name.c_str() );
2897 break;
2898 }
2899 file = file->next;
2900 i++;
2901 }
2902 if ( abrt ) {
2903 break;
2904 }
2905 }
2906 if ( i == pak->numfiles ) {
2907 pak->pureStatus = PURE_NEVER;
2908 return PURE_NEVER;
2909 }
2910
2911 // check pak name for PURE_ALWAYS
2912 pak->pakFilename.ExtractFileName( name );
2913 if ( !name.IcmpPrefixPath( "pak" ) ) {
2914 pak->pureStatus = PURE_ALWAYS;
2915 return PURE_ALWAYS;
2916 }
2917
2918 pak->pureStatus = PURE_NEUTRAL;
2919 return PURE_NEUTRAL;
2920}
2921
2922/*
2923===========

Callers

nothing calls this directly

Calls 5

ExtractFileNameMethod · 0.80
IcmpPrefixPathMethod · 0.80
LengthMethod · 0.45
DPrintfMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected