Exemple #1
0
bool PostOffice::AddMailbox(const char *name,
	os::Handler *handler, bool unique)
{
	bool		ret = true;
	Mailbox	*mb;

	Lock();

	if(!CheckUnique(name, unique))
		ret = false;

	if(ret) {
		mb = new Mailbox;
		if(mb) {
			mb->SetName(name);
			mb->SetHandler(handler);
			mb->SetUnique(unique);
			mb->Link(m_Head);
			m_Head = mb;

			if(!m_Locked) {
				m_Locked = true;
			//	m_InUse->Lock();

				#ifdef P_O_DEBUG
				cout << "PO: PostOffice is in use." << endl;
				#endif
			}

			#ifdef P_O_DEBUG
			cout << "PO: Added Mailbox: " << name << endl;
			#endif

			ret = false;
		}
	}

	Unlock();

	return ret;
}
void CharacterDatabaseCleaner::CleanCharacterTalent() {
	CharacterDatabase.DirectPExecute(
			"DELETE FROM character_talent WHERE spec > %u", MAX_TALENT_SPECS);
	CheckUnique("spell", "character_talent", &TalentCheck);
}
void CharacterDatabaseCleaner::CleanCharacterSpell() {
	CheckUnique("spell", "character_spell", &SpellCheck);
}
void CharacterDatabaseCleaner::CleanCharacterSkills() {
	CheckUnique("skill", "character_skills", &SkillCheck);
}
void CharacterDatabaseCleaner::CleanCharacterAchievementProgress() {
	CheckUnique("criteria", "character_achievement_progress",
			&AchievementProgressCheck);
}
void CharacterDatabaseCleaner::CleanCharacterTalent()
{
    CharacterDatabase.DirectPExecute("DELETE FROM character_talent WHERE spec > %u OR current_rank > %u", MAX_TALENT_SPEC_COUNT, MAX_TALENT_RANK);

    CheckUnique("talent_id", "character_talent", &TalentCheck);
}