return false;
}
-bool ModuleManager::Unload(Module* mod)
-{
- return false;
-}
-
namespace {
+ struct UnloadAction : public HandlerBase0<void>
+ {
+ Module* const mod;
+ UnloadAction(Module* m) : mod(m) {}
+ void Call()
+ {
+ ServerInstance->Modules->DoSafeUnload(mod);
+ ServerInstance->GlobalCulls.Apply();
+ ServerInstance->GlobalCulls.AddItem(this);
+ }
+ };
+
struct ReloadAction : public HandlerBase0<void>
{
Module* const mod;
};
}
+bool ModuleManager::Unload(Module* mod)
+{
+ if (!CanUnload(mod))
+ return false;
+ ServerInstance->AtomicActions.AddAction(new UnloadAction(mod));
+ return true;
+}
+
void ModuleManager::Reload(Module* mod, HandlerBase1<void, bool>* callback)
{
if (CanUnload(mod))
{
c = (*(**i).init)();
c->ModuleSourceFile = (**i).name;
+ c->ModuleDLLManager = NULL;
Modules[(**i).name] = c;
c->init();
FOREACH_MOD(I_OnLoadModule,OnLoadModule(c));