This commit is contained in:
David Anderson 2006-06-04 01:05:20 +00:00
parent dafc10d878
commit d0d08800ef
2 changed files with 17 additions and 9 deletions

View File

@ -541,29 +541,26 @@ void CPluginMngr::CacheAndLoadModules(const char *plugin)
CVector<LibDecoder *> expects;
CVector<LibDecoder *> defaults;
CStack<LibDecoder *> delstack;
for (int i=0; i<num; i++)
{
amx_GetTag(&amx, i, name, &tag_id);
if (name[0] == '?')
{
LibDecoder *dc = new LibDecoder;
delstack.push(dc);
if (DecodeLibCmdString(name, dc))
{
if (dc->cmd == LibCmd_ForceLib)
{
RunLibCommand(dc);
delete dc;
} else if ( (dc->cmd == LibCmd_ExpectClass) ||
(dc->cmd == LibCmd_ExpectLib) )
{
expects.push_back(dc);
} else if (dc->cmd == LibCmd_DefaultLib) {
defaults.push_back(dc);
} else {
delete dc;
}
} else {
delete dc;
}
}
}
@ -571,12 +568,19 @@ void CPluginMngr::CacheAndLoadModules(const char *plugin)
for (size_t i=0; i<expects.size(); i++)
{
RunLibCommand(expects[i]);
delete expects[i];
}
for (size_t i=0; i<defaults.size(); i++)
{
RunLibCommand(defaults[i]);
delete defaults[i];
}
expects.clear();
defaults.clear();
while (!delstack.empty())
{
delete delstack.front();
delstack.pop();
}
return;

View File

@ -42,14 +42,18 @@ enum LibError
LibErr_NoClass,
};
struct LibDecoder
class LibDecoder
{
public:
LibDecoder() : buffer(NULL)
{
};
}
~LibDecoder()
{
free(buffer);
buffer = NULL;
param1 = NULL;
param2 = NULL;
}
char *buffer;
char *param1;