2006-01-19 Al Riddoch <alriddoch@zepler.org>
* aiclient/ClientAccount.cpp, aiclient/ClientAccount.h,
aiclient/ClientConnection.cpp, aiclient/ClientConnection.h,
aiclient/client.cpp, aiclient/client.h, client/BaseClient.cpp,
client/BaseClient.h, client/CharacterClient.cpp,
client/CharacterClient.h, client/ClientConnection.cpp,
client/ClientConnection.h, client/CreatorClient.cpp,
client/CreatorClient.h, client/ObserverClient.cpp,
client/ObserverClient.h, client/Py_CreatorClient.cpp,
client/Py_CreatorClient.h, client/client.cpp,
client/define_world.cpp, client/define_world.h, common/Add.h,
common/Affect.h, common/AtlasFileLoader.cpp,
common/AtlasFileLoader.h, common/Attack.h, common/BaseEntity.cpp,
common/BaseEntity.h, common/BaseWorld.cpp, common/BaseWorld.h,
common/Burn.h, common/Chop.h, common/Connect.h, common/CustomOp.cpp,
common/CustomOp.h, common/CustomOp_impl.h, common/Cut.h,
common/Database.cpp, common/Database.h, common/Delve.h, common/Dig.h,
common/Eat.h, common/FormattedXMLWriter.cpp,
common/FormattedXMLWriter.h, common/Generic.h, common/Load.h,
common/Monitor.h, common/Mow.h, common/Nourish.h,
common/OOGThing.cpp, common/OOGThing.h, common/Property.cpp,
common/Property.h, common/Property_impl.h, common/Save.h,
common/Setup.h, common/Tick.h, common/Unseen.h, common/Update.h,
common/Use.h, common/Wield.h, common/accountbase.cpp,
common/accountbase.h, common/const.cpp, common/const.h,
common/custom.cpp, common/debug.h, common/globals.cpp,
common/globals.h, common/id.cpp, common/id.h, common/inheritance.cpp,
common/inheritance.h, common/inheritance_impl.h, common/log.cpp,
common/log.h, common/newid.cpp, common/nls.h, common/op_switch.h,
common/operations.cpp, common/operations.h, common/random.h,
common/refno.h, common/serialno.cpp, common/serialno.h,
common/system.cpp, common/system.h, common/terrain_utils.cpp,
common/terrain_utils.h, common/type_utils.h, common/types.h,
common/utility.cpp, common/utility.h, modules/DateTime.cpp,
modules/DateTime.h, modules/Location.cpp, modules/Location.h,
modules/WorldTime.cpp, modules/WorldTime.h, physics/BBox.cpp,
physics/BBox.h, physics/Collision.cpp, physics/Collision.h,
physics/Quaternion.cpp, physics/Quaternion.h, physics/Vector3D.cpp,
physics/Vector3D.h, physics/VectorPol.h, rulesets/Area.cpp,
rulesets/Area.h, rulesets/AreaProperty.cpp, rulesets/AreaProperty.h,
rulesets/ArithmeticScript.cpp, rulesets/ArithmeticScript.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h,
rulesets/CalendarProperty.cpp, rulesets/CalendarProperty.h,
rulesets/Character.cpp, rulesets/Character.h, rulesets/Combat.cpp,
rulesets/Combat.h, rulesets/Container.cpp, rulesets/Container.h,
rulesets/Creator.cpp, rulesets/Creator.h, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/EntityProperties.cpp,
rulesets/Entity_getLocation.h, rulesets/Fell.cpp, rulesets/Fell.h,
rulesets/Food.cpp, rulesets/Food.h, rulesets/Line.cpp,
rulesets/Line.h, rulesets/LineProperty.cpp, rulesets/LineProperty.h,
rulesets/MemEntity.cpp, rulesets/MemEntity.h, rulesets/MemMap.cpp,
rulesets/MemMap.h, rulesets/MemMap_methods.h,
rulesets/MindFactory.cpp, rulesets/MindFactory.h, rulesets/Missile.h,
rulesets/Motion.cpp, rulesets/Motion.h, rulesets/Movement.cpp,
rulesets/Movement.h, rulesets/Pedestrian.cpp, rulesets/Pedestrian.h,
rulesets/Plant.cpp, rulesets/Plant.h, rulesets/Py_BBox.cpp,
rulesets/Py_BBox.h, rulesets/Py_EntityWrapper.h,
rulesets/Py_Location.cpp, rulesets/Py_Location.h,
rulesets/Py_Map.cpp, rulesets/Py_Map.h, rulesets/Py_Mind.cpp,
rulesets/Py_Mind.h, rulesets/Py_Object.cpp, rulesets/Py_Object.h,
rulesets/Py_Operation.cpp, rulesets/Py_Operation.h,
rulesets/Py_Oplist.cpp, rulesets/Py_Oplist.h, rulesets/Py_Optime.cpp,
rulesets/Py_Optime.h, rulesets/Py_Point3D.cpp, rulesets/Py_Point3D.h,
rulesets/Py_Property.cpp, rulesets/Py_Property.h,
rulesets/Py_Quaternion.cpp, rulesets/Py_Quaternion.h,
rulesets/Py_RootEntity.cpp, rulesets/Py_RootEntity.h,
rulesets/Py_Statistics.cpp, rulesets/Py_Statistics.h,
rulesets/Py_Task.cpp, rulesets/Py_Task.h, rulesets/Py_Thing.cpp,
rulesets/Py_Thing.h, rulesets/Py_Vector3D.cpp,
rulesets/Py_Vector3D.h, rulesets/Py_World.cpp, rulesets/Py_World.h,
rulesets/Py_WorldTime.cpp, rulesets/Py_WorldTime.h,
rulesets/PythonArithmeticScript.cpp,
rulesets/PythonArithmeticScript.h, rulesets/PythonMindScript.cpp,
rulesets/PythonMindScript.h, rulesets/PythonScript.cpp,
rulesets/PythonScript.h, rulesets/PythonThingScript.cpp,
rulesets/PythonThingScript.h, rulesets/PythonWrapper.cpp,
rulesets/PythonWrapper.h, rulesets/Python_API.cpp,
rulesets/Python_API.h, rulesets/Python_Script_Utils.h,
rulesets/Script.cpp, rulesets/Script.h, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/Statistics.cpp, rulesets/Statistics.h,
rulesets/StatisticsProperty.cpp, rulesets/StatisticsProperty.h,
rulesets/Structure.cpp, rulesets/Structure.h, rulesets/Task.cpp,
rulesets/Task.h, rulesets/TaskScript.cpp, rulesets/TaskScript.h,
rulesets/TerrainProperty.cpp, rulesets/TerrainProperty.h,
rulesets/Thing.cpp, rulesets/Thing.h, rulesets/ThingFactory.cpp,
rulesets/ThingFactory.h, rulesets/World.cpp, rulesets/World.h,
rulesets/attributes.h, server/Account.cpp, server/Account.h,
server/Admin.cpp, server/Admin.h, server/ArithmeticFactory.cpp,
server/ArithmeticFactory.h, server/CommClient.cpp,
server/CommClient.h, server/CommIdleSocket.cpp,
server/CommIdleSocket.h, server/CommListener.cpp,
server/CommListener.h, server/CommLocalClient.cpp,
server/CommLocalClient.h, server/CommMDNSPublisher.cpp,
server/CommMDNSPublisher.h, server/CommMaster.cpp,
server/CommMaster.h, server/CommMetaClient.cpp,
server/CommMetaClient.h, server/CommPSQLSocket.cpp,
server/CommPSQLSocket.h, server/CommPeer.cpp,
server/CommPeer.h, server/CommPeerListener.cpp,
server/CommPeerListener.h, server/CommRemoteClient.cpp,
server/CommRemoteClient.h, server/CommServer.cpp,
server/CommServer.h, server/CommSlaveClient.cpp,
server/CommSlaveClient.h, server/CommSlaveListener.cpp,
server/CommSlaveListener.h, server/CommSocket.cpp,
server/CommSocket.h, server/CommUnixListener.cpp,
server/CommUnixListener.h, server/Connection.cpp,
server/Connection.h, server/Connection_methods.h,
server/EntityFactory.cpp, server/EntityFactory.h,
server/ExternalMind.cpp, server/ExternalMind.h,
server/Idle.cpp, server/Idle.h, server/Lobby.cpp, server/Lobby.h,
server/Master.cpp, server/Master.h, server/Peer.cpp, server/Peer.h,
server/Persistance.cpp, server/Persistance.h,
server/PersistantThingFactory.cpp, server/PersistantThingFactory.h,
server/PersistantThingFactory_impl.h, server/Persistor.cpp,
server/Persistor.h, server/Persistor_impl.h,
server/Player.cpp, server/Player.h, server/Restoration.cpp,
server/Restoration.h, server/Restorer.cpp, server/Restorer.h,
server/Restorer_impl.h, server/ScriptFactory.cpp,
server/ScriptFactory.h, server/ServerRouting.cpp,
server/ServerRouting.h, server/ServerRouting_methods.h,
server/SlaveClientConnection.cpp, server/SlaveClientConnection.h,
server/TaskFactory.cpp, server/TaskFactory.h,
server/TrustedConnection.cpp, server/TrustedConnection.h,
server/WorldRouter.cpp, server/WorldRouter.h,
server/server.cpp, server/server.h, server/slave.cpp,
tests/Areatest.cpp, tests/BaseEntitytest.cpp,
tests/Charactertest.cpp, tests/Containertest.cpp,
tests/Creatortest.cpp, tests/EntityExerciser.h,
tests/EntityFactorytest.cpp, tests/Entitytest.cpp,
tests/Foodtest.cpp, tests/IGEntityExerciser.h,
tests/Linetest.cpp, tests/Locationtest.cpp, tests/OOGThingtest.cpp,
tests/Planttest.cpp, tests/Propertytest.cpp, tests/Stackabletest.cpp,
tests/Structuretest.cpp, tests/Tasktest.cpp, tests/TestWorld.h,
tests/Thingtest.cpp, tests/WorldTimetest.cpp, tests/Worldtest.cpp,
tests/allOperations.h, tests/collisiontest.cpp, tests/consttest.cpp,
tests/distancetest.cpp, tests/emergencetest.cpp,
tests/inheritancetest.cpp, tests/logtest.cpp, tests/randomtest.cpp,
tests/systemtest.cpp, tests/transformtest.cpp,
tests/type_utilstest.cpp, tests/utilitytest.cpp,
tools/AdminClient.cpp, tools/AdminClient.h, tools/cyaddrules.cpp,
tools/cycmd.cpp, tools/cyconfig.cpp, tools/cyconvertrules.cpp,
tools/cyctrl.cpp, tools/cydbload.cpp, tools/cydumprules.cpp,
tools/cyisoload.cpp, tools/cyloadrules.cpp, tools/cypasswd.cpp,
tools/cywatchdog.cpp: Replace the copyright and license statements
with new versions that include disclaimer of warranty, and
permit distribution under later versions of the GPL.
2006-01-19 02:17:06 +00:00
|
|
|
// Cyphesis Online RPG Server and AI Engine
|
2008-11-17 15:31:40 +00:00
|
|
|
// Copyright (C) 2000-2008 Alistair Riddoch
|
2006-01-19 Al Riddoch <alriddoch@zepler.org>
* aiclient/ClientAccount.cpp, aiclient/ClientAccount.h,
aiclient/ClientConnection.cpp, aiclient/ClientConnection.h,
aiclient/client.cpp, aiclient/client.h, client/BaseClient.cpp,
client/BaseClient.h, client/CharacterClient.cpp,
client/CharacterClient.h, client/ClientConnection.cpp,
client/ClientConnection.h, client/CreatorClient.cpp,
client/CreatorClient.h, client/ObserverClient.cpp,
client/ObserverClient.h, client/Py_CreatorClient.cpp,
client/Py_CreatorClient.h, client/client.cpp,
client/define_world.cpp, client/define_world.h, common/Add.h,
common/Affect.h, common/AtlasFileLoader.cpp,
common/AtlasFileLoader.h, common/Attack.h, common/BaseEntity.cpp,
common/BaseEntity.h, common/BaseWorld.cpp, common/BaseWorld.h,
common/Burn.h, common/Chop.h, common/Connect.h, common/CustomOp.cpp,
common/CustomOp.h, common/CustomOp_impl.h, common/Cut.h,
common/Database.cpp, common/Database.h, common/Delve.h, common/Dig.h,
common/Eat.h, common/FormattedXMLWriter.cpp,
common/FormattedXMLWriter.h, common/Generic.h, common/Load.h,
common/Monitor.h, common/Mow.h, common/Nourish.h,
common/OOGThing.cpp, common/OOGThing.h, common/Property.cpp,
common/Property.h, common/Property_impl.h, common/Save.h,
common/Setup.h, common/Tick.h, common/Unseen.h, common/Update.h,
common/Use.h, common/Wield.h, common/accountbase.cpp,
common/accountbase.h, common/const.cpp, common/const.h,
common/custom.cpp, common/debug.h, common/globals.cpp,
common/globals.h, common/id.cpp, common/id.h, common/inheritance.cpp,
common/inheritance.h, common/inheritance_impl.h, common/log.cpp,
common/log.h, common/newid.cpp, common/nls.h, common/op_switch.h,
common/operations.cpp, common/operations.h, common/random.h,
common/refno.h, common/serialno.cpp, common/serialno.h,
common/system.cpp, common/system.h, common/terrain_utils.cpp,
common/terrain_utils.h, common/type_utils.h, common/types.h,
common/utility.cpp, common/utility.h, modules/DateTime.cpp,
modules/DateTime.h, modules/Location.cpp, modules/Location.h,
modules/WorldTime.cpp, modules/WorldTime.h, physics/BBox.cpp,
physics/BBox.h, physics/Collision.cpp, physics/Collision.h,
physics/Quaternion.cpp, physics/Quaternion.h, physics/Vector3D.cpp,
physics/Vector3D.h, physics/VectorPol.h, rulesets/Area.cpp,
rulesets/Area.h, rulesets/AreaProperty.cpp, rulesets/AreaProperty.h,
rulesets/ArithmeticScript.cpp, rulesets/ArithmeticScript.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h,
rulesets/CalendarProperty.cpp, rulesets/CalendarProperty.h,
rulesets/Character.cpp, rulesets/Character.h, rulesets/Combat.cpp,
rulesets/Combat.h, rulesets/Container.cpp, rulesets/Container.h,
rulesets/Creator.cpp, rulesets/Creator.h, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/EntityProperties.cpp,
rulesets/Entity_getLocation.h, rulesets/Fell.cpp, rulesets/Fell.h,
rulesets/Food.cpp, rulesets/Food.h, rulesets/Line.cpp,
rulesets/Line.h, rulesets/LineProperty.cpp, rulesets/LineProperty.h,
rulesets/MemEntity.cpp, rulesets/MemEntity.h, rulesets/MemMap.cpp,
rulesets/MemMap.h, rulesets/MemMap_methods.h,
rulesets/MindFactory.cpp, rulesets/MindFactory.h, rulesets/Missile.h,
rulesets/Motion.cpp, rulesets/Motion.h, rulesets/Movement.cpp,
rulesets/Movement.h, rulesets/Pedestrian.cpp, rulesets/Pedestrian.h,
rulesets/Plant.cpp, rulesets/Plant.h, rulesets/Py_BBox.cpp,
rulesets/Py_BBox.h, rulesets/Py_EntityWrapper.h,
rulesets/Py_Location.cpp, rulesets/Py_Location.h,
rulesets/Py_Map.cpp, rulesets/Py_Map.h, rulesets/Py_Mind.cpp,
rulesets/Py_Mind.h, rulesets/Py_Object.cpp, rulesets/Py_Object.h,
rulesets/Py_Operation.cpp, rulesets/Py_Operation.h,
rulesets/Py_Oplist.cpp, rulesets/Py_Oplist.h, rulesets/Py_Optime.cpp,
rulesets/Py_Optime.h, rulesets/Py_Point3D.cpp, rulesets/Py_Point3D.h,
rulesets/Py_Property.cpp, rulesets/Py_Property.h,
rulesets/Py_Quaternion.cpp, rulesets/Py_Quaternion.h,
rulesets/Py_RootEntity.cpp, rulesets/Py_RootEntity.h,
rulesets/Py_Statistics.cpp, rulesets/Py_Statistics.h,
rulesets/Py_Task.cpp, rulesets/Py_Task.h, rulesets/Py_Thing.cpp,
rulesets/Py_Thing.h, rulesets/Py_Vector3D.cpp,
rulesets/Py_Vector3D.h, rulesets/Py_World.cpp, rulesets/Py_World.h,
rulesets/Py_WorldTime.cpp, rulesets/Py_WorldTime.h,
rulesets/PythonArithmeticScript.cpp,
rulesets/PythonArithmeticScript.h, rulesets/PythonMindScript.cpp,
rulesets/PythonMindScript.h, rulesets/PythonScript.cpp,
rulesets/PythonScript.h, rulesets/PythonThingScript.cpp,
rulesets/PythonThingScript.h, rulesets/PythonWrapper.cpp,
rulesets/PythonWrapper.h, rulesets/Python_API.cpp,
rulesets/Python_API.h, rulesets/Python_Script_Utils.h,
rulesets/Script.cpp, rulesets/Script.h, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/Statistics.cpp, rulesets/Statistics.h,
rulesets/StatisticsProperty.cpp, rulesets/StatisticsProperty.h,
rulesets/Structure.cpp, rulesets/Structure.h, rulesets/Task.cpp,
rulesets/Task.h, rulesets/TaskScript.cpp, rulesets/TaskScript.h,
rulesets/TerrainProperty.cpp, rulesets/TerrainProperty.h,
rulesets/Thing.cpp, rulesets/Thing.h, rulesets/ThingFactory.cpp,
rulesets/ThingFactory.h, rulesets/World.cpp, rulesets/World.h,
rulesets/attributes.h, server/Account.cpp, server/Account.h,
server/Admin.cpp, server/Admin.h, server/ArithmeticFactory.cpp,
server/ArithmeticFactory.h, server/CommClient.cpp,
server/CommClient.h, server/CommIdleSocket.cpp,
server/CommIdleSocket.h, server/CommListener.cpp,
server/CommListener.h, server/CommLocalClient.cpp,
server/CommLocalClient.h, server/CommMDNSPublisher.cpp,
server/CommMDNSPublisher.h, server/CommMaster.cpp,
server/CommMaster.h, server/CommMetaClient.cpp,
server/CommMetaClient.h, server/CommPSQLSocket.cpp,
server/CommPSQLSocket.h, server/CommPeer.cpp,
server/CommPeer.h, server/CommPeerListener.cpp,
server/CommPeerListener.h, server/CommRemoteClient.cpp,
server/CommRemoteClient.h, server/CommServer.cpp,
server/CommServer.h, server/CommSlaveClient.cpp,
server/CommSlaveClient.h, server/CommSlaveListener.cpp,
server/CommSlaveListener.h, server/CommSocket.cpp,
server/CommSocket.h, server/CommUnixListener.cpp,
server/CommUnixListener.h, server/Connection.cpp,
server/Connection.h, server/Connection_methods.h,
server/EntityFactory.cpp, server/EntityFactory.h,
server/ExternalMind.cpp, server/ExternalMind.h,
server/Idle.cpp, server/Idle.h, server/Lobby.cpp, server/Lobby.h,
server/Master.cpp, server/Master.h, server/Peer.cpp, server/Peer.h,
server/Persistance.cpp, server/Persistance.h,
server/PersistantThingFactory.cpp, server/PersistantThingFactory.h,
server/PersistantThingFactory_impl.h, server/Persistor.cpp,
server/Persistor.h, server/Persistor_impl.h,
server/Player.cpp, server/Player.h, server/Restoration.cpp,
server/Restoration.h, server/Restorer.cpp, server/Restorer.h,
server/Restorer_impl.h, server/ScriptFactory.cpp,
server/ScriptFactory.h, server/ServerRouting.cpp,
server/ServerRouting.h, server/ServerRouting_methods.h,
server/SlaveClientConnection.cpp, server/SlaveClientConnection.h,
server/TaskFactory.cpp, server/TaskFactory.h,
server/TrustedConnection.cpp, server/TrustedConnection.h,
server/WorldRouter.cpp, server/WorldRouter.h,
server/server.cpp, server/server.h, server/slave.cpp,
tests/Areatest.cpp, tests/BaseEntitytest.cpp,
tests/Charactertest.cpp, tests/Containertest.cpp,
tests/Creatortest.cpp, tests/EntityExerciser.h,
tests/EntityFactorytest.cpp, tests/Entitytest.cpp,
tests/Foodtest.cpp, tests/IGEntityExerciser.h,
tests/Linetest.cpp, tests/Locationtest.cpp, tests/OOGThingtest.cpp,
tests/Planttest.cpp, tests/Propertytest.cpp, tests/Stackabletest.cpp,
tests/Structuretest.cpp, tests/Tasktest.cpp, tests/TestWorld.h,
tests/Thingtest.cpp, tests/WorldTimetest.cpp, tests/Worldtest.cpp,
tests/allOperations.h, tests/collisiontest.cpp, tests/consttest.cpp,
tests/distancetest.cpp, tests/emergencetest.cpp,
tests/inheritancetest.cpp, tests/logtest.cpp, tests/randomtest.cpp,
tests/systemtest.cpp, tests/transformtest.cpp,
tests/type_utilstest.cpp, tests/utilitytest.cpp,
tools/AdminClient.cpp, tools/AdminClient.h, tools/cyaddrules.cpp,
tools/cycmd.cpp, tools/cyconfig.cpp, tools/cyconvertrules.cpp,
tools/cyctrl.cpp, tools/cydbload.cpp, tools/cydumprules.cpp,
tools/cyisoload.cpp, tools/cyloadrules.cpp, tools/cypasswd.cpp,
tools/cywatchdog.cpp: Replace the copyright and license statements
with new versions that include disclaimer of warranty, and
permit distribution under later versions of the GPL.
2006-01-19 02:17:06 +00:00
|
|
|
//
|
|
|
|
|
// 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; either version 2 of the License, or
|
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
// but WITHOUT ANY WARRANTY; 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2001-01-26 16:38:23 +00:00
|
|
|
|
2008-09-10 14:10:37 +00:00
|
|
|
// $Id$
|
2006-10-26 00:48:00 +00:00
|
|
|
|
2003-03-07 00:22:12 +00:00
|
|
|
#include "rulesets/Entity.h"
|
2000-08-13 20:36:18 +00:00
|
|
|
|
2004-11-18 18:15:13 +00:00
|
|
|
#include "common/log.h"
|
2005-12-13 01:38:08 +00:00
|
|
|
#include "common/const.h"
|
2005-09-10 10:28:45 +00:00
|
|
|
#include "common/debug.h"
|
2004-11-18 18:15:13 +00:00
|
|
|
|
2003-07-18 00:43:53 +00:00
|
|
|
#include <wfmath/atlasconv.h>
|
|
|
|
|
|
2005-08-27 14:52:12 +00:00
|
|
|
#include <Atlas/Objects/Anonymous.h>
|
|
|
|
|
|
2003-08-07 23:03:26 +00:00
|
|
|
using Atlas::Message::Element;
|
2008-11-17 15:13:14 +00:00
|
|
|
using Atlas::Message::MapType;
|
2005-08-27 14:52:12 +00:00
|
|
|
using Atlas::Objects::Entity::Anonymous;
|
2000-08-27 18:00:38 +00:00
|
|
|
|
2005-09-10 10:28:45 +00:00
|
|
|
static const bool debug_flag = false;
|
|
|
|
|
|
2005-06-05 20:33:56 +00:00
|
|
|
Location::Location() :
|
2005-12-13 01:38:08 +00:00
|
|
|
m_simple(true), m_solid(true),
|
|
|
|
|
m_boxSize(consts::minBoxSize),
|
|
|
|
|
m_squareBoxSize(consts::minSqrBoxSize),
|
|
|
|
|
m_loc(0)
|
2004-06-11 11:09:44 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2007-12-02 Al Riddoch <alriddoch@zepler.org>
* client/CreatorClient.cpp, client/CreatorClient.h,
client/Py_CreatorClient.cpp, common/BaseWorld.h, common/types.h,
modules/Location.cpp, modules/Location.h,
rulesets/AtlasProperties.cpp, rulesets/AtlasProperties.h,
rulesets/BaseMind.cpp, rulesets/Character.cpp, rulesets/Character.h,
rulesets/Entity.cpp, rulesets/Entity.h,
rulesets/EntityProperties.cpp, rulesets/LocatedEntity.cpp,
rulesets/LocatedEntity.h, rulesets/MemEntity.cpp,
rulesets/MemEntity.h, rulesets/MemMap.cpp, rulesets/Motion.cpp,
rulesets/Motion.h, rulesets/Py_Location.h, rulesets/Py_Mind.cpp,
rulesets/Py_Thing.cpp, rulesets/Py_Thing.h,
rulesets/PythonMindScript.h, rulesets/PythonScript.h,
rulesets/PythonThingScript.cpp, rulesets/PythonThingScript.h,
rulesets/Python_API.cpp, rulesets/Script.cpp, rulesets/Script.h,
rulesets/Thing.cpp, rulesets/World.cpp, server/WorldRouter.cpp,
server/WorldRouter.h: Refactor all the entity code so there is now
a new base class for entities in the world simulation, and in the
mind which only contains things which are trully common to both.
This moves a lot of functionality which should not have been
present in mind entities away, and makes that code safer and more
efficient.
* tests/TestWorld.h: Update the test world API to match the base
class.
2007-12-02 23:49:05 +00:00
|
|
|
Location::Location(LocatedEntity * rf) :
|
2005-12-13 01:38:08 +00:00
|
|
|
m_simple(true), m_solid(true),
|
|
|
|
|
m_boxSize(consts::minBoxSize),
|
|
|
|
|
m_squareBoxSize(consts::minSqrBoxSize),
|
|
|
|
|
m_loc(rf)
|
2004-06-11 11:09:44 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2007-12-02 Al Riddoch <alriddoch@zepler.org>
* client/CreatorClient.cpp, client/CreatorClient.h,
client/Py_CreatorClient.cpp, common/BaseWorld.h, common/types.h,
modules/Location.cpp, modules/Location.h,
rulesets/AtlasProperties.cpp, rulesets/AtlasProperties.h,
rulesets/BaseMind.cpp, rulesets/Character.cpp, rulesets/Character.h,
rulesets/Entity.cpp, rulesets/Entity.h,
rulesets/EntityProperties.cpp, rulesets/LocatedEntity.cpp,
rulesets/LocatedEntity.h, rulesets/MemEntity.cpp,
rulesets/MemEntity.h, rulesets/MemMap.cpp, rulesets/Motion.cpp,
rulesets/Motion.h, rulesets/Py_Location.h, rulesets/Py_Mind.cpp,
rulesets/Py_Thing.cpp, rulesets/Py_Thing.h,
rulesets/PythonMindScript.h, rulesets/PythonScript.h,
rulesets/PythonThingScript.cpp, rulesets/PythonThingScript.h,
rulesets/Python_API.cpp, rulesets/Script.cpp, rulesets/Script.h,
rulesets/Thing.cpp, rulesets/World.cpp, server/WorldRouter.cpp,
server/WorldRouter.h: Refactor all the entity code so there is now
a new base class for entities in the world simulation, and in the
mind which only contains things which are trully common to both.
This moves a lot of functionality which should not have been
present in mind entities away, and makes that code safer and more
efficient.
* tests/TestWorld.h: Update the test world API to match the base
class.
2007-12-02 23:49:05 +00:00
|
|
|
Location::Location(LocatedEntity * rf, const Point3D & pos) :
|
2005-12-13 01:38:08 +00:00
|
|
|
m_simple(true), m_solid(true),
|
|
|
|
|
m_boxSize(consts::minBoxSize),
|
|
|
|
|
m_squareBoxSize(consts::minSqrBoxSize),
|
2007-12-02 Al Riddoch <alriddoch@zepler.org>
* client/CreatorClient.cpp, client/CreatorClient.h,
client/Py_CreatorClient.cpp, common/BaseWorld.h, common/types.h,
modules/Location.cpp, modules/Location.h,
rulesets/AtlasProperties.cpp, rulesets/AtlasProperties.h,
rulesets/BaseMind.cpp, rulesets/Character.cpp, rulesets/Character.h,
rulesets/Entity.cpp, rulesets/Entity.h,
rulesets/EntityProperties.cpp, rulesets/LocatedEntity.cpp,
rulesets/LocatedEntity.h, rulesets/MemEntity.cpp,
rulesets/MemEntity.h, rulesets/MemMap.cpp, rulesets/Motion.cpp,
rulesets/Motion.h, rulesets/Py_Location.h, rulesets/Py_Mind.cpp,
rulesets/Py_Thing.cpp, rulesets/Py_Thing.h,
rulesets/PythonMindScript.h, rulesets/PythonScript.h,
rulesets/PythonThingScript.cpp, rulesets/PythonThingScript.h,
rulesets/Python_API.cpp, rulesets/Script.cpp, rulesets/Script.h,
rulesets/Thing.cpp, rulesets/World.cpp, server/WorldRouter.cpp,
server/WorldRouter.h: Refactor all the entity code so there is now
a new base class for entities in the world simulation, and in the
mind which only contains things which are trully common to both.
This moves a lot of functionality which should not have been
present in mind entities away, and makes that code safer and more
efficient.
* tests/TestWorld.h: Update the test world API to match the base
class.
2007-12-02 23:49:05 +00:00
|
|
|
m_loc(rf), m_pos(pos)
|
2004-06-11 11:09:44 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2007-12-02 Al Riddoch <alriddoch@zepler.org>
* client/CreatorClient.cpp, client/CreatorClient.h,
client/Py_CreatorClient.cpp, common/BaseWorld.h, common/types.h,
modules/Location.cpp, modules/Location.h,
rulesets/AtlasProperties.cpp, rulesets/AtlasProperties.h,
rulesets/BaseMind.cpp, rulesets/Character.cpp, rulesets/Character.h,
rulesets/Entity.cpp, rulesets/Entity.h,
rulesets/EntityProperties.cpp, rulesets/LocatedEntity.cpp,
rulesets/LocatedEntity.h, rulesets/MemEntity.cpp,
rulesets/MemEntity.h, rulesets/MemMap.cpp, rulesets/Motion.cpp,
rulesets/Motion.h, rulesets/Py_Location.h, rulesets/Py_Mind.cpp,
rulesets/Py_Thing.cpp, rulesets/Py_Thing.h,
rulesets/PythonMindScript.h, rulesets/PythonScript.h,
rulesets/PythonThingScript.cpp, rulesets/PythonThingScript.h,
rulesets/Python_API.cpp, rulesets/Script.cpp, rulesets/Script.h,
rulesets/Thing.cpp, rulesets/World.cpp, server/WorldRouter.cpp,
server/WorldRouter.h: Refactor all the entity code so there is now
a new base class for entities in the world simulation, and in the
mind which only contains things which are trully common to both.
This moves a lot of functionality which should not have been
present in mind entities away, and makes that code safer and more
efficient.
* tests/TestWorld.h: Update the test world API to match the base
class.
2007-12-02 23:49:05 +00:00
|
|
|
Location::Location(LocatedEntity * rf,
|
|
|
|
|
const Point3D& pos,
|
|
|
|
|
const Vector3D& velocity) :
|
2005-12-13 01:38:08 +00:00
|
|
|
m_simple(true), m_solid(true),
|
|
|
|
|
m_boxSize(consts::minBoxSize),
|
|
|
|
|
m_squareBoxSize(consts::minSqrBoxSize),
|
2007-12-02 Al Riddoch <alriddoch@zepler.org>
* client/CreatorClient.cpp, client/CreatorClient.h,
client/Py_CreatorClient.cpp, common/BaseWorld.h, common/types.h,
modules/Location.cpp, modules/Location.h,
rulesets/AtlasProperties.cpp, rulesets/AtlasProperties.h,
rulesets/BaseMind.cpp, rulesets/Character.cpp, rulesets/Character.h,
rulesets/Entity.cpp, rulesets/Entity.h,
rulesets/EntityProperties.cpp, rulesets/LocatedEntity.cpp,
rulesets/LocatedEntity.h, rulesets/MemEntity.cpp,
rulesets/MemEntity.h, rulesets/MemMap.cpp, rulesets/Motion.cpp,
rulesets/Motion.h, rulesets/Py_Location.h, rulesets/Py_Mind.cpp,
rulesets/Py_Thing.cpp, rulesets/Py_Thing.h,
rulesets/PythonMindScript.h, rulesets/PythonScript.h,
rulesets/PythonThingScript.cpp, rulesets/PythonThingScript.h,
rulesets/Python_API.cpp, rulesets/Script.cpp, rulesets/Script.h,
rulesets/Thing.cpp, rulesets/World.cpp, server/WorldRouter.cpp,
server/WorldRouter.h: Refactor all the entity code so there is now
a new base class for entities in the world simulation, and in the
mind which only contains things which are trully common to both.
This moves a lot of functionality which should not have been
present in mind entities away, and makes that code safer and more
efficient.
* tests/TestWorld.h: Update the test world API to match the base
class.
2007-12-02 23:49:05 +00:00
|
|
|
m_loc(rf), m_pos(pos), m_velocity(velocity)
|
2004-06-11 11:09:44 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2008-11-17 15:13:14 +00:00
|
|
|
void Location::addToMessage(MapType & omap) const
|
2001-07-12 16:10:41 +00:00
|
|
|
{
|
2003-03-21 10:48:17 +00:00
|
|
|
if (m_loc!=NULL) {
|
2004-08-07 Al Riddoch <alriddoch@zepler.org>
* common/BaseEntity.cpp, common/BaseEntity.h, common/BaseWorld.h,
common/Database.cpp, common/Database.h, common/FormattedXMLWriter.cpp,
common/FormattedXMLWriter.h, common/accountbase.cpp,
common/accountbase.h, common/custom.cpp, common/inheritance.cpp,
common/inheritance.h, common/operations.h, common/type_utils.h,
common/utility.cpp, common/utility.h, modules/Location.cpp,
modules/Location.h, rulesets/Area.cpp, rulesets/Area.h,
rulesets/BaseMind.cpp, rulesets/Character.cpp, rulesets/Character.h,
rulesets/Creator.cpp, rulesets/Entity.cpp, rulesets/Entity.h,
rulesets/Entity_getLocation.h, rulesets/Food.cpp, rulesets/Line.cpp,
rulesets/Line.h, rulesets/MemMap.cpp, rulesets/MemMap.h,
rulesets/Pedestrian.cpp, rulesets/Plant.cpp, rulesets/Plant.h,
rulesets/Py_Mind.cpp, rulesets/Py_Object.cpp, rulesets/Py_Object.h,
rulesets/Py_Operation.cpp, rulesets/Py_Thing.cpp,
rulesets/Python_API.cpp, rulesets/Stackable.cpp, rulesets/Stackable.h,
rulesets/Thing.cpp, rulesets/World.cpp, rulesets/World.h,
server/Account.cpp, server/Account.h, server/Admin.cpp,
server/Admin.h, server/CommClient.cpp, server/CommClient.h,
server/CommListener.cpp, server/CommListener.h,
server/CommLocalClient.cpp, server/CommLocalClient.h,
server/CommMetaClient.h, server/CommPSQLSocket.h,
server/CommRemoteClient.cpp, server/CommRemoteClient.h,
server/CommServer.cpp, server/CommServer.h, server/CommSocket.cpp,
server/CommSocket.h, server/CommUnixListener.cpp,
server/CommUnixListener.h, server/Connection.cpp,
server/Connection.h, server/EntityFactory.cpp,
server/EntityFactory.h, server/Lobby.cpp, server/Lobby.h,
server/Persistance.cpp, server/Persistance.h,
server/PersistantThingFactory.h, server/Persistor.cpp,
server/Player.cpp, server/Player.h, server/Restorer.h,
server/Restorer_impl.h, server/ServerRouting.cpp,
server/ServerRouting.h, server/TrustedConnection.cpp,
server/TrustedConnection.h, server/WorldRouter.cpp,
server/WorldRouter.h: Convert code to using Atlas Message
typedefs as found in Atlas-C++ 0.6 to aid conversion later.
2004-08-16 14:26:47 +00:00
|
|
|
omap["loc"] = m_loc->getId();
|
2001-07-12 16:10:41 +00:00
|
|
|
}
|
2005-09-28 Al Riddoch <alriddoch@zepler.org>
* modules/Location.cpp, modules/Location.h:
Add const accessors for location data, in preparation for
adding cached collision data which must be updated every
time data is modified.
* physics/Collision.cpp, rulesets/Character.cpp, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/MemMap.cpp, rulesets/Movement.cpp,
rulesets/Pedestrian.cpp, rulesets/Plant.cpp,
rulesets/Py_Location.cpp, rulesets/Thing.cpp, rulesets/World.cpp,
server/Account.cpp, server/EntityFactory.cpp, server/Persistor.cpp,
server/Persistor_impl.h, server/Restorer_impl.h,
server/WorldRouter.cpp, tests/Locationtest.cpp:
Use the const accessors whenver reading data from Location.
2005-09-28 23:02:50 +00:00
|
|
|
if (pos().isValid()) {
|
|
|
|
|
omap["pos"] = pos().toAtlas();
|
2001-07-12 16:10:41 +00:00
|
|
|
}
|
2005-09-28 Al Riddoch <alriddoch@zepler.org>
* modules/Location.cpp, modules/Location.h:
Add const accessors for location data, in preparation for
adding cached collision data which must be updated every
time data is modified.
* physics/Collision.cpp, rulesets/Character.cpp, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/MemMap.cpp, rulesets/Movement.cpp,
rulesets/Pedestrian.cpp, rulesets/Plant.cpp,
rulesets/Py_Location.cpp, rulesets/Thing.cpp, rulesets/World.cpp,
server/Account.cpp, server/EntityFactory.cpp, server/Persistor.cpp,
server/Persistor_impl.h, server/Restorer_impl.h,
server/WorldRouter.cpp, tests/Locationtest.cpp:
Use the const accessors whenver reading data from Location.
2005-09-28 23:02:50 +00:00
|
|
|
if (velocity().isValid()) {
|
|
|
|
|
omap["velocity"] = velocity().toAtlas();
|
2001-07-12 16:10:41 +00:00
|
|
|
}
|
2005-09-28 Al Riddoch <alriddoch@zepler.org>
* modules/Location.cpp, modules/Location.h:
Add const accessors for location data, in preparation for
adding cached collision data which must be updated every
time data is modified.
* physics/Collision.cpp, rulesets/Character.cpp, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/MemMap.cpp, rulesets/Movement.cpp,
rulesets/Pedestrian.cpp, rulesets/Plant.cpp,
rulesets/Py_Location.cpp, rulesets/Thing.cpp, rulesets/World.cpp,
server/Account.cpp, server/EntityFactory.cpp, server/Persistor.cpp,
server/Persistor_impl.h, server/Restorer_impl.h,
server/WorldRouter.cpp, tests/Locationtest.cpp:
Use the const accessors whenver reading data from Location.
2005-09-28 23:02:50 +00:00
|
|
|
if (orientation().isValid()) {
|
|
|
|
|
omap["orientation"] = orientation().toAtlas();
|
2001-07-12 16:10:41 +00:00
|
|
|
}
|
2005-09-28 Al Riddoch <alriddoch@zepler.org>
* modules/Location.cpp, modules/Location.h:
Add const accessors for location data, in preparation for
adding cached collision data which must be updated every
time data is modified.
* physics/Collision.cpp, rulesets/Character.cpp, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/MemMap.cpp, rulesets/Movement.cpp,
rulesets/Pedestrian.cpp, rulesets/Plant.cpp,
rulesets/Py_Location.cpp, rulesets/Thing.cpp, rulesets/World.cpp,
server/Account.cpp, server/EntityFactory.cpp, server/Persistor.cpp,
server/Persistor_impl.h, server/Restorer_impl.h,
server/WorldRouter.cpp, tests/Locationtest.cpp:
Use the const accessors whenver reading data from Location.
2005-09-28 23:02:50 +00:00
|
|
|
if (bBox().isValid()) {
|
|
|
|
|
omap["bbox"] = bBox().toAtlas();
|
* physics/BBox.h, rulesets/Py_BBox.h, rulesets/Py_BBox.cpp:
Added direct support for new format bounding boxes.
* modules/Location.cpp, modules/Location.h, physics/Vector3D.h,
rulesets/Character.cpp, rulesets/Creator.cpp, rulesets/Entity.cpp,
rulesets/Movement.cpp, rulesets/Plant.cpp, rulesets/Py_Location.cpp:
Switched over to using new format bounding boxes, and re-wrote
collision code for this format, making it clearer and more
efficient at the same time.
Al Riddoch <alriddoch@zepler.org>
2001-11-30 14:35:59 +00:00
|
|
|
}
|
2001-07-12 16:10:41 +00:00
|
|
|
}
|
2002-03-11 Al Riddoch <alriddoch@zepler.org>
* server/WorldRouter.cpp: Eliminate unnecessary call to opEnumerate()
and enhance debugging output.
* server/Player.cpp: Correct the use of string.compare() in older
versions of libstdc++.
* common/types.h: Added enumeration for other operations, not
handled by the core, but considered valid. Added new type
for storing mapping between operation parents and their
enumerated type.
* common/op_switch.h: Separate handling of operations known to
be invalid from operations which are valid, but not explicitly
added to the core.
* common/inheritance.h, common/inheritance.cpp, common/custom.cpp:
Provide global operation mapping where enumeration of operations
can be looked up. Install all types handled by the core, and
types known to be used in scripts.
* common/BaseEntity.h, common/BaseEntity.cpp: Add object specific
operation mapping where operation types each object is subscribed
to can be enumerated, and others are rejected. Add mechanism
so that objects can add to the mapping, this subscribing to
operations. This makes enumerating operations much cheaper, and
eliminates the overhead of handling ops an object has no interest
in.
* rulesets/Thing.h, rulesets/Thing.cpp: Add mechanism so scripts
can subscribe to operations.
* rulesets/Character.h, rulesets/Character.cpp:
Add subscription mechanism for ops going to and from
the mind.
* rulesets/BaseMind.h, rulesets/BaseMind.cpp:
Add subscription mechanism for sight and sound perception
operations sub operations, and provide an interface to it
for scripts.
* server/Connection.cpp, server/Admin.cpp, server/Account.cpp,
rulesets/World.cpp, rulesets/World.h, rulesets/Thing.cpp,
rulesets/Stackable.cpp, rulesets/Plant.cpp, rulesets/Food.cpp,
rulesets/Character.cpp, rulesets/BaseMind.cpp:
Add subscriptions to operations for all core base classes.
* rulesets/Python_API.cpp: When script is created, go through
methods, and subscribe to the operations which are handled by
them.
* rulesets/Character.cpp: When calculating orientation of a walking
character, assume it is standing upright.
* physics/Vector3D.h: Add versions of mag() and distance() which
omit the square root calculations, so that when their values
are only used for comparison, the expensive square root
calculations can be ommited. Add new version of collision
and range checking functions which provide the optimal
interface to the application. Add versions of methods which
modify this rather than creating a new operation to eliminate
wasted copies.
* physics/Quaternion.cpp: Make use of faster interface provided
by Vector3D.
* physics/BBox.h: Add new version of collision checking function
which provides optimal interface to the application.
* modules/Location.h, modules/Location.cpp: Add new functions
to optimally calculate the distance between any two entities.
* modules/Location.h: Re-write collision and range functions to
make much more optimal use of Vector3D, BBox and distance
functionality.
* rulesets/Py_Vector3D.cpp, rulesets/Pedestrian.cpp,
rulesets/Movement.cpp, rulesets/Entity.cpp, rulesets/Character.cpp:
Eliminate implicit copies from vector arithmetic.
* rulesets/Pedestrian.cpp, rulesets/MemMap.cpp, common/const.h:
Re-write code which uses magnitude of vectors to use the square
of the magnitude instead, as it is much cheaper to calculate.
2002-03-11 18:24:19 +00:00
|
|
|
|
2005-08-27 14:52:12 +00:00
|
|
|
void Location::addToEntity(const Atlas::Objects::Entity::RootEntity & ent) const
|
|
|
|
|
{
|
|
|
|
|
if (m_loc!=NULL) {
|
|
|
|
|
ent->setLoc(m_loc->getId());
|
|
|
|
|
}
|
2005-09-28 Al Riddoch <alriddoch@zepler.org>
* modules/Location.cpp, modules/Location.h:
Add const accessors for location data, in preparation for
adding cached collision data which must be updated every
time data is modified.
* physics/Collision.cpp, rulesets/Character.cpp, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/MemMap.cpp, rulesets/Movement.cpp,
rulesets/Pedestrian.cpp, rulesets/Plant.cpp,
rulesets/Py_Location.cpp, rulesets/Thing.cpp, rulesets/World.cpp,
server/Account.cpp, server/EntityFactory.cpp, server/Persistor.cpp,
server/Persistor_impl.h, server/Restorer_impl.h,
server/WorldRouter.cpp, tests/Locationtest.cpp:
Use the const accessors whenver reading data from Location.
2005-09-28 23:02:50 +00:00
|
|
|
if (pos().isValid()) {
|
|
|
|
|
::addToEntity(pos(), ent->modifyPos());
|
2005-08-27 14:52:12 +00:00
|
|
|
}
|
2005-09-28 Al Riddoch <alriddoch@zepler.org>
* modules/Location.cpp, modules/Location.h:
Add const accessors for location data, in preparation for
adding cached collision data which must be updated every
time data is modified.
* physics/Collision.cpp, rulesets/Character.cpp, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/MemMap.cpp, rulesets/Movement.cpp,
rulesets/Pedestrian.cpp, rulesets/Plant.cpp,
rulesets/Py_Location.cpp, rulesets/Thing.cpp, rulesets/World.cpp,
server/Account.cpp, server/EntityFactory.cpp, server/Persistor.cpp,
server/Persistor_impl.h, server/Restorer_impl.h,
server/WorldRouter.cpp, tests/Locationtest.cpp:
Use the const accessors whenver reading data from Location.
2005-09-28 23:02:50 +00:00
|
|
|
if (velocity().isValid()) {
|
|
|
|
|
::addToEntity(velocity(), ent->modifyVelocity());
|
2005-08-27 14:52:12 +00:00
|
|
|
}
|
2005-09-28 Al Riddoch <alriddoch@zepler.org>
* modules/Location.cpp, modules/Location.h:
Add const accessors for location data, in preparation for
adding cached collision data which must be updated every
time data is modified.
* physics/Collision.cpp, rulesets/Character.cpp, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/MemMap.cpp, rulesets/Movement.cpp,
rulesets/Pedestrian.cpp, rulesets/Plant.cpp,
rulesets/Py_Location.cpp, rulesets/Thing.cpp, rulesets/World.cpp,
server/Account.cpp, server/EntityFactory.cpp, server/Persistor.cpp,
server/Persistor_impl.h, server/Restorer_impl.h,
server/WorldRouter.cpp, tests/Locationtest.cpp:
Use the const accessors whenver reading data from Location.
2005-09-28 23:02:50 +00:00
|
|
|
if (orientation().isValid()) {
|
|
|
|
|
ent->setAttr("orientation", orientation().toAtlas());
|
2005-08-27 14:52:12 +00:00
|
|
|
}
|
2005-09-28 Al Riddoch <alriddoch@zepler.org>
* modules/Location.cpp, modules/Location.h:
Add const accessors for location data, in preparation for
adding cached collision data which must be updated every
time data is modified.
* physics/Collision.cpp, rulesets/Character.cpp, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/MemMap.cpp, rulesets/Movement.cpp,
rulesets/Pedestrian.cpp, rulesets/Plant.cpp,
rulesets/Py_Location.cpp, rulesets/Thing.cpp, rulesets/World.cpp,
server/Account.cpp, server/EntityFactory.cpp, server/Persistor.cpp,
server/Persistor_impl.h, server/Restorer_impl.h,
server/WorldRouter.cpp, tests/Locationtest.cpp:
Use the const accessors whenver reading data from Location.
2005-09-28 23:02:50 +00:00
|
|
|
if (bBox().isValid()) {
|
|
|
|
|
ent->setAttr("bbox", bBox().toAtlas());
|
2005-08-27 14:52:12 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-11-17 15:13:14 +00:00
|
|
|
int Location::readFromMessage(const MapType & msg)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
MapType::const_iterator I = msg.find("pos");
|
|
|
|
|
MapType::const_iterator Iend = msg.end();
|
|
|
|
|
if (I != Iend) {
|
|
|
|
|
const Element & pos = I->second;
|
|
|
|
|
if (pos.isList() && pos.List().size() == 3) {
|
|
|
|
|
m_pos.fromAtlas(pos);
|
|
|
|
|
} else {
|
|
|
|
|
log(ERROR, "Malformed POS data");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
I = msg.find("orientation");
|
|
|
|
|
if (I != Iend) {
|
|
|
|
|
const Element & orientation = I->second;
|
|
|
|
|
if (orientation.isList() && orientation.List().size() == 4) {
|
|
|
|
|
m_orientation.fromAtlas(orientation);
|
|
|
|
|
} else {
|
|
|
|
|
log(ERROR, "Malformed ORIENTATION data");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Atlas::Message::WrongTypeException&) {
|
|
|
|
|
log(ERROR, "Location::readFromMessage: Bad location data");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2005-09-11 01:43:29 +00:00
|
|
|
int Location::readFromEntity(const Atlas::Objects::Entity::RootEntity & ent)
|
2005-09-10 10:28:45 +00:00
|
|
|
{
|
|
|
|
|
debug( std::cout << "Location::readFromEntity" << std::endl << std::flush;);
|
|
|
|
|
try {
|
|
|
|
|
if (ent->hasAttrFlag(Atlas::Objects::Entity::POS_FLAG)) {
|
|
|
|
|
fromStdVector(m_pos, ent->getPos());
|
|
|
|
|
}
|
|
|
|
|
if (ent->hasAttrFlag(Atlas::Objects::Entity::VELOCITY_FLAG)) {
|
2005-09-13 01:44:49 +00:00
|
|
|
fromStdVector(m_velocity, ent->getVelocity());
|
2005-09-10 10:28:45 +00:00
|
|
|
}
|
2008-11-17 15:31:40 +00:00
|
|
|
Element orientation;
|
2005-09-10 10:28:45 +00:00
|
|
|
if (ent->copyAttr("orientation", orientation) == 0) {
|
2008-11-17 15:13:14 +00:00
|
|
|
if (orientation.isList() && orientation.List().size() == 4) {
|
2005-09-10 10:28:45 +00:00
|
|
|
m_orientation.fromAtlas(orientation);
|
|
|
|
|
} else {
|
|
|
|
|
log(ERROR, "Malformed ORIENTATION data");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Atlas::Message::WrongTypeException&) {
|
|
|
|
|
log(ERROR, "Location::readFromEntity: Bad location data");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2005-11-21 02:24:17 +00:00
|
|
|
void Location::modifyBBox()
|
|
|
|
|
{
|
2005-11-22 23:31:41 +00:00
|
|
|
if (!m_bBox.isValid()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_squareBoxSize = square(m_bBox.highCorner().x() - m_bBox.lowCorner().x()) +
|
|
|
|
|
square(m_bBox.highCorner().y() - m_bBox.lowCorner().y()) +
|
|
|
|
|
square(m_bBox.highCorner().z() - m_bBox.lowCorner().z());
|
2011-04-27 19:46:13 +01:00
|
|
|
m_boxSize = std::sqrt(m_squareBoxSize);
|
2005-11-22 23:31:41 +00:00
|
|
|
|
|
|
|
|
m_squareRadius = std::max(square(m_bBox.lowCorner().x()) +
|
|
|
|
|
square(m_bBox.lowCorner().y()) +
|
|
|
|
|
square(m_bBox.lowCorner().z()),
|
|
|
|
|
square(m_bBox.highCorner().x()) +
|
|
|
|
|
square(m_bBox.highCorner().y()) +
|
|
|
|
|
square(m_bBox.highCorner().z()));
|
2011-04-27 19:46:13 +01:00
|
|
|
m_radius = std::sqrt(m_squareRadius);
|
2005-11-21 02:24:17 +00:00
|
|
|
}
|
|
|
|
|
|
2011-01-07 22:38:49 +00:00
|
|
|
void Location::setVisibility(float v)
|
|
|
|
|
{
|
|
|
|
|
m_boxSize = v;
|
|
|
|
|
m_squareBoxSize = v * v;
|
|
|
|
|
// TODO m_radius and m_squareRadius? Unused everywhere for now.
|
|
|
|
|
}
|
|
|
|
|
|
2005-08-27 14:52:12 +00:00
|
|
|
const Atlas::Objects::Root Location::asEntity() const
|
|
|
|
|
{
|
|
|
|
|
Anonymous ret;
|
|
|
|
|
addToEntity(ret);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-23 22:09:45 +00:00
|
|
|
static bool distanceFromAncestor(const Location & self,
|
|
|
|
|
const Location & other, Point3D & c)
|
|
|
|
|
{
|
2004-09-23 23:38:23 +00:00
|
|
|
if (&self == &other) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-23 22:09:45 +00:00
|
|
|
if (other.m_loc == NULL) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2005-09-28 Al Riddoch <alriddoch@zepler.org>
* modules/Location.cpp, modules/Location.h:
Add const accessors for location data, in preparation for
adding cached collision data which must be updated every
time data is modified.
* physics/Collision.cpp, rulesets/Character.cpp, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/MemMap.cpp, rulesets/Movement.cpp,
rulesets/Pedestrian.cpp, rulesets/Plant.cpp,
rulesets/Py_Location.cpp, rulesets/Thing.cpp, rulesets/World.cpp,
server/Account.cpp, server/EntityFactory.cpp, server/Persistor.cpp,
server/Persistor_impl.h, server/Restorer_impl.h,
server/WorldRouter.cpp, tests/Locationtest.cpp:
Use the const accessors whenver reading data from Location.
2005-09-28 23:02:50 +00:00
|
|
|
if (other.orientation().isValid()) {
|
|
|
|
|
c = c.toParentCoords(other.m_pos, other.orientation());
|
2004-10-03 03:32:16 +00:00
|
|
|
} else {
|
2012-03-05 09:30:49 +00:00
|
|
|
static const Quaternion identity((Quaternion::Identity()));
|
2004-10-03 03:32:16 +00:00
|
|
|
c = c.toParentCoords(other.m_pos, identity);
|
|
|
|
|
}
|
2004-09-23 22:09:45 +00:00
|
|
|
|
2004-09-23 23:38:23 +00:00
|
|
|
return distanceFromAncestor(self, other.m_loc->m_location, c);
|
2004-09-23 22:09:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool distanceToAncestor(const Location & self,
|
|
|
|
|
const Location & other, Point3D & c)
|
|
|
|
|
{
|
|
|
|
|
c.setToOrigin();
|
2004-09-23 23:38:23 +00:00
|
|
|
if (distanceFromAncestor(self, other, c)) {
|
|
|
|
|
return true;
|
2004-11-18 18:15:13 +00:00
|
|
|
} else if ((self.m_loc != 0) &&
|
|
|
|
|
distanceToAncestor(self.m_loc->m_location, other, c)) {
|
2005-09-28 Al Riddoch <alriddoch@zepler.org>
* modules/Location.cpp, modules/Location.h:
Add const accessors for location data, in preparation for
adding cached collision data which must be updated every
time data is modified.
* physics/Collision.cpp, rulesets/Character.cpp, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/MemMap.cpp, rulesets/Movement.cpp,
rulesets/Pedestrian.cpp, rulesets/Plant.cpp,
rulesets/Py_Location.cpp, rulesets/Thing.cpp, rulesets/World.cpp,
server/Account.cpp, server/EntityFactory.cpp, server/Persistor.cpp,
server/Persistor_impl.h, server/Restorer_impl.h,
server/WorldRouter.cpp, tests/Locationtest.cpp:
Use the const accessors whenver reading data from Location.
2005-09-28 23:02:50 +00:00
|
|
|
if (self.orientation().isValid()) {
|
|
|
|
|
c = c.toLocalCoords(self.m_pos, self.orientation());
|
2004-10-03 03:32:16 +00:00
|
|
|
} else {
|
|
|
|
|
static const Quaternion identity(1, 0, 0, 0);
|
|
|
|
|
c = c.toLocalCoords(self.m_pos, identity);
|
|
|
|
|
}
|
2004-09-23 22:09:45 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
2004-11-18 18:15:13 +00:00
|
|
|
log(ERROR, "Broken entity hierarchy doing distance calculation");
|
|
|
|
|
if (self.m_loc != 0) {
|
|
|
|
|
std::cerr << "Self(" << self.m_loc->getId() << "," << self.m_loc << ")"
|
|
|
|
|
<< std::endl << std::flush;
|
|
|
|
|
}
|
|
|
|
|
if (other.m_loc != 0) {
|
|
|
|
|
std::cerr << "Other(" << other.m_loc->getId() << "," << other.m_loc << ")"
|
|
|
|
|
<< std::endl << std::flush;
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-23 22:09:45 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2005-10-01 17:34:21 +00:00
|
|
|
/// \brief Determine the vector distance from self to other.
|
|
|
|
|
///
|
|
|
|
|
/// @param self Location of an entity
|
|
|
|
|
/// @param other Location of an entity the distance of which is to be
|
|
|
|
|
/// determined
|
|
|
|
|
/// @return The vector distance from self to other.
|
|
|
|
|
/// The distance calculated is a vector relative to the parent of the
|
|
|
|
|
/// entity who's location is given by self. This is useful for determing
|
|
|
|
|
/// both the scalar distance to another entity, and a direction vector
|
|
|
|
|
/// that can be used to determine the direction for motion if it
|
|
|
|
|
/// is necessary to head toward the other entity.
|
2004-10-11 01:04:27 +00:00
|
|
|
const Vector3D distanceTo(const Location & self, const Location & other)
|
2004-09-23 23:38:23 +00:00
|
|
|
{
|
2004-10-11 01:04:27 +00:00
|
|
|
static Point3D origin(0,0,0);
|
|
|
|
|
Point3D pos;
|
|
|
|
|
distanceToAncestor(self, other, pos);
|
|
|
|
|
Vector3D dist = pos - origin;
|
2005-09-28 Al Riddoch <alriddoch@zepler.org>
* modules/Location.cpp, modules/Location.h:
Add const accessors for location data, in preparation for
adding cached collision data which must be updated every
time data is modified.
* physics/Collision.cpp, rulesets/Character.cpp, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/MemMap.cpp, rulesets/Movement.cpp,
rulesets/Pedestrian.cpp, rulesets/Plant.cpp,
rulesets/Py_Location.cpp, rulesets/Thing.cpp, rulesets/World.cpp,
server/Account.cpp, server/EntityFactory.cpp, server/Persistor.cpp,
server/Persistor_impl.h, server/Restorer_impl.h,
server/WorldRouter.cpp, tests/Locationtest.cpp:
Use the const accessors whenver reading data from Location.
2005-09-28 23:02:50 +00:00
|
|
|
if (self.orientation().isValid()) {
|
|
|
|
|
dist.rotate(self.orientation());
|
2004-10-11 01:04:27 +00:00
|
|
|
}
|
2004-09-23 23:38:23 +00:00
|
|
|
return dist;
|
|
|
|
|
}
|
|
|
|
|
|
2005-10-01 17:34:21 +00:00
|
|
|
/// \brief Determine the postion of other relative to self.
|
|
|
|
|
///
|
|
|
|
|
/// @param self Location of an entity
|
|
|
|
|
/// @param other Location of an entity this position of which is to be
|
|
|
|
|
/// determined
|
|
|
|
|
/// @return The position of other.
|
|
|
|
|
/// The position calculated is relative to the entity who's location is given
|
|
|
|
|
/// by self. The calculation is very similar to distanceTo() but an extra
|
|
|
|
|
/// step is ommited.
|
2004-10-11 01:04:27 +00:00
|
|
|
const Point3D relativePos(const Location & self, const Location & other)
|
|
|
|
|
{
|
|
|
|
|
Point3D pos;
|
|
|
|
|
distanceToAncestor(self, other, pos);
|
|
|
|
|
return pos;
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-31 11:06:51 +00:00
|
|
|
float squareDistance(const Location & self, const Location & other)
|
2004-09-23 22:09:45 +00:00
|
|
|
{
|
|
|
|
|
Point3D dist;
|
|
|
|
|
distanceToAncestor(self, other, dist);
|
|
|
|
|
return sqrMag(dist);
|
|
|
|
|
}
|
2005-06-23 12:46:28 +00:00
|
|
|
|
2012-01-31 11:06:51 +00:00
|
|
|
float squareHorizontalDistance(const Location & self, const Location & other)
|
2005-06-23 12:46:28 +00:00
|
|
|
{
|
|
|
|
|
Point3D dist;
|
|
|
|
|
distanceToAncestor(self, other, dist);
|
|
|
|
|
dist.z() = 0.f;
|
|
|
|
|
return sqrMag(dist);
|
|
|
|
|
}
|