Some build errors fixed

Some build errors fixed
This commit is contained in:
Charles A Edwards 2016-01-30 16:31:19 +00:00 committed by Antz
parent 85cd456287
commit 3abc31c429
7 changed files with 107 additions and 5 deletions

View file

@ -829,6 +829,14 @@ void Object::SetUInt32Value(uint16 index, uint32 value)
} }
} }
void Object::UpdateUInt32Value(uint16 index, uint32 value)
{
MANGOS_ASSERT(index < m_valuesCount || PrintIndexError(index, true));
m_uint32Values[index] = value;
m_changedValues[index] = true;
}
void Object::SetUInt64Value(uint16 index, const uint64& value) void Object::SetUInt64Value(uint16 index, const uint64& value)
{ {
MANGOS_ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, true)); MANGOS_ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, true));
@ -1757,6 +1765,28 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa
return pCreature; return pCreature;
} }
GameObject* WorldObject::SummonGameObject(uint32 id, float x, float y, float z, float angle, uint32 despwtime)
{
GameObject* pGameObj = new GameObject;
Map *map = GetMap();
if (!map)
return NULL;
if (!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), id, map, x, y, z, angle))
{
delete pGameObj;
return NULL;
}
pGameObj->SetRespawnTime(despwtime / IN_MILLISECONDS);
map->Add(pGameObj);
return pGameObj;
}
// how much space should be left in front of/ behind a mob that already uses a space // how much space should be left in front of/ behind a mob that already uses a space
#define OCCUPY_POS_DEPTH_FACTOR 1.8f #define OCCUPY_POS_DEPTH_FACTOR 1.8f

View file

@ -243,7 +243,8 @@ class Object
DynamicObject const* ToDynObject() const { if (GetTypeId() == TYPEID_DYNAMICOBJECT) return reinterpret_cast<DynamicObject const*>(this); else return NULL; } DynamicObject const* ToDynObject() const { if (GetTypeId() == TYPEID_DYNAMICOBJECT) return reinterpret_cast<DynamicObject const*>(this); else return NULL; }
void SetInt32Value(uint16 index, int32 value); void SetInt32Value(uint16 index, int32 value);
void SetUInt32Value(uint16 index, uint32 value); void SetUInt32Value(uint16 index, uint32 value);
void UpdateUInt32Value(uint16 index, uint32 value);
void SetUInt64Value(uint16 index, const uint64& value); void SetUInt64Value(uint16 index, const uint64& value);
void SetFloatValue(uint16 index, float value); void SetFloatValue(uint16 index, float value);
void SetByteValue(uint16 index, uint8 offset, uint8 value); void SetByteValue(uint16 index, uint8 offset, uint8 value);
@ -634,6 +635,7 @@ class WorldObject : public Object
void BuildUpdateData(UpdateDataMapType&) override; void BuildUpdateData(UpdateDataMapType&) override;
Creature* SummonCreature(uint32 id, float x, float y, float z, float ang, TempSummonType spwtype, uint32 despwtime, bool asActiveObject = false); Creature* SummonCreature(uint32 id, float x, float y, float z, float ang, TempSummonType spwtype, uint32 despwtime, bool asActiveObject = false);
GameObject* SummonGameObject(uint32 id, float x, float y, float z, float angle, uint32 despwtime);
bool isActiveObject() const { return m_isActiveObject || m_viewPoint.hasViewers(); } bool isActiveObject() const { return m_isActiveObject || m_viewPoint.hasViewers(); }
void SetActiveObjectState(bool active); void SetActiveObjectState(bool active);

View file

@ -1064,6 +1064,12 @@ class ObjectMgr
bool RemoveVendorItem(uint32 entry, uint32 item, uint8 type); bool RemoveVendorItem(uint32 entry, uint32 item, uint8 type);
bool IsVendorItemValid(bool isTemplate, char const* tableName, uint32 vendor_entry, uint32 item, uint8 type, uint32 maxcount, uint32 ptime, uint32 ExtendedCost, uint16 conditionId, Player* pl = NULL, std::set<uint32>* skip_vendors = NULL) const; bool IsVendorItemValid(bool isTemplate, char const* tableName, uint32 vendor_entry, uint32 item, uint8 type, uint32 maxcount, uint32 ptime, uint32 ExtendedCost, uint16 conditionId, Player* pl = NULL, std::set<uint32>* skip_vendors = NULL) const;
static inline void GetLocaleString(const StringVector& data, int loc_idx, std::string& value)
{
if (data.size() > size_t(loc_idx) && !data[loc_idx].empty())
value = data[loc_idx];
}
int GetOrNewIndexForLocale(LocaleConstant loc); int GetOrNewIndexForLocale(LocaleConstant loc);
SpellClickInfoMapBounds GetSpellClickInfoMapBounds(uint32 creature_id) const SpellClickInfoMapBounds GetSpellClickInfoMapBounds(uint32 creature_id) const

View file

@ -7199,7 +7199,7 @@ bool Unit::IsSpellCrit(Unit* pVictim, SpellEntry const* spellProto, SpellSchoolM
if (spellProto->IsFitToFamilyMask(UI64LIT(0x0000000000000002)) && spellProto->SpellIconID == 12) if (spellProto->IsFitToFamilyMask(UI64LIT(0x0000000000000002)) && spellProto->SpellIconID == 12)
{ {
// Glyph of Fire Blast // Glyph of Fire Blast
if (pVictim->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED) || pVictim->isInRoots()) if (pVictim->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED) || pVictim->IsInRoots())
if (Aura* aura = GetAura(56369, EFFECT_INDEX_0)) if (Aura* aura = GetAura(56369, EFFECT_INDEX_0))
crit_chance += aura->GetModifier()->m_amount; crit_chance += aura->GetModifier()->m_amount;
} }

