diff options
Diffstat (limited to 'src')
17 files changed, 86 insertions, 51 deletions
diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index 388c55d7017..acd07fb34c8 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -18,6 +18,7 @@ #ifndef BATTLEFIELD_H_ #define BATTLEFIELD_H_ +#include "ObjectDefines.h" #include "SharedDefines.h" #include "ZoneScript.h" #include "Packets/WorldStatePackets.h" diff --git a/src/server/game/DungeonFinding/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp index 4e90b1faefc..03eabe6a408 100644 --- a/src/server/game/DungeonFinding/LFGQueue.cpp +++ b/src/server/game/DungeonFinding/LFGQueue.cpp @@ -21,6 +21,7 @@ #include "LFGQueue.h" #include "LFGMgr.h" #include "Log.h" +#include <sstream> namespace lfg { diff --git a/src/server/game/Entities/AreaTrigger/AreaTrigger.h b/src/server/game/Entities/AreaTrigger/AreaTrigger.h index 980c57feb72..77ee3eb9349 100644 --- a/src/server/game/Entities/AreaTrigger/AreaTrigger.h +++ b/src/server/game/Entities/AreaTrigger/AreaTrigger.h @@ -21,6 +21,7 @@ #include "Object.h" #include "Position.h" #include "Spline.h" +#include "MapObject.h" class AreaTriggerTemplate; class AreaTriggerMiscTemplate; diff --git a/src/server/game/Entities/Conversation/Conversation.cpp b/src/server/game/Entities/Conversation/Conversation.cpp index 8e422937d57..1941989bed3 100644 --- a/src/server/game/Entities/Conversation/Conversation.cpp +++ b/src/server/game/Entities/Conversation/Conversation.cpp @@ -16,6 +16,7 @@ */ #include "Conversation.h" +#include "Map.h" #include "Unit.h" #include "UpdateData.h" diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 5a8275c2c7c..5dd98eb1762 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1877,7 +1877,7 @@ bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo) const bool Creature::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const { - SpellEffectInfo const* effect = spellInfo->GetEffect(this, index); + SpellEffectInfo const* effect = spellInfo->GetEffect(GetMap()->GetDifficultyID(), index); if (!effect) return true; if (GetCreatureTemplate()->MechanicImmuneMask & (1 << (effect->Mechanic - 1))) diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 94ef4c532d6..827ffbffd28 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -25,7 +25,7 @@ #include "ItemTemplate.h" #include "LootMgr.h" #include "DatabaseEnv.h" -#include "Cell.h" +#include "MapObject.h" #include <list> diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.h b/src/server/game/Entities/DynamicObject/DynamicObject.h index 1c3cfe97d8d..aa3af92ed31 100644 --- a/src/server/game/Entities/DynamicObject/DynamicObject.h +++ b/src/server/game/Entities/DynamicObject/DynamicObject.h @@ -20,6 +20,7 @@ #define TRINITYCORE_DYNAMICOBJECT_H #include "Object.h" +#include "MapObject.h" class Unit; class Aura; diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index fe4fcd08cad..3a24e704ad3 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -25,6 +25,7 @@ #include "Object.h" #include "LootMgr.h" #include "DatabaseEnv.h" +#include "MapObject.h" #include <G3D/Quat.h> class GameObjectAI; diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 2cf698f9e28..bc332f74ce9 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -20,15 +20,15 @@ #define _OBJECT_H #include "Common.h" -#include "Position.h" #include "GridReference.h" -#include "ObjectDefines.h" -#include "Map.h" +#include "GridRefManager.h" +#include "ObjectGuid.h" +#include "Position.h" +#include "SharedDefines.h" #include "UpdateFields.h" - +#include <list> #include <set> -#include <string> -#include <sstream> +#include <unordered_map> #define CONTACT_DISTANCE 0.5f #define INTERACTION_DISTANCE 5.0f @@ -487,7 +487,7 @@ class FlaggedValuesArray32 public: FlaggedValuesArray32() { - memset(&m_values, 0x00, sizeof(T_VALUES) * ARRAY_SIZE); + memset(&m_values[0], 0x00, sizeof(T_VALUES) * ARRAY_SIZE); m_flags = 0; } @@ -505,38 +505,6 @@ class FlaggedValuesArray32 T_FLAGS m_flags; }; -enum MapObjectCellMoveState -{ - MAP_OBJECT_CELL_MOVE_NONE, //not in move list - MAP_OBJECT_CELL_MOVE_ACTIVE, //in move list - MAP_OBJECT_CELL_MOVE_INACTIVE, //in move list but should not move -}; - -class TC_GAME_API MapObject -{ - friend class Map; //map for moving creatures - friend class ObjectGridLoader; //grid loader for loading creatures - - protected: - MapObject() : _moveState(MAP_OBJECT_CELL_MOVE_NONE) - { - _newPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f); - } - - private: - Cell _currentCell; - Cell const& GetCurrentCell() const { return _currentCell; } - void SetCurrentCell(Cell const& cell) { _currentCell = cell; } - - MapObjectCellMoveState _moveState; - Position _newPosition; - void SetNewCellPosition(float x, float y, float z, float o) - { - _moveState = MAP_OBJECT_CELL_MOVE_ACTIVE; - _newPosition.Relocate(x, y, z, o); - } -}; - class TC_GAME_API WorldObject : public Object, public WorldLocation { protected: @@ -719,6 +687,7 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation float GetTransOffsetY() const { return m_movementInfo.transport.pos.GetPositionY(); } float GetTransOffsetZ() const { return m_movementInfo.transport.pos.GetPositionZ(); } float GetTransOffsetO() const { return m_movementInfo.transport.pos.GetOrientation(); } + Position const& GetTransOffset() const { return m_movementInfo.transport.pos; } uint32 GetTransTime() const { return m_movementInfo.transport.time; } int8 GetTransSeat() const { return m_movementInfo.transport.seat; } virtual ObjectGuid GetTransGUID() const; diff --git a/src/server/game/Entities/Object/ObjectDefines.h b/src/server/game/Entities/Object/ObjectDefines.h index 8c2735502b4..dfe2a7c6ec5 100644 --- a/src/server/game/Entities/Object/ObjectDefines.h +++ b/src/server/game/Entities/Object/ObjectDefines.h @@ -20,7 +20,6 @@ #define TRINITY_OBJECTDEFINES_H #include "Define.h" -#include "ObjectGuid.h" // used for creating values for respawn for example inline uint64 MAKE_PAIR64(uint32 l, uint32 h); diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 56aa484c6d5..27538d85466 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -28,6 +28,8 @@ #include "SpellAuraDefines.h" #include "ThreatManager.h" #include "MoveSplineInit.h" +#include "Timer.h" +#include "Util.h" #include <boost/container/flat_set.hpp> #define WORLD_TRIGGER 12999 diff --git a/src/server/game/Maps/MapObject.h b/src/server/game/Maps/MapObject.h new file mode 100644 index 00000000000..22e920994c8 --- /dev/null +++ b/src/server/game/Maps/MapObject.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef MapObject_h__ +#define MapObject_h__ + +#include "Define.h" +#include "Cell.h" +#include "Position.h" + +class Map; +class ObjectGridLoader; + +enum MapObjectCellMoveState +{ + MAP_OBJECT_CELL_MOVE_NONE, //not in move list + MAP_OBJECT_CELL_MOVE_ACTIVE, //in move list + MAP_OBJECT_CELL_MOVE_INACTIVE, //in move list but should not move +}; + +class TC_GAME_API MapObject +{ + friend class Map; //map for moving creatures + friend class ObjectGridLoader; //grid loader for loading creatures + +protected: + MapObject() : _moveState(MAP_OBJECT_CELL_MOVE_NONE) + { + _newPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f); + } + +private: + Cell _currentCell; + Cell const& GetCurrentCell() const { return _currentCell; } + void SetCurrentCell(Cell const& cell) { _currentCell = cell; } + + MapObjectCellMoveState _moveState; + Position _newPosition; + void SetNewCellPosition(float x, float y, float z, float o) + { + _moveState = MAP_OBJECT_CELL_MOVE_ACTIVE; + _newPosition.Relocate(x, y, z, o); + } +}; + +#endif // MapObject_h__ diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index bef98d77775..04947bdf365 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -3357,18 +3357,18 @@ bool SpellInfo::_IsPositiveTarget(uint32 targetA, uint32 targetB) void SpellInfo::_UnloadImplicitTargetConditionLists() { // find the same instances of ConditionList and delete them. - for (uint32 d = 0; d < MAX_DIFFICULTY; ++d) + for (auto itr = _effects.begin(); itr != _effects.end(); ++itr) { - for (uint32 i = 0; i < _effects.size(); ++i) + for (uint32 i = 0; i < itr->second.size(); ++i) { - if (SpellEffectInfo const* effect = GetEffect(d, i)) + if (SpellEffectInfo const* effect = itr->second[i]) { ConditionContainer* cur = effect->ImplicitTargetConditions; if (!cur) continue; - for (uint8 j = i; j < _effects.size(); ++j) + for (uint8 j = i; j < itr->second.size(); ++j) { - if (SpellEffectInfo const* eff = GetEffect(d, j)) + if (SpellEffectInfo const* eff = itr->second[j]) { if (eff->ImplicitTargetConditions == cur) const_cast<SpellEffectInfo*>(eff)->ImplicitTargetConditions = NULL; diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index 2a7a95957cb..752cd908eea 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -550,7 +550,6 @@ public: SpellEffectInfoVector GetEffectsForDifficulty(uint32 difficulty) const; SpellEffectInfo const* GetEffect(uint32 difficulty, uint32 index) const; SpellEffectInfo const* GetEffect(uint32 index) const { return GetEffect(DIFFICULTY_NONE, index); } - SpellEffectInfo const* GetEffect(WorldObject const* obj, uint32 index) const { return GetEffect(obj->GetMap()->GetDifficultyID(), index); } SpellEffectInfoMap _effects; SpellVisualMap _visuals; diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp index fd07ec6ab53..0aa63f2811b 100644 --- a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp +++ b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp @@ -389,7 +389,7 @@ public: { CustomSpellValues values; values.AddSpellMod(SPELLVALUE_BASE_POINT0, aurEff->GetAmount()); - caster->CastCustomSpell(GetSpellInfo()->GetEffect(caster, EFFECT_0)->TriggerSpell, values, GetTarget()); + caster->CastCustomSpell(GetSpellInfo()->GetEffect(caster->GetMap()->GetDifficultyID(), EFFECT_0)->TriggerSpell, values, GetTarget()); } } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp index cbb39387347..262e36f17e0 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp @@ -585,7 +585,7 @@ class spell_marrowgar_coldflame_damage : public SpellScriptLoader if (target->HasAura(SPELL_IMPALED)) return false; - if (target->GetExactDist2d(GetOwner()) > GetSpellInfo()->GetEffect(target, EFFECT_0)->CalcRadius()) + if (target->GetExactDist2d(GetOwner()) > GetSpellInfo()->GetEffect(target->GetMap()->GetDifficultyID(), EFFECT_0)->CalcRadius()) return false; if (Aura* aur = target->GetAura(GetId())) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 5ccb7431db6..ffe1fa0c8b3 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -1554,7 +1554,7 @@ class spell_frostwarden_handler_focus_fire : public SpellScriptLoader PreventDefaultAction(); if (Unit* caster = GetCaster()) { - caster->AddThreat(GetTarget(), -float(GetSpellInfo()->GetEffect(caster, EFFECT_1)->CalcValue())); + caster->AddThreat(GetTarget(), -float(GetSpellInfo()->GetEffect(caster->GetMap()->GetDifficultyID(), EFFECT_1)->CalcValue())); caster->GetAI()->SetData(DATA_WHELP_MARKER, 0); } } |