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

Method GetMapDecl

neo/framework/FileSystem.cpp:3880–3918  ·  view source on GitHub ↗

=============== idFileSystemLocal::GetMapDecl retrieve the decl dictionary, add a 'path' value =============== */

Source from the content-addressed store, hash-verified

3878===============
3879*/
3880const 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===============

Callers 7

SetMapShotMethod · 0.80
HandleGuiCommandsMethod · 0.80
ServerCallVoteMethod · 0.80
SetMapShotMethod · 0.80
HandleGuiCommandsMethod · 0.80
ServerCallVoteMethod · 0.80

Calls 6

GetNumDeclsMethod · 0.80
DeclByIndexMethod · 0.80
ErrorMethod · 0.45
SetMethod · 0.45
GetNameMethod · 0.45
NumMethod · 0.45

Tested by

no test coverage detected