mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-09 12:23:53 +00:00
xyz_heading, xyz_location, and xy_location built
This commit is contained in:
parent
bee04c1b53
commit
640aea24bc
@ -16,7 +16,7 @@ SET(zone_sources
|
||||
command.cpp
|
||||
corpse.cpp
|
||||
doors.cpp
|
||||
effects.cpp
|
||||
effects.cpp
|
||||
embparser.cpp
|
||||
embparser_api.cpp
|
||||
embperl.cpp
|
||||
@ -92,6 +92,7 @@ SET(zone_sources
|
||||
perlpacket.cpp
|
||||
petitions.cpp
|
||||
pets.cpp
|
||||
position.cpp
|
||||
qglobals.cpp
|
||||
queryserv.cpp
|
||||
questmgr.cpp
|
||||
@ -182,6 +183,7 @@ SET(zone_headers
|
||||
perlpacket.h
|
||||
petitions.h
|
||||
pets.h
|
||||
position.h
|
||||
qglobals.h
|
||||
quest_interface.h
|
||||
queryserv.h
|
||||
|
||||
106
zone/position.cpp
Normal file
106
zone/position.cpp
Normal file
@ -0,0 +1,106 @@
|
||||
#include "position.h"
|
||||
|
||||
xy_location::xy_location(float x, float y) :
|
||||
m_X(x),
|
||||
m_Y(y) {
|
||||
}
|
||||
|
||||
const xy_location xy_location::operator -(const xy_location& rhs) {
|
||||
xy_location minus{m_X - rhs.m_X, m_Y - rhs.m_Y};
|
||||
return minus;
|
||||
}
|
||||
|
||||
xyz_heading::xyz_heading(float x, float y, float z, float heading) :
|
||||
m_X(x),
|
||||
m_Y(y),
|
||||
m_Z(z),
|
||||
m_Heading(heading) {
|
||||
}
|
||||
|
||||
xyz_heading::xyz_heading(const xyz_heading& locationDir) :
|
||||
m_X(locationDir.m_X),
|
||||
m_Y(locationDir.m_Y),
|
||||
m_Z(locationDir.m_Z),
|
||||
m_Heading(locationDir.m_Heading) {
|
||||
}
|
||||
|
||||
xyz_heading::xyz_heading(const xyz_location& locationDir, float heading) :
|
||||
m_X(locationDir.m_X),
|
||||
m_Y(locationDir.m_Y),
|
||||
m_Z(locationDir.m_Z),
|
||||
m_Heading(heading) {
|
||||
}
|
||||
|
||||
xyz_heading::xyz_heading(const xy_location& locationDir, float z, float heading) :
|
||||
m_X(locationDir.m_X),
|
||||
m_Y(locationDir.m_Y),
|
||||
m_Z(z),
|
||||
m_Heading(heading) {
|
||||
}
|
||||
|
||||
|
||||
xyz_heading::xyz_heading(const xyz_location locationDir, float heading) :
|
||||
m_X(locationDir.m_X),
|
||||
m_Y(locationDir.m_Y),
|
||||
m_Z(locationDir.m_Z),
|
||||
m_Heading(heading) {
|
||||
}
|
||||
|
||||
xyz_heading::xyz_heading(const xy_location locationDir, float z, float heading) :
|
||||
m_X(locationDir.m_X),
|
||||
m_Y(locationDir.m_Y),
|
||||
m_Z(z),
|
||||
m_Heading(heading) {
|
||||
}
|
||||
|
||||
xyz_heading::operator xyz_location() const {
|
||||
return xyz_location{m_X,m_Y,m_Z};
|
||||
}
|
||||
|
||||
xyz_heading::operator xy_location() const {
|
||||
return xy_location{m_X,m_Y};
|
||||
}
|
||||
|
||||
const xyz_heading xyz_heading::operator +(const xyz_location& rhs) {
|
||||
return xyz_heading{m_X + rhs.m_X, m_Y + rhs.m_Y, m_Z + rhs.m_Z, m_Heading};
|
||||
}
|
||||
|
||||
const xyz_heading xyz_heading::operator +(const xy_location& rhs) {
|
||||
return xyz_heading{m_X + rhs.m_X, m_Y + rhs.m_Y, m_Z, m_Heading};
|
||||
}
|
||||
|
||||
const xyz_heading xyz_heading::operator -(const xyz_location& rhs) {
|
||||
return xyz_heading{m_X - rhs.m_X, m_Y - rhs.m_Y, m_Z - rhs.m_Z, m_Heading};
|
||||
}
|
||||
|
||||
|
||||
xyz_location::xyz_location(float x, float y, float z) :
|
||||
m_X(x),
|
||||
m_Y(y),
|
||||
m_Z(z) {
|
||||
}
|
||||
|
||||
xyz_location::xyz_location(double x, double y, double z) :
|
||||
m_X(static_cast<float>(x)),
|
||||
m_Y(static_cast<float>(y)),
|
||||
m_Z(static_cast<float>(z)) {
|
||||
}
|
||||
|
||||
xyz_location::operator xy_location() const {
|
||||
return xy_location{m_X, m_Y};
|
||||
}
|
||||
|
||||
const xyz_location xyz_location::operator -(const xyz_location& rhs) {
|
||||
return xyz_location{m_X - rhs.m_X, m_Y - rhs.m_Y, m_Z - rhs.m_Z};
|
||||
}
|
||||
|
||||
void xyz_location::ABS_XYZ(void) {
|
||||
if (m_X < 0)
|
||||
m_X = -m_X;
|
||||
|
||||
if (m_Y < 0)
|
||||
m_Y = -m_Y;
|
||||
|
||||
if (m_Z < 0)
|
||||
m_Z = -m_Z;
|
||||
}
|
||||
80
zone/position.h
Normal file
80
zone/position.h
Normal file
@ -0,0 +1,80 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef POSITION_H
|
||||
#define POSITION_H
|
||||
|
||||
class xy_location {
|
||||
public:
|
||||
float m_X;
|
||||
float m_Y;
|
||||
|
||||
xy_location(float x = 0.0f, float y = 0.0f);
|
||||
|
||||
const xy_location operator -(const xy_location& rhs);
|
||||
};
|
||||
|
||||
class xyz_location {
|
||||
public:
|
||||
float m_X;
|
||||
float m_Y;
|
||||
float m_Z;
|
||||
|
||||
static const xyz_location& Origin() {static xyz_location origin; return origin;}
|
||||
|
||||
xyz_location(float x = 0.0f, float y = 0.0f, float z = 0.0f);
|
||||
xyz_location(double x, double y, double z);
|
||||
|
||||
operator xy_location() const;
|
||||
|
||||
const xyz_location operator -(const xyz_location& rhs);
|
||||
|
||||
void ABS_XYZ();
|
||||
bool isOrigin() const { return m_X == 0 && m_Y == 0 && m_Z == 0;}
|
||||
|
||||
};
|
||||
|
||||
class xyz_heading {
|
||||
public:
|
||||
float m_X;
|
||||
float m_Y;
|
||||
float m_Z;
|
||||
|
||||
float m_Heading;
|
||||
|
||||
static const xyz_heading& Origin() {static xyz_heading origin; return origin;}
|
||||
|
||||
xyz_heading(float x = 0.0f, float y = 0.0f, float z = 0.0f, float heading = 0.0f);
|
||||
xyz_heading(const xyz_heading& locationDir);
|
||||
xyz_heading(const xyz_location& locationDir, float heading = 0.0f);
|
||||
xyz_heading(const xyz_location locationDir, float heading = 0.0f);
|
||||
explicit xyz_heading(const xy_location& locationDir, float z, float heading);
|
||||
explicit xyz_heading(const xy_location locationDir, float z, float heading);
|
||||
|
||||
operator xyz_location() const;
|
||||
operator xy_location() const;
|
||||
|
||||
const xyz_heading operator +(const xyz_location& rhs);
|
||||
const xyz_heading operator +(const xy_location& rhs);
|
||||
|
||||
const xyz_heading operator -(const xyz_location& rhs);
|
||||
|
||||
bool isOrigin() const { return m_X == 0.0f && m_Y == 0.0f && m_Z == 0.0f;}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
Loading…
x
Reference in New Issue
Block a user