From c87afde1bda52bbc7b3e0b2a71751799b1825971 Mon Sep 17 00:00:00 2001 From: Ruben Gonzalez Date: Thu, 30 Nov 2017 14:21:19 -0500 Subject: [PATCH] Add optional extensions not found to sm exts list in a seperate list. --- core/logic/ExtensionSys.cpp | 46 +++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/core/logic/ExtensionSys.cpp b/core/logic/ExtensionSys.cpp index 5fba8873..75a46383 100644 --- a/core/logic/ExtensionSys.cpp +++ b/core/logic/ExtensionSys.cpp @@ -947,7 +947,21 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const ICommand List::iterator iter; CExtension *pExt; unsigned int num = 1; - switch (m_Libs.size()) + + List required; // List of loaded and required extensions + List 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] file \"%s\": %s", num, pExt->GetFilename(), pExt->m_Error.c_str()); } - - if (pExt->IsLoaded() || pExt->IsRequired()) + } + if (optional.size()) + { + num = 1; + switch (optional.size()) { - num++; + 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;