[8026] Obtain object's map directly by calling appropriate WorldObject::GetMap()/GetBaseMap() functions instead of accessing MapManager. Code cleanups. Big thanks Infinity for tests. Author: Ambal
--HG-- branch : trunk
This commit is contained in:
+13
-12
@@ -111,16 +111,18 @@ typedef UNORDERED_MAP<Player*, UpdateData> UpdateDataMapType;
|
||||
struct WorldLocation
|
||||
{
|
||||
uint32 mapid;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float o;
|
||||
float coord_x;
|
||||
float coord_y;
|
||||
float coord_z;
|
||||
float orientation;
|
||||
explicit WorldLocation(uint32 _mapid = 0, float _x = 0, float _y = 0, float _z = 0, float _o = 0)
|
||||
: mapid(_mapid), x(_x), y(_y), z(_z), o(_o) {}
|
||||
: mapid(_mapid), coord_x(_x), coord_y(_y), coord_z(_z), orientation(_o) {}
|
||||
WorldLocation(WorldLocation const &loc)
|
||||
: mapid(loc.mapid), x(loc.x), y(loc.y), z(loc.z), o(loc.o) {}
|
||||
: mapid(loc.mapid), coord_x(loc.coord_x), coord_y(loc.coord_y), coord_z(loc.coord_z), orientation(loc.orientation) {}
|
||||
};
|
||||
|
||||
typedef float Position[4];
|
||||
|
||||
class TRINITY_DLL_SPEC Object
|
||||
{
|
||||
public:
|
||||
@@ -394,11 +396,8 @@ class TRINITY_DLL_SPEC WorldObject : public Object
|
||||
m_positionZ = z;
|
||||
}
|
||||
|
||||
void Relocate(WorldLocation const & loc)
|
||||
{
|
||||
SetMapId(loc.mapid);
|
||||
Relocate(loc.x, loc.y, loc.z, loc.o);
|
||||
}
|
||||
void Relocate(Position pos)
|
||||
{ m_positionX = pos[0]; m_positionY = pos[1]; m_positionZ = pos[2]; m_orientation = pos[3]; }
|
||||
|
||||
void SetOrientation(float orientation) { m_orientation = orientation; }
|
||||
|
||||
@@ -408,7 +407,9 @@ class TRINITY_DLL_SPEC WorldObject : public Object
|
||||
void GetPosition( float &x, float &y, float &z ) const
|
||||
{ x = m_positionX; y = m_positionY; z = m_positionZ; }
|
||||
void GetPosition( WorldLocation &loc ) const
|
||||
{ loc.mapid = GetMapId(); GetPosition(loc.x, loc.y, loc.z); loc.o = GetOrientation(); }
|
||||
{ loc.mapid = m_mapId; GetPosition(loc.coord_x, loc.coord_y, loc.coord_z); loc.orientation = GetOrientation(); }
|
||||
void GetPosition(Position pos) const
|
||||
{ pos[0] = m_positionX; pos[1] = m_positionY; pos[2] = m_positionZ; pos[3] = m_orientation; }
|
||||
float GetOrientation( ) const { return m_orientation; }
|
||||
void GetNearPoint2D( float &x, float &y, float distance, float absAngle) const;
|
||||
void GetNearPoint( WorldObject const* searcher, float &x, float &y, float &z, float searcher_size, float distance2d,float absAngle) const;
|
||||
|
||||
Reference in New Issue
Block a user