[9189] Fixed build error at *nix.

This commit is contained in:
VladimirMangos 2010-01-16 08:36:58 +03:00
parent 132b1cbabd
commit 6f703bab57
3 changed files with 25 additions and 8 deletions

View file

@ -8442,6 +8442,20 @@ Pet* Unit::FindGuardianWithEntry(uint32 entry)
return NULL; return NULL;
} }
Unit* Unit::_GetTotem(uint8 slot) const
{
return GetTotem(slot);
}
Totem* Unit::GetTotem( uint8 slot ) const
{
if(slot >= MAX_TOTEM)
return NULL;
Creature *totem = GetMap()->GetCreature(m_TotemSlot[slot]);
return totem->isTotem() ? (Totem*)totem : NULL;
}
void Unit::UnsummonAllTotems() void Unit::UnsummonAllTotems()
{ {
for (int8 i = 0; i < MAX_TOTEM; ++i) for (int8 i = 0; i < MAX_TOTEM; ++i)

View file

@ -299,6 +299,7 @@ class Item;
class Pet; class Pet;
class Path; class Path;
class PetAura; class PetAura;
class Totem;
struct SpellImmune struct SpellImmune
{ {
@ -1242,6 +1243,8 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
Pet* CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id = 0); Pet* CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id = 0);
Totem* GetTotem(uint8 slot) const;
template<typename Func> template<typename Func>
void CallForAllControlledUnits(Func const& func, bool withTotems, bool withGuardians, bool withCharms); void CallForAllControlledUnits(Func const& func, bool withTotems, bool withGuardians, bool withCharms);
template<typename Func> template<typename Func>
@ -1645,6 +1648,8 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
float GetCombatRatingReduction(CombatRating cr) const; float GetCombatRatingReduction(CombatRating cr) const;
uint32 GetCombatRatingDamageReduction(CombatRating cr, float rate, float cap, uint32 damage) const; uint32 GetCombatRatingDamageReduction(CombatRating cr, float rate, float cap, uint32 damage) const;
Unit* _GetTotem(uint8 slot) const; // for templated function without include need
uint32 m_state; // Even derived shouldn't modify uint32 m_state; // Even derived shouldn't modify
uint32 m_CombatTimer; uint32 m_CombatTimer;
@ -1681,9 +1686,8 @@ void Unit::CallForAllControlledUnits(Func const& func, bool withTotems, bool wit
if (withTotems) if (withTotems)
{ {
for (int8 i = 0; i < MAX_TOTEM; ++i) for (int8 i = 0; i < MAX_TOTEM; ++i)
if(m_TotemSlot[i]) if (Unit *totem = _GetTotem(i))
if(Creature *totem = GetMap()->GetCreature(m_TotemSlot[i])) func(totem);
func(totem);
} }
if (withCharms) if (withCharms)
@ -1711,10 +1715,9 @@ bool Unit::CheckAllControlledUnits(Func const& func, bool withTotems, bool withG
if (withTotems) if (withTotems)
{ {
for (int8 i = 0; i < MAX_TOTEM; ++i) for (int8 i = 0; i < MAX_TOTEM; ++i)
if (m_TotemSlot[i]) if (Unit *totem = _GetTotem(i))
if (Creature *totem = GetMap()->GetCreature(m_TotemSlot[i])) if (func(totem))
if (func(totem)) return true;
return true;
} }
if (withCharms) if (withCharms)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9188" #define REVISION_NR "9189"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__