metamod/mlist.cpp
branchB-work
changeset 139 2995153b596c
parent 133 fbe73f167e7d
child 140 71a284715890
     1.1 --- a/metamod/mlist.cpp	Tue Jul 26 19:56:15 2005 +0000
     1.2 +++ b/metamod/mlist.cpp	Thu Jul 28 15:18:05 2005 +0000
     1.3 @@ -293,8 +293,6 @@
     1.4  		return NULL;
     1.5  	}
     1.6  
     1.7 -	pl_added->source_plugin_index = pl_loader->index;
     1.8 -
     1.9  	META_DEBUG(1, ("Loaded plugin '%s' successfully", pl_added->desc));
    1.10  	meta_errno = ME_NOERROR;
    1.11  
    1.12 @@ -338,7 +336,9 @@
    1.13  	// copy source
    1.14  	iplug->source=padd->source;
    1.15  	// copy status
    1.16 -	iplug->status=padd->status;
    1.17 +	iplug->status=padd->status;	
    1.18 +	//copy other things
    1.19 +	iplug->source_plugin_index = padd->source_plugin_index;
    1.20  
    1.21  	return(iplug);
    1.22  }
    1.23 @@ -598,12 +598,12 @@
    1.24  			META_CONS("Opened plugin '%s', but failed to attach; see log", pl_added->desc);
    1.25  		else
    1.26  			META_CONS("Couldn't load plugin '%s'; see log", pl_added->desc);
    1.27 -		show();
    1.28 +		show(0);
    1.29  		// meta_errno should be already set in load()
    1.30  		return(mFALSE);
    1.31  	}
    1.32  	META_CONS("Loaded plugin '%s' successfully", pl_added->desc);
    1.33 -	show();
    1.34 +	show(0);
    1.35  	return(mTRUE);
    1.36  }
    1.37  
    1.38 @@ -742,11 +742,16 @@
    1.39  // List plugins and information about them in a formatted table.
    1.40  // meta_errno values:
    1.41  //  - none
    1.42 -void MPluginList::show() {
    1.43 +void MPluginList::show(int source_index) {
    1.44  	int i, n=0, r=0;
    1.45  	MPlugin *pl;
    1.46  	char desc[15+1], file[16+1], vers[7+1];		// plus 1 for term null
    1.47  
    1.48 +	if (source_index <= 0)
    1.49 +		META_CONS("Currently loaded plugins:");
    1.50 +	else
    1.51 +		META_CONS("Child plugins:");
    1.52 +
    1.53  	META_CONS("Currently loaded plugins:");
    1.54  	META_CONS("  %*s  %-*s  %-4s %-4s  %-*s  v%-*s  %-3s  %-5s %-5s",
    1.55  			WIDTH_MAX_PLUGINS, "",
    1.56 @@ -758,6 +763,8 @@
    1.57  		pl=&plist[i];
    1.58  		if(pl->status < PL_VALID)
    1.59  			continue;
    1.60 +		if ((source_index > 0) && (pl->source_plugin_index != source_index))
    1.61 +			continue;
    1.62  		STRNCPY(desc, pl->desc, sizeof(desc));
    1.63  		STRNCPY(file, pl->file, sizeof(file));
    1.64  		if(pl->info && pl->info->version) STRNCPY(vers, pl->info->version, sizeof(vers));
    1.65 @@ -802,3 +809,23 @@
    1.66  	}
    1.67  	META_CLIENT(pEntity, "%d plugins", n);
    1.68  }
    1.69 +
    1.70 +mBOOL MPluginList::found_child_plugins(int source_index)
    1.71 +{
    1.72 +	int i;
    1.73 +
    1.74 +	if (source_index <= 0)
    1.75 +		return mFALSE;
    1.76 +
    1.77 +	for (i=0; i<endlist; i++)
    1.78 +	{
    1.79 +		if (plist[i].status < PL_VALID)
    1.80 +			continue;
    1.81 +		if (plist[i].source_plugin_index == source_index)
    1.82 +			return mTRUE;
    1.83 +	}
    1.84 +
    1.85 +	return mFALSE;
    1.86 +}
    1.87 +
    1.88 +