Core: header cleanup, split realmlist, boost compatibility, cotire, remove stormlib/zlib and stormlib/bzip2 and instead use dep sources
This commit is contained in:
1 parent
7fff6c424f
commit
5ff847159c
1243 files changed
+29780
-36517
No files matched your search
@@ -18,21 +18,12 @@
|
||||
#include "Position.h"
|
||||
#include "ByteBuffer.h"
|
||||
#include "GridDefines.h"
|
||||
#include "Random.h"
|
||||
|
||||
#include <G3D/g3dmath.h>
|
||||
#include <G3D/Vector3.h>
|
||||
#include <sstream>
|
||||
|
||||
Position::Position(G3D::Vector3 const& vect)
|
||||
{
|
||||
Relocate(vect.x, vect.y, vect.z, 0.f);
|
||||
}
|
||||
|
||||
Position::operator G3D::Vector3() const
|
||||
{
|
||||
return { m_positionX, m_positionY, m_positionZ };
|
||||
}
|
||||
|
||||
bool Position::operator==(Position const &a)
|
||||
bool Position::operator==(Position const& a)
|
||||
{
|
||||
return (G3D::fuzzyEq(a.m_positionX, m_positionX) &&
|
||||
G3D::fuzzyEq(a.m_positionY, m_positionY) &&
|
||||
@@ -40,7 +31,7 @@ bool Position::operator==(Position const &a)
|
||||
G3D::fuzzyEq(a.m_orientation, m_orientation));
|
||||
}
|
||||
|
||||
void Position::RelocateOffset(const Position & offset)
|
||||
void Position::RelocateOffset(Position const& offset)
|
||||
{
|
||||
m_positionX = GetPositionX() + (offset.GetPositionX() * std::cos(GetOrientation()) + offset.GetPositionY() * std::sin(GetOrientation() + float(M_PI)));
|
||||
m_positionY = GetPositionY() + (offset.GetPositionY() * std::cos(GetOrientation()) + offset.GetPositionX() * std::sin(GetOrientation()));
|
||||
@@ -53,7 +44,27 @@ bool Position::IsPositionValid() const
|
||||
return Trinity::IsValidMapCoord(m_positionX, m_positionY, m_positionZ, m_orientation);
|
||||
}
|
||||
|
||||
void Position::GetPositionOffsetTo(const Position & endPos, Position & retOffset) const
|
||||
float Position::GetExactDist2d(float x, float y) const
|
||||
{
|
||||
return std::sqrt(GetExactDist2dSq(x, y));
|
||||
}
|
||||
|
||||
float Position::GetExactDist2d(Position const* pos) const
|
||||
{
|
||||
return std::sqrt(GetExactDist2dSq(pos));
|
||||
}
|
||||
|
||||
float Position::GetExactDist(float x, float y, float z) const
|
||||
{
|
||||
return std::sqrt(GetExactDistSq(x, y, z));
|
||||
}
|
||||
|
||||
float Position::GetExactDist(Position const* pos) const
|
||||
{
|
||||
return std::sqrt(GetExactDistSq(pos));
|
||||
}
|
||||
|
||||
void Position::GetPositionOffsetTo(Position const& endPos, Position& retOffset) const
|
||||
{
|
||||
float dx = endPos.GetPositionX() - GetPositionX();
|
||||
float dy = endPos.GetPositionY() - GetPositionY();
|
||||
@@ -175,14 +186,28 @@ std::string Position::ToString() const
|
||||
return sstr.str();
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYStreamer const& streamer)
|
||||
float Position::NormalizeOrientation(float o)
|
||||
{
|
||||
// fmod only supports positive numbers. Thus we have
|
||||
// to emulate negative numbers
|
||||
if (o < 0)
|
||||
{
|
||||
float mod = o * -1;
|
||||
mod = std::fmod(mod, 2.0f * static_cast<float>(M_PI));
|
||||
mod = -mod + 2.0f * static_cast<float>(M_PI);
|
||||
return mod;
|
||||
}
|
||||
return std::fmod(o, 2.0f * static_cast<float>(M_PI));
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& buf, Position::ConstStreamer<Position::XY> const& streamer)
|
||||
{
|
||||
buf << streamer.Pos->GetPositionX();
|
||||
buf << streamer.Pos->GetPositionY();
|
||||
return buf;
|
||||
}
|
||||
|
||||
ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYStreamer const& streamer)
|
||||
ByteBuffer& operator>>(ByteBuffer& buf, Position::Streamer<Position::XY> const& streamer)
|
||||
{
|
||||
float x, y;
|
||||
buf >> x >> y;
|
||||
@@ -190,7 +215,7 @@ ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYStreamer const& stre
|
||||
return buf;
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZStreamer const& streamer)
|
||||
ByteBuffer& operator<<(ByteBuffer& buf, Position::ConstStreamer<Position::XYZ> const& streamer)
|
||||
{
|
||||
buf << streamer.Pos->GetPositionX();
|
||||
buf << streamer.Pos->GetPositionY();
|
||||
@@ -198,7 +223,7 @@ ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZStreamer const& str
|
||||
return buf;
|
||||
}
|
||||
|
||||
ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYZStreamer const& streamer)
|
||||
ByteBuffer& operator>>(ByteBuffer& buf, Position::Streamer<Position::XYZ> const& streamer)
|
||||
{
|
||||
float x, y, z;
|
||||
buf >> x >> y >> z;
|
||||
@@ -206,7 +231,7 @@ ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYZStreamer const& str
|
||||
return buf;
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const& streamer)
|
||||
ByteBuffer& operator<<(ByteBuffer& buf, Position::ConstStreamer<Position::XYZO> const& streamer)
|
||||
{
|
||||
buf << streamer.Pos->GetPositionX();
|
||||
buf << streamer.Pos->GetPositionY();
|
||||
@@ -215,10 +240,16 @@ ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const& st
|
||||
return buf;
|
||||
}
|
||||
|
||||
ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYZOStreamer const& streamer)
|
||||
ByteBuffer& operator>>(ByteBuffer& buf, Position::Streamer<Position::XYZO> const& streamer)
|
||||
{
|
||||
float x, y, z, o;
|
||||
buf >> x >> y >> z >> o;
|
||||
streamer.Pos->Relocate(x, y, z, o);
|
||||
return buf;
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& buf, Position::ConstStreamer<Position::PackedXYZ> const& streamer)
|
||||
{
|
||||
buf.appendPackXYZ(streamer.Pos->GetPositionX(), streamer.Pos->GetPositionY(), streamer.Pos->GetPositionZ());
|
||||
return buf;
|
||||
}
|
||||
Reference in new issue
Block a user