changed how the admin cache is rebuilt
renamed the plugin and fixed compilation errors --HG-- rename : plugins/admin-flatfile/admin-base.sp => plugins/admin-flatfile/admin-flatfile.sp extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40444
This commit is contained in:
+43
-29
@@ -35,11 +35,12 @@ AdminCache::AdminCache()
|
||||
|
||||
AdminCache::~AdminCache()
|
||||
{
|
||||
DumpAdminCache(AdminCache_Overrides, false);
|
||||
DumpAdminCache(AdminCache_Groups, false);
|
||||
|
||||
sm_trie_destroy(m_pCmdGrpOverrides);
|
||||
sm_trie_destroy(m_pCmdOverrides);
|
||||
|
||||
DumpAdminCache(0xFFFFFFFF, false);
|
||||
|
||||
if (m_pGroups)
|
||||
{
|
||||
sm_trie_destroy(m_pGroups);
|
||||
@@ -759,39 +760,52 @@ void AdminCache::InvalidateAdminCache(bool unlink_admins)
|
||||
}
|
||||
}
|
||||
|
||||
void AdminCache::DumpAdminCache(int cache_flags, bool rebuild)
|
||||
void AdminCache::DumpAdminCache(AdminCachePart part, bool rebuild)
|
||||
{
|
||||
if (cache_flags & ADMIN_CACHE_OVERRIDES)
|
||||
List<IAdminListener *>::iterator iter;
|
||||
IAdminListener *pListener;
|
||||
cell_t result;
|
||||
|
||||
if (part == AdminCache_Overrides)
|
||||
{
|
||||
DumpCommandOverrideCache(Override_Command);
|
||||
DumpCommandOverrideCache(Override_CommandGroup);
|
||||
}
|
||||
|
||||
/* This will auto-invalidate the admin cache */
|
||||
if (cache_flags & ADMIN_CACHE_GROUPS)
|
||||
{
|
||||
InvalidateGroupCache();
|
||||
}
|
||||
|
||||
/* If we only requested an admin rebuild, re-use the internal memory */
|
||||
if (((cache_flags & ADMIN_CACHE_ADMINS) == ADMIN_CACHE_ADMINS)
|
||||
&& ((cache_flags & (1<<2)) != (1<<2)))
|
||||
{
|
||||
InvalidateAdminCache(true);
|
||||
}
|
||||
|
||||
if (rebuild)
|
||||
{
|
||||
List<IAdminListener *>::iterator iter;
|
||||
IAdminListener *pListener;
|
||||
cell_t result;
|
||||
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
|
||||
if (rebuild)
|
||||
{
|
||||
pListener = (*iter);
|
||||
pListener->OnRebuildAdminCache(cache_flags);
|
||||
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
|
||||
{
|
||||
pListener = (*iter);
|
||||
pListener->OnRebuildOverrideCache();
|
||||
}
|
||||
m_pCacheFwd->PushCell(part);
|
||||
m_pCacheFwd->Execute(&result);
|
||||
}
|
||||
} else if (part == AdminCache_Groups || part == AdminCache_Admins) {
|
||||
if (part == AdminCache_Groups)
|
||||
{
|
||||
InvalidateGroupCache();
|
||||
if (rebuild)
|
||||
{
|
||||
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
|
||||
{
|
||||
pListener = (*iter);
|
||||
pListener->OnRebuildGroupCache();
|
||||
}
|
||||
m_pCacheFwd->PushCell(part);
|
||||
m_pCacheFwd->Execute(&result);
|
||||
}
|
||||
}
|
||||
InvalidateAdminCache(true);
|
||||
if (rebuild)
|
||||
{
|
||||
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
|
||||
{
|
||||
pListener = (*iter);
|
||||
pListener->OnRebuildAdminCache((part == AdminCache_Groups));
|
||||
}
|
||||
m_pCacheFwd->PushCell(AdminCache_Admins);
|
||||
m_pCacheFwd->Execute(&result);
|
||||
}
|
||||
m_pCacheFwd->PushCell(cache_flags);
|
||||
m_pCacheFwd->Execute(&result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -107,7 +107,7 @@ public: //IAdminSystem
|
||||
GroupId GetGroupImmunity(GroupId id, unsigned int number);
|
||||
void AddGroupCommandOverride(GroupId id, const char *name, OverrideType type, OverrideRule rule);
|
||||
bool GetGroupCommandOverride(GroupId id, const char *name, OverrideType type, OverrideRule *pRule);
|
||||
void DumpAdminCache(int cache_flags, bool rebuild);
|
||||
void DumpAdminCache(AdminCachePart part, bool rebuild);
|
||||
void AddAdminListener(IAdminListener *pListener);
|
||||
void RemoveAdminListener(IAdminListener *pListener);
|
||||
/** User stuff */
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
static cell_t DumpAdminCache(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
g_Admins.DumpAdminCache(params[1], (params[2] == 1) ? true : false);
|
||||
g_Admins.DumpAdminCache((AdminCachePart)params[1], (params[2] == 1) ? true : false);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -185,7 +185,8 @@ bool SourceModBase::LevelInit(char const *pMapName, char const *pMapEntities, ch
|
||||
|
||||
m_IsMapLoading = false;
|
||||
|
||||
g_Admins.DumpAdminCache(ADMIN_CACHE_GROUPS|ADMIN_CACHE_ADMINS|ADMIN_CACHE_OVERRIDES, true);
|
||||
g_Admins.DumpAdminCache(AdminCache_Overrides, true);
|
||||
g_Admins.DumpAdminCache(AdminCache_Groups, true);
|
||||
|
||||
RETURN_META_VALUE(MRES_IGNORED, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user