From 302dc70eabb48d3375e6e4e2673cf366f651bf55 Mon Sep 17 00:00:00 2001 From: ApoC Date: Sat, 24 Jan 2009 18:41:35 +0100 Subject: [PATCH] [7162] Converted some uint16 spellid parameteres to uint32. It can provide little speedup. Signed-off-by: ApoC --- src/game/Pet.cpp | 18 +++++++++--------- src/game/Pet.h | 12 ++++++------ src/game/Player.cpp | 2 +- src/game/Player.h | 2 +- src/shared/revision_nr.h | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index b8182544f..c50b3f8dc 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -1087,7 +1087,7 @@ void Pet::_LoadSpells() { Field *fields = result->Fetch(); - addSpell(fields[0].GetUInt16(), fields[1].GetUInt16(), PETSPELL_UNCHANGED); + addSpell(fields[0].GetUInt32(), fields[1].GetUInt16(), PETSPELL_UNCHANGED); } while( result->NextRow() ); @@ -1240,7 +1240,7 @@ void Pet::_SaveAuras() } } -bool Pet::addSpell(uint16 spell_id, uint16 active, PetSpellState state, PetSpellType type) +bool Pet::addSpell(uint32 spell_id, uint16 active, PetSpellState state, PetSpellType type) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id); if (!spellInfo) @@ -1353,7 +1353,7 @@ bool Pet::addSpell(uint16 spell_id, uint16 active, PetSpellState state, PetSpell return true; } -bool Pet::learnSpell(uint16 spell_id) +bool Pet::learnSpell(uint32 spell_id) { // prevent duplicated entires in spell book if (!addSpell(spell_id)) @@ -1390,7 +1390,7 @@ void Pet::learnLevelupSpells() } } -bool Pet::unlearnSpell(uint16 spell_id) +bool Pet::unlearnSpell(uint32 spell_id) { if(removeSpell(spell_id)) { @@ -1408,7 +1408,7 @@ bool Pet::unlearnSpell(uint16 spell_id) return false; } -bool Pet::removeSpell(uint16 spell_id) +bool Pet::removeSpell(uint32 spell_id) { PetSpellMap::iterator itr = m_spells.find(spell_id); if (itr == m_spells.end()) @@ -1442,7 +1442,7 @@ bool Pet::removeSpell(uint16 spell_id) return true; } -bool Pet::_removeSpell(uint16 spell_id) +bool Pet::_removeSpell(uint32 spell_id) { PetSpellMap::iterator itr = m_spells.find(spell_id); if (itr != m_spells.end()) @@ -1459,7 +1459,7 @@ void Pet::InitPetCreateSpells() m_charmInfo->InitPetActionBar(); m_spells.clear(); - int32 petspellid; + uint32 petspellid; PetCreateSpellEntry const* CreateSpells = objmgr.GetPetCreateSpellEntry(GetEntry()); if(CreateSpells) { @@ -1654,7 +1654,7 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply) if(IsPassiveSpell(spellid)) return; - PetSpellMap::const_iterator itr = m_spells.find((uint16)spellid); + PetSpellMap::const_iterator itr = m_spells.find(spellid); int i; @@ -1708,7 +1708,7 @@ bool Pet::Create(uint32 guidlow, Map *map, uint32 Entry, uint32 pet_number) bool Pet::HasSpell(uint32 spell) const { - PetSpellMap::const_iterator itr = m_spells.find((uint16)spell); + PetSpellMap::const_iterator itr = m_spells.find(spell); return (itr != m_spells.end() && itr->second->state != PETSPELL_REMOVED ); } diff --git a/src/game/Pet.h b/src/game/Pet.h index f309bc518..8ca7aefa3 100644 --- a/src/game/Pet.h +++ b/src/game/Pet.h @@ -103,7 +103,7 @@ enum PetNameInvalidReason PET_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME = 16 }; -typedef UNORDERED_MAP PetSpellMap; +typedef UNORDERED_MAP PetSpellMap; typedef std::map TeachSpellMap; typedef std::vector AutoSpellList; @@ -188,12 +188,12 @@ class Pet : public Creature void _LoadSpells(); void _SaveSpells(); - bool addSpell(uint16 spell_id,uint16 active = ACT_DECIDE, PetSpellState state = PETSPELL_NEW, PetSpellType type = PETSPELL_NORMAL); - bool learnSpell(uint16 spell_id); + bool addSpell(uint32 spell_id,uint16 active = ACT_DECIDE, PetSpellState state = PETSPELL_NEW, PetSpellType type = PETSPELL_NORMAL); + bool learnSpell(uint32 spell_id); void learnLevelupSpells(); - bool unlearnSpell(uint16 spell_id); - bool removeSpell(uint16 spell_id); - bool _removeSpell(uint16 spell_id); + bool unlearnSpell(uint32 spell_id); + bool removeSpell(uint32 spell_id); + bool _removeSpell(uint32 spell_id); PetSpellMap m_spells; TeachSpellMap m_teachspells; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index ad447da2f..4d8d44267 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -3559,7 +3559,7 @@ void Player::DestroyForPlayer( Player *target ) const bool Player::HasSpell(uint32 spell) const { - PlayerSpellMap::const_iterator itr = m_spells.find((uint16)spell); + PlayerSpellMap::const_iterator itr = m_spells.find(spell); return (itr != m_spells.end() && itr->second->state != PLAYERSPELL_REMOVED && !itr->second->disabled); } diff --git a/src/game/Player.h b/src/game/Player.h index 91ec4f360..ff21d4ba7 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -104,7 +104,7 @@ struct SpellModifier Spell const* lastAffected; }; -typedef UNORDERED_MAP PlayerSpellMap; +typedef UNORDERED_MAP PlayerSpellMap; typedef std::list SpellModList; struct SpellCooldown diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index bd887b8ea..1011ba65c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7161" + #define REVISION_NR "7162" #endif // __REVISION_NR_H__