Exemple #1
0
void AdminCache::InvalidateGroupCache()
{
	/* Nuke the free list */
	m_FreeGroupList = -1;

	/* Nuke reverse lookups */
	m_Groups.clear();

	/* Free memory on groups */
	GroupId cur = m_FirstGroup;
	AdminGroup *pGroup;
	while (cur != INVALID_GROUP_ID)
	{
		pGroup = (AdminGroup *)m_pMemory->GetAddress(cur);
		assert(pGroup->magic == GRP_MAGIC_SET);
		delete pGroup->pCmdGrpTable;
		delete pGroup->pCmdTable;
		cur = pGroup->next_grp;
	}

	m_FirstGroup = INVALID_GROUP_ID;
	m_LastGroup = INVALID_GROUP_ID;

	InvalidateAdminCache(false);

	/* Reset the memory table */
	m_pMemory->Reset();
}
Exemple #2
0
void AdminCache::DumpAdminCache(AdminCachePart part, bool rebuild)
{
	List<IAdminListener *>::iterator iter;
	IAdminListener *pListener;
	cell_t result;

	if (part == AdminCache_Overrides)
	{
		DumpCommandOverrideCache(Override_Command);
		DumpCommandOverrideCache(Override_CommandGroup);
		if (rebuild && !m_destroying)
		{
			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 && !m_destroying)
			{
				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 && !m_destroying)
		{
			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);
			g_Players.RecheckAnyAdmins();
		}
	}
}