mirror of
https://github.com/edubart/otclient.git
synced 2025-10-17 04:53:27 +02:00
some chat functionality
This commit is contained in:
@@ -39,7 +39,7 @@ void Module::discover(const OTMLNodePtr& moduleNode)
|
||||
m_website = moduleNode->valueAt("website", none);
|
||||
m_version = moduleNode->valueAt("version", none);
|
||||
m_autoLoad = moduleNode->valueAt<bool>("autoLoad", false);
|
||||
m_autoLoadPriority = moduleNode->valueAt<int>("autoLoadPriority", 100);
|
||||
m_autoLoadAntecedence = moduleNode->valueAt<int>("autoLoadAntecedence", 100);
|
||||
|
||||
if(OTMLNodePtr node = moduleNode->get("dependencies")) {
|
||||
for(const OTMLNodePtr& tmp : node->children())
|
||||
|
@@ -44,12 +44,12 @@ public:
|
||||
std::string getWebsite() { return m_website; }
|
||||
std::string getVersion() { return m_version; }
|
||||
bool isAutoLoad() { return m_autoLoad; }
|
||||
int getAutoLoadPriority() { return m_autoLoadPriority; }
|
||||
int getAutoLoadAntecedence() { return m_autoLoadAntecedence; }
|
||||
|
||||
private:
|
||||
Boolean<false> m_loaded;
|
||||
Boolean<false> m_autoLoad;
|
||||
int m_autoLoadPriority;
|
||||
int m_autoLoadAntecedence;
|
||||
std::string m_name;
|
||||
std::string m_description;
|
||||
std::string m_author;
|
||||
|
@@ -37,17 +37,17 @@ void ModuleManager::discoverModules()
|
||||
if(boost::ends_with(moduleFile, ".otmod")) {
|
||||
ModulePtr module = discoverModule("/" + moduleDir + "/" + moduleFile);
|
||||
if(module && module->isAutoLoad())
|
||||
m_autoLoadModules.insert(make_pair(module->getAutoLoadPriority(), module));
|
||||
m_autoLoadModules.insert(make_pair(module->getAutoLoadAntecedence(), module));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ModuleManager::autoLoadModules(int maxPriority)
|
||||
void ModuleManager::autoLoadModules(int maxAntecedence)
|
||||
{
|
||||
for(auto& pair : m_autoLoadModules) {
|
||||
int priority = pair.first;
|
||||
if(priority > maxPriority)
|
||||
if(priority > maxAntecedence)
|
||||
break;
|
||||
ModulePtr module = pair.second;
|
||||
if(!module->isLoaded() && !module->load())
|
||||
|
@@ -30,7 +30,7 @@ class ModuleManager
|
||||
public:
|
||||
void discoverModulesPath();
|
||||
void discoverModules();
|
||||
void autoLoadModules(int maxPriority);
|
||||
void autoLoadModules(int maxAntecedence);
|
||||
ModulePtr discoverModule(const std::string& moduleFile);
|
||||
void ensureModuleLoaded(const std::string& moduleName);
|
||||
void unloadModules();
|
||||
|
Reference in New Issue
Block a user