[8250] Cleanup code and data for spell_threat Author: nos4r2zod

* Load table data to std::map instead SQLStorage and add check loaded spell existance.
    * Drop from table not existed spells.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-07-30 11:37:08 +08:00
parent 7121d98480
commit af2d5e3fd4
7 changed files with 61 additions and 32 deletions
+11 -2
View File
@@ -40,8 +40,6 @@ class Player;
class Spell;
struct SpellModifier;
extern SQLStorage sSpellThreatStore;
// only used in code
enum SpellCategories
{
@@ -527,6 +525,7 @@ typedef UNORDERED_MAP<uint32, SpellBonusEntry> SpellBonusMap;
typedef std::map<uint32, uint8> SpellElixirMap;
typedef std::map<uint32, float> SpellProcItemEnchantMap;
typedef std::map<uint32, uint16> SpellThreatMap;
// Spell script target related declarations (accessed using SpellMgr functions)
enum SpellScriptTargetType
@@ -764,6 +763,15 @@ class SpellMgr
return SPELL_NORMAL;
}
uint16 GetSpellThreat(uint32 spellid) const
{
SpellThreatMap::const_iterator itr = mSpellThreatMap.find(spellid);
if(itr==mSpellThreatMap.end())
return 0;
return itr->second;
}
// Spell proc events
SpellProcEventEntry const* GetSpellProcEvent(uint32 spellId) const
{
@@ -1081,6 +1089,7 @@ class SpellMgr
SpellLearnSpellMap mSpellLearnSpells;
SpellTargetPositionMap mSpellTargetPositions;
SpellElixirMap mSpellElixirs;
SpellThreatMap mSpellThreatMap;
SpellProcEventMap mSpellProcEventMap;
SpellProcItemEnchantMap mSpellProcItemEnchantMap;
SpellBonusMap mSpellBonusMap;