mirror of
https://github.com/worldforge/cyphesis
synced 2026-08-13 12:26:04 -04:00
objects. * modules/Location.cpp: Added bounding median to attributes sent using Atlas. * common/BaseEntity.cpp: Always set the id on an entity. Al Riddoch <alriddoch@zepler.org>
50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
// This file may be redistributed and modified only under the terms of
|
|
// the GNU General Public License (See COPYING for details).
|
|
// Copyright (C) 2000,2001 Alistair Riddoch
|
|
|
|
#include <Atlas/Objects/Root.h>
|
|
#include <Atlas/Objects/Operation/Login.h>
|
|
|
|
#include <Atlas/Message/Object.h>
|
|
|
|
#include <physics/Vector3D.h>
|
|
|
|
#include <streambuf.h> // Simplest source of NULL
|
|
|
|
#include "Location.h"
|
|
|
|
#include <rulesets/Entity.h>
|
|
|
|
using Atlas::Message::Object;
|
|
|
|
Vector3D Location::getXyz() const {
|
|
if (ref && coords) {
|
|
return coords + ref->getXyz();
|
|
} else {
|
|
return Vector3D(0,0,0);
|
|
}
|
|
}
|
|
|
|
void Location::addToObject(Object::MapType & omap) const
|
|
{
|
|
if (ref!=NULL) {
|
|
omap["loc"] = Object(ref->fullid);
|
|
} else {
|
|
omap["loc"] = Object("");
|
|
}
|
|
if (coords) {
|
|
omap["pos"] = coords.asObject();
|
|
}
|
|
if (velocity) {
|
|
omap["velocity"] = velocity.asObject();
|
|
}
|
|
if (face) {
|
|
omap["face"] = face.asObject();
|
|
}
|
|
if (bbox) {
|
|
omap["bbox"] = bbox.asObject();
|
|
}
|
|
if (bmedian) {
|
|
omap["bmedian"] = bmedian.asObject();
|
|
}
|
|
}
|