Add optional extensions not found to sm exts list in a seperate list.

This commit is contained in:
Ruben Gonzalez 2017-11-30 14:21:19 -05:00
parent 51cea0e04e
commit c87afde1bd

View File

@ -947,7 +947,21 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const ICommand
List<CExtension *>::iterator iter;
CExtension *pExt;
unsigned int num = 1;
switch (m_Libs.size())
List<CExtension *> required; // List of loaded and required extensions
List<CExtension *> optional; // List of non loaded optional extensions
for (iter = m_Libs.begin(); iter != m_Libs.end(); iter++)
{
pExt = (*iter);
if (pExt->IsLoaded() || pExt->IsRequired())
required.push_back(pExt);
else if (!pExt->IsLoaded() && !pExt->IsRequired())
optional.push_back(pExt);
}
switch (required.size())
{
case 1:
{
@ -961,11 +975,11 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const ICommand
}
default:
{
rootmenu->ConsolePrint("[SM] Displaying %d extensions:", m_Libs.size());
rootmenu->ConsolePrint("[SM] Displaying %d extensions:", required.size());
break;
}
}
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
for (iter = required.begin(); iter != required.end(); iter++,num++)
{
pExt = (*iter);
if (pExt->IsLoaded())
@ -984,14 +998,32 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const ICommand
rootmenu->ConsolePrint("[%02d] %s (%s): %s", num, name, version, descr);
}
}
else if (pExt->IsRequired())
else
{
rootmenu->ConsolePrint("[%02d] <FAILED> file \"%s\": %s", num, pExt->GetFilename(), pExt->m_Error.c_str());
}
if (pExt->IsLoaded() || pExt->IsRequired())
}
if (optional.size())
{
num++;
num = 1;
switch (optional.size())
{
case 1:
{
rootmenu->ConsolePrint("\n[SM] Displaying 1 optional extension not found:");
break;
}
default:
{
rootmenu->ConsolePrint("\n[SM] Displaying %d optional extensions not found:", optional.size());
break;
}
}
for (iter = optional.begin(); iter != optional.end(); iter++,num++)
{
pExt = (*iter);
rootmenu->ConsolePrint("[%02d] \"%s\"", num, pExt->GetFilename());
}
}
return;