mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-19 20:41:33 +00:00
Added overloads for to_string to handle xyz_heading, xyz_location, and xy_location
This commit is contained in:
parent
408fdc7178
commit
f63c5ab6ba
@ -1,4 +1,6 @@
|
|||||||
#include "position.h"
|
#include "position.h"
|
||||||
|
#include <string>
|
||||||
|
#include "../common/string_util.h"
|
||||||
|
|
||||||
xy_location::xy_location(float x, float y) :
|
xy_location::xy_location(float x, float y) :
|
||||||
m_X(x),
|
m_X(x),
|
||||||
@ -104,3 +106,16 @@ void xyz_location::ABS_XYZ(void) {
|
|||||||
if (m_Z < 0)
|
if (m_Z < 0)
|
||||||
m_Z = -m_Z;
|
m_Z = -m_Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string to_string(const xyz_heading &position) {
|
||||||
|
return StringFormat("(%.3f, %.3f, %.3f, %.3f)", position.m_X,position.m_Y,position.m_Z,position.m_Heading);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string to_string(const xyz_location &position){
|
||||||
|
return StringFormat("(%.3f, %.3f, %.3f)", position.m_X,position.m_Y,position.m_Z);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string to_string(const xy_location &position){
|
||||||
|
return StringFormat("(%.3f, %.3f)", position.m_X,position.m_Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,8 @@
|
|||||||
#ifndef POSITION_H
|
#ifndef POSITION_H
|
||||||
#define POSITION_H
|
#define POSITION_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class xy_location {
|
class xy_location {
|
||||||
public:
|
public:
|
||||||
float m_X;
|
float m_X;
|
||||||
@ -76,5 +78,8 @@ public:
|
|||||||
bool isOrigin() const { return m_X == 0.0f && m_Y == 0.0f && m_Z == 0.0f;}
|
bool isOrigin() const { return m_X == 0.0f && m_Y == 0.0f && m_Z == 0.0f;}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::string to_string(const xyz_heading &position);
|
||||||
|
std::string to_string(const xyz_location &position);
|
||||||
|
std::string to_string(const xy_location &position);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user