=============== idFileSystemLocal::GetMapDecl retrieve the decl dictionary, add a 'path' value =============== */
| 3878 | =============== |
| 3879 | */ |
| 3880 | const idDict * idFileSystemLocal::GetMapDecl( int idecl ) { |
| 3881 | int i; |
| 3882 | const idDecl *mapDecl; |
| 3883 | const idDeclEntityDef *mapDef; |
| 3884 | int numdecls = declManager->GetNumDecls( DECL_MAPDEF ); |
| 3885 | searchpath_t *search = NULL; |
| 3886 | |
| 3887 | if ( idecl < numdecls ) { |
| 3888 | mapDecl = declManager->DeclByIndex( DECL_MAPDEF, idecl ); |
| 3889 | mapDef = static_cast<const idDeclEntityDef *>( mapDecl ); |
| 3890 | if ( !mapDef ) { |
| 3891 | common->Error( "idFileSystemLocal::GetMapDecl %d: not found\n", idecl ); |
| 3892 | } |
| 3893 | mapDict = mapDef->dict; |
| 3894 | mapDict.Set( "path", mapDef->GetName() ); |
| 3895 | return &mapDict; |
| 3896 | } |
| 3897 | idecl -= numdecls; |
| 3898 | for ( i = 0; i < 2; i++ ) { |
| 3899 | if ( i == 0 ) { |
| 3900 | search = searchPaths; |
| 3901 | } else if ( i == 1 ) { |
| 3902 | search = addonPaks; |
| 3903 | } |
| 3904 | for ( ; search ; search = search->next ) { |
| 3905 | if ( !search->pack || !search->pack->addon || !search->pack->addon_info ) { |
| 3906 | continue; |
| 3907 | } |
| 3908 | // each addon may have a bunch of map decls |
| 3909 | if ( idecl < search->pack->addon_info->mapDecls.Num() ) { |
| 3910 | mapDict = *search->pack->addon_info->mapDecls[ idecl ]; |
| 3911 | return &mapDict; |
| 3912 | } |
| 3913 | idecl -= search->pack->addon_info->mapDecls.Num(); |
| 3914 | assert( idecl >= 0 ); |
| 3915 | } |
| 3916 | } |
| 3917 | return NULL; |
| 3918 | } |
| 3919 | |
| 3920 | /* |
| 3921 | =============== |
no test coverage detected