View file

@ -1681,6 +1681,9 @@ class Unit : public WorldObject
* \see GetUInt32Value * \see GetUInt32Value
*/ */
uint32 GetMaxHealth() const { return GetUInt32Value(UNIT_FIELD_MAXHEALTH); } uint32 GetMaxHealth() const { return GetUInt32Value(UNIT_FIELD_MAXHEALTH); }
bool IsFullHealth() const { return GetHealth() == GetMaxHealth(); }
/** /**
* Gets the percent of the health. The formula: (GetHealth() * 100) / GetMaxHealth() * Gets the percent of the health. The formula: (GetHealth() * 100) / GetMaxHealth()
* @return the current percent of the health * @return the current percent of the health
@ -2203,12 +2206,56 @@ class Unit : public WorldObject
} }
bool HasAuraOfDifficulty(uint32 spellId) const; bool HasAuraOfDifficulty(uint32 spellId) const;
/**
* This is overridden in \ref Player::HasSpell, \ref Creature::HasSpell and \ref Pet::HasSpell
* @return false in this implementation
*/
virtual bool HasSpell(uint32 /*spellID*/) const { return false; } virtual bool HasSpell(uint32 /*spellID*/) const { return false; }
/**
* Check is this \ref Unit has a stealth modified applied
* @return true if this \ref Unit has the \ref AuraType \ref AuraType::SPELL_AURA_MOD_STEALTH
* applied, false otherwise
* \see Modifier
* \see Unit::HasAuraType
* \see AuraType
*/
bool HasStealthAura() const { return HasAuraType(SPELL_AURA_MOD_STEALTH); } bool HasStealthAura() const { return HasAuraType(SPELL_AURA_MOD_STEALTH); }
/**
* Check if this \ref Unit has a invisibility \ref Aura modifier applied.
* @return true if this \ref Unit has the \ref AuraType
* \ref AuraType::SPELL_AURA_MOD_INVISIBILITY applied, false otherwise
* \see Modifier
* \see Unit::HasAuraType
* \see AuraType
*/
bool HasInvisibilityAura() const { return HasAuraType(SPELL_AURA_MOD_INVISIBILITY); } bool HasInvisibilityAura() const { return HasAuraType(SPELL_AURA_MOD_INVISIBILITY); }
/**
* Check if this \ref Unit has a fear \ref Aura modifier applied. Ie, is it feared?
* @return true if this \ref Unit has the \ref AuraType \ref AuraType::SPELL_AURA_MOD_FEAR
* applied, false otherwise
* \see Modifier
* \see Unit::HasAuraType
* \see AuraType
*/
bool isFeared() const { return HasAuraType(SPELL_AURA_MOD_FEAR); } bool isFeared() const { return HasAuraType(SPELL_AURA_MOD_FEAR); }
bool isInRoots() const { return HasAuraType(SPELL_AURA_MOD_ROOT); } /**
* Check if this \ref Unit has a rooting \ref Aura modifier applied. Ie, is it stuck in
* some way?
* @return true if this \ref Unit has the \ref AuraType \ref AuraType::SPELL_AURA_MOD_ROOT
* applied, false otherwise
* \see Modifier
* \see Unit::HasAuraType
* \see AuraType
*/
bool IsInRoots() const { return HasAuraType(SPELL_AURA_MOD_ROOT); }
/**
* Is this \ref Unit polymorphed?
* @return true if this \ref Unit is polymorphed, false otherwise
* \see GetSpellSpecific
* \see Unit::GetTransform
* \todo Move the implementation to .h file exactly as the earlier ones?
*/
bool IsPolymorphed() const; bool IsPolymorphed() const;
bool IsFrozen() const; bool IsFrozen() const;

View file

@ -221,6 +221,23 @@ namespace MaNGOS
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {} template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {}
}; };
template<class Check>
struct WorldObjectLastSearcher
{
WorldObject*& i_object;
Check& i_check;
WorldObjectLastSearcher(WorldObject* & result, Check& check) : i_object(result), i_check(check) {}
void Visit(PlayerMapType& m);
void Visit(CreatureMapType& m);
void Visit(CorpseMapType& m);
void Visit(GameObjectMapType& m);
void Visit(DynamicObjectMapType& m);
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
};
template<class Check> template<class Check>
struct WorldObjectListSearcher struct WorldObjectListSearcher
{ {

View file

@ -55,10 +55,10 @@ namespace LuaUnit
int IsRooted(Eluna* /*E*/, lua_State* L, Unit* unit) int IsRooted(Eluna* /*E*/, lua_State* L, Unit* unit)
{ {
#ifdef TRINITY #ifdef TRINITY
Eluna::Push(L, unit->isInRoots() || unit->HasUnitMovementFlag(MOVEMENTFLAG_ROOT)); Eluna::Push(L, unit->IsInRoots() || unit->HasUnitMovementFlag(MOVEMENTFLAG_ROOT));
#endif #endif
#ifdef CMANGOS #ifdef CMANGOS
Eluna::Push(L, unit->isInRoots() || unit->IsRooted()); Eluna::Push(L, unit->IsInRoots() || unit->IsRooted());
#endif #endif
#ifdef MANGOS #ifdef MANGOS
Eluna::Push(L, unit->IsInRoots() || unit->IsRooted()); Eluna::Push(L, unit->IsInRoots() || unit->IsRooted());