mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-06 04:45:32 +00:00
pass parameters as const &
This commit is contained in:
parent
7644a46ded
commit
21e249cb92
2 changed files with 6 additions and 6 deletions
|
@ -87,14 +87,14 @@ namespace
|
|||
|
||||
namespace MWMechanics
|
||||
{
|
||||
float sqrDistanceIgnoreZ(ESM::Pathgrid::Point point, float x, float y)
|
||||
float sqrDistanceIgnoreZ(const ESM::Pathgrid::Point& point, float x, float y)
|
||||
{
|
||||
x -= point.mX;
|
||||
y -= point.mY;
|
||||
return (x * x + y * y);
|
||||
}
|
||||
|
||||
float distance(ESM::Pathgrid::Point point, float x, float y, float z)
|
||||
float distance(const ESM::Pathgrid::Point& point, float x, float y, float z)
|
||||
{
|
||||
x -= point.mX;
|
||||
y -= point.mY;
|
||||
|
@ -102,7 +102,7 @@ namespace MWMechanics
|
|||
return sqrt(x * x + y * y + z * z);
|
||||
}
|
||||
|
||||
float distance(ESM::Pathgrid::Point a, ESM::Pathgrid::Point b)
|
||||
float distance(const ESM::Pathgrid::Point& a, const ESM::Pathgrid::Point& b)
|
||||
{
|
||||
float x = static_cast<float>(a.mX - b.mX);
|
||||
float y = static_cast<float>(a.mY - b.mY);
|
||||
|
@ -272,7 +272,7 @@ namespace MWMechanics
|
|||
if(mPath.empty())
|
||||
return true;
|
||||
|
||||
ESM::Pathgrid::Point nextPoint = *mPath.begin();
|
||||
const ESM::Pathgrid::Point& nextPoint = *mPath.begin();
|
||||
if (sqrDistanceIgnoreZ(nextPoint, x, y) < tolerance*tolerance)
|
||||
{
|
||||
mPath.pop_front();
|
||||
|
|
|
@ -12,8 +12,8 @@ namespace MWWorld
|
|||
|
||||
namespace MWMechanics
|
||||
{
|
||||
float distance(ESM::Pathgrid::Point point, float x, float y, float);
|
||||
float distance(ESM::Pathgrid::Point a, ESM::Pathgrid::Point b);
|
||||
float distance(const ESM::Pathgrid::Point& point, float x, float y, float);
|
||||
float distance(const ESM::Pathgrid::Point& a, const ESM::Pathgrid::Point& b);
|
||||
class PathFinder
|
||||
{
|
||||
public:
|
||||
|
|
Loading…
Reference in a new issue