mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Game: Include cleanup - remove Map dependency from Object.h
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#ifndef BATTLEFIELD_H_
|
||||
#define BATTLEFIELD_H_
|
||||
|
||||
#include "ObjectDefines.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "ZoneScript.h"
|
||||
#include "Packets/WorldStatePackets.h"
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "LFGQueue.h"
|
||||
#include "LFGMgr.h"
|
||||
#include "Log.h"
|
||||
#include <sstream>
|
||||
|
||||
namespace lfg
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "Object.h"
|
||||
#include "Position.h"
|
||||
#include "Spline.h"
|
||||
#include "MapObject.h"
|
||||
|
||||
class AreaTriggerTemplate;
|
||||
class AreaTriggerMiscTemplate;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "Conversation.h"
|
||||
#include "Map.h"
|
||||
#include "Unit.h"
|
||||
#include "UpdateData.h"
|
||||
|
||||
|
||||
@@ -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)))
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "ItemTemplate.h"
|
||||
#include "LootMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Cell.h"
|
||||
#include "MapObject.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#define TRINITYCORE_DYNAMICOBJECT_H
|
||||
|
||||
#include "Object.h"
|
||||
#include "MapObject.h"
|
||||
|
||||
class Unit;
|
||||
class Aura;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "Object.h"
|
||||
#include "LootMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "MapObject.h"
|
||||
#include <G3D/Quat.h>
|
||||
|
||||
class GameObjectAI;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
60
src/server/game/Maps/MapObject.h
Normal file
60
src/server/game/Maps/MapObject.h
Normal file
@@ -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__
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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()))
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user