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
|
2001-04-16 16:26:44 +00:00
|
|
|
// Copyright (C) 2000,2001 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
|
|
|
|
2006-10-26 00:48:00 +00:00
|
|
|
|
2002-07-14 21:04:50 +00:00
|
|
|
#include "BaseMind.h"
|
|
|
|
|
|
2003-09-08 Al Riddoch <alriddoch@zepler.org>
* client/Py_CreatorClient.cpp, client/Py_CreatorClient.h,
rulesets/Py_BBox.cpp, rulesets/Py_BBox.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_Quaternion.cpp, rulesets/Py_Quaternion.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/PythonMindScript.cpp, rulesets/PythonThingScript.cpp,
rulesets/Python_API.cpp:
Clean up python API code, with decent names for types,
decent error reporting, and making the more paranoid checks
only present in debug build.
* common/BaseEntity.cpp, common/BaseEntity.h, server/Account.cpp:
Remove pointless method setRefnoOp, and put it in the body as
an inline method.
* common/BaseEntity.h, common/BaseWorld.cpp, common/Setup.h,
common/Tick.h, common/operations.h, common/custom.cpp,
common/types.h, common/utility.cpp, common/utility.h,
modules/Location.h, physics/Vector3D.h, rulesets/BaseMind.cpp,
rulesets/Script.h, server/EntityFactory.h:
Clean up the dependency trees using more forward declarations.
* common/inheritance.cpp, common/inheritance.h:
Move most of the implementation into the .cpp file as its
not suited to inlining.
* rulesets/MemMap.cpp, rulesets/MemMap.h, rulesets/MemMap_methods.h:
Move contents of MemMap_methods.h into the .cpp file, as it is
not suited to inlining, and remove the file from the build.
2003-09-07 23:38:32 +00:00
|
|
|
#include "Script.h"
|
2002-07-14 21:04:50 +00:00
|
|
|
|
2009-08-02 18:29:40 +01:00
|
|
|
#include "common/custom.h"
|
2003-03-07 00:22:12 +00:00
|
|
|
#include "common/debug.h"
|
2009-08-02 18:29:40 +01:00
|
|
|
#include "common/log.h"
|
|
|
|
|
#include "common/op_switch.h"
|
2016-03-12 14:02:51 +01:00
|
|
|
#include "common/compose.hpp"
|
2002-07-14 21:04:50 +00:00
|
|
|
|
2005-12-13 18:41:40 +00:00
|
|
|
#include <Atlas/Objects/SmartPtr.h>
|
2005-08-27 14:52:12 +00:00
|
|
|
#include <Atlas/Objects/Operation.h>
|
2005-12-13 18:41:40 +00:00
|
|
|
#include <Atlas/Objects/Anonymous.h>
|
2000-11-19 20:18:24 +00:00
|
|
|
|
2005-12-13 18:41:40 +00:00
|
|
|
using Atlas::Message::Element;
|
2005-08-27 14:52:12 +00:00
|
|
|
using Atlas::Objects::Root;
|
2005-12-13 18:41:40 +00:00
|
|
|
using Atlas::Objects::Operation::Look;
|
2005-09-08 Al Riddoch <alriddoch@zepler.org>
* rulesets/Entity.cpp: Update copyright date.
* rulesets/BaseMind.cpp, rulesets/Entity_getLocation.h,
rulesets/Entity.h, rulesets/MemMap.cpp, rulesets/MemMap.h,
rulesets/Py_Map.cpp, server/EntityFactory.cpp,
server/EntityFactory.h, server/WorldRouter.cpp,
client/BaseClient.cpp, client/CreatorClient.cpp:
Change various methods to pass entity information
around as RootEntity rather than MapType.
2005-09-08 15:03:31 +00:00
|
|
|
using Atlas::Objects::Entity::RootEntity;
|
2005-12-13 18:41:40 +00:00
|
|
|
using Atlas::Objects::Entity::Anonymous;
|
2005-09-08 Al Riddoch <alriddoch@zepler.org>
* rulesets/Entity.cpp: Update copyright date.
* rulesets/BaseMind.cpp, rulesets/Entity_getLocation.h,
rulesets/Entity.h, rulesets/MemMap.cpp, rulesets/MemMap.h,
rulesets/Py_Map.cpp, server/EntityFactory.cpp,
server/EntityFactory.h, server/WorldRouter.cpp,
client/BaseClient.cpp, client/CreatorClient.cpp:
Change various methods to pass entity information
around as RootEntity rather than MapType.
2005-09-08 15:03:31 +00:00
|
|
|
|
|
|
|
|
using Atlas::Objects::smart_dynamic_cast;
|
2004-12-03 Al Riddoch <alriddoch@zepler.org>
* 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/Py_CreatorClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, common/BaseWorld.h, common/custom.cpp,
common/inheritance.cpp, common/inheritance.h,
common/inheritance_impl.h, common/op_switch.h, common/type_utils.h,
common/types.h, common/utility.cpp, common/utility.h,
modules/Location.cpp, rulesets/BaseMind.cpp, rulesets/BaseMind.h,
rulesets/Character.cpp, rulesets/Character.h, rulesets/Creator.cpp,
rulesets/Creator.h, rulesets/Entity.cpp, rulesets/Entity.h,
rulesets/EntityProperties.cpp, rulesets/Entity_getLocation.h,
rulesets/Food.cpp, rulesets/Food.h, rulesets/MemMap.cpp,
rulesets/MemMap.h, rulesets/Missile.h, rulesets/Pedestrian.cpp,
rulesets/Plant.cpp, rulesets/Plant.h, rulesets/Py_Mind.cpp,
rulesets/Py_Object.cpp, rulesets/Py_Operation.cpp,
rulesets/Py_Operation.h, rulesets/Py_Thing.cpp,
rulesets/PythonMindScript.h, rulesets/PythonScript.h,
rulesets/PythonThingScript.h, rulesets/Python_API.cpp,
rulesets/Script.cpp, rulesets/Script.h, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/Thing.cpp, rulesets/Thing.h,
rulesets/World.cpp, rulesets/World.h,
server/Account.cpp, server/Account.h server/Admin.cpp, server/Admin.h,
server/CommClient.cpp, 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/Persistor.cpp, server/Player.cpp, server/Player.h,
server/ServerRouting.cpp, server/ServerRouting.h,
server/TrustedConnection.cpp, server/TrustedConnection.h,
server/WorldRouter.cpp, server/WorldRouter.h, tests/Areatest.cpp,
tests/Charactertest.cpp, tests/Creatortest.cpp,
tests/EntityExerciser.h, tests/Entitytest.cpp, tests/Foodtest.cpp,
tests/IGEntityExerciser.h, tests/Linetest.cpp, tests/Planttest.cpp,
tests/Stackabletest.cpp, tests/Structuretest.cpp, tests/Thingtest.cpp,
tests/Worldtest.cpp, tests/allOperations.h, tests/inheritancetest.cpp,
tests/utilitytest.cpp, tools/cycmd.cpp:
Modify the entity interface so that all Operation methods
take references to RootOperation, as its cleaner, and requires
less nasty casts. Clean up operations in headers generally.
2004-12-03 14:49:13 +00:00
|
|
|
|
2003-09-08 Al Riddoch <alriddoch@zepler.org>
* client/Py_CreatorClient.cpp, client/Py_CreatorClient.h,
rulesets/Py_BBox.cpp, rulesets/Py_BBox.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_Quaternion.cpp, rulesets/Py_Quaternion.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/PythonMindScript.cpp, rulesets/PythonThingScript.cpp,
rulesets/Python_API.cpp:
Clean up python API code, with decent names for types,
decent error reporting, and making the more paranoid checks
only present in debug build.
* common/BaseEntity.cpp, common/BaseEntity.h, server/Account.cpp:
Remove pointless method setRefnoOp, and put it in the body as
an inline method.
* common/BaseEntity.h, common/BaseWorld.cpp, common/Setup.h,
common/Tick.h, common/operations.h, common/custom.cpp,
common/types.h, common/utility.cpp, common/utility.h,
modules/Location.h, physics/Vector3D.h, rulesets/BaseMind.cpp,
rulesets/Script.h, server/EntityFactory.h:
Clean up the dependency trees using more forward declarations.
* common/inheritance.cpp, common/inheritance.h:
Move most of the implementation into the .cpp file as its
not suited to inlining.
* rulesets/MemMap.cpp, rulesets/MemMap.h, rulesets/MemMap_methods.h:
Move contents of MemMap_methods.h into the .cpp file, as it is
not suited to inlining, and remove the file from the build.
2003-09-07 23:38:32 +00:00
|
|
|
static const bool debug_flag = false;
|
|
|
|
|
|
2006-12-26 Al Riddoch <alriddoch@zepler.org>
* client/BaseClient.cpp, client/BaseClient.h,
client/ClientConnection.cpp, common/AtlasFileLoader.cpp,
common/AtlasFileLoader.h, common/BaseEntity.cpp, common/BaseEntity.h,
common/Property.h, common/accountbase.cpp, common/accountbase.h,
rulesets/ActivePropertyFactory.h,
rulesets/ActivePropertyFactory_impl.h, rulesets/Area.cpp,
rulesets/Area.h, rulesets/AreaProperty.cpp, rulesets/AreaProperty.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h, server/Account.cpp,
server/Admin.cpp, server/Admin.h, server/ArithmeticFactory.h,
tests/Makefile.am, tools/AdminClient.cpp, tools/AdminClient.h,
tools/cycmd.cpp: Add inline documentation.
* rulesets/ActivePropertyFactory.h: Use handler function pointer
typedef for readability.
* rulesets/AreaProperty.cpp, rulesets/AreaProperty.h: Fix PropertyBase
overriding by adding const to the right methods.
2006-12-26 14:30:42 +00:00
|
|
|
/// \brief BaseMind constructor
|
|
|
|
|
///
|
|
|
|
|
/// @param id String identifier
|
|
|
|
|
/// @param intId Integer identifier
|
|
|
|
|
/// @param body_name The name attribute of the body this mind controls
|
2008-01-26 Al Riddoch <alriddoch@googlemail.com>
* common/BaseEntity.cpp, common/BaseEntity.h: Remove the code that
handle ID, and just inherit from Identified.
* client/CharacterClient.cpp, client/CreatorClient.cpp,
common/OOGThing.cpp, rulesets/BaseMind.cpp, rulesets/Character.cpp,
rulesets/Creator.cpp, rulesets/Entity.cpp,
rulesets/LocatedEntity.cpp, rulesets/MemEntity.cpp,
rulesets/Plant.cpp, rulesets/Stackable.cpp, rulesets/Structure.cpp,
rulesets/Thing.cpp, rulesets/World.cpp, server/Account.cpp,
server/Admin.cpp, server/ExternalMind.cpp, server/Lobby.cpp,
server/Peer.cpp, server/Player.cpp, server/ServerRouting.cpp,
server/SlaveClientConnection.cpp: Add calls to the virtually
inherited Identified constructor as required.
2008-01-26 17:43:20 +00:00
|
|
|
BaseMind::BaseMind(const std::string & id, long intId) :
|
2013-01-22 23:29:23 +00:00
|
|
|
MemEntity(id, intId), m_map(m_script)
|
2000-08-25 17:51:43 +00:00
|
|
|
{
|
2004-07-21 02:08:05 +00:00
|
|
|
setVisible(true);
|
2013-01-17 20:33:50 +00:00
|
|
|
setType(MemMap::m_entity_type);
|
2004-05-10 21:40:15 +00:00
|
|
|
m_map.addEntity(this);
|
2000-08-25 17:51:43 +00:00
|
|
|
}
|
|
|
|
|
|
2001-04-10 19:05:14 +00:00
|
|
|
BaseMind::~BaseMind()
|
|
|
|
|
{
|
2005-11-11 Al Riddoch <alriddoch@zepler.org>
* common/types.h, server/Persistance.h, common/BaseWorld.h,
common/BaseWorld.cpp, server/WorldRouter.cpp:
Switch core world map to reference by integer ID rather than string.
Add version of getEntity() which converts from string to integer
automatically.
* rulesets/Character.cpp, rulesets/Thing.cpp, rulesets/World.cpp,
server/EntityFactory.cpp,
Use getEntity() when looking up an entity, so that conversion of
ID from string to integer is automatic.
* rulesets/BaseMind.cpp, rulesets/MemMap.cpp, rulesets/MemMap.h:
Switch to using integer IDs in MemMap's core mapping.
* server/Account.cpp, server/Account.h: Switch a few function
parameters to use integer ID values, making the code cleaner.
* server/Account.cpp, server/Admin.cpp, server/Persistance.cpp:
Handle string ID to integer conversions as required.
2005-11-11 02:04:56 +00:00
|
|
|
m_map.m_entities.erase(getIntId());
|
2005-01-16 22:42:29 +00:00
|
|
|
// FIXME Remove this once MemMap uses parent refcounting
|
|
|
|
|
m_location.m_loc = 0;
|
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
|
|
|
// debug(std::cout << getId() << ":" << getType() << " flushing mind with "
|
|
|
|
|
// << m_map.getEntities().size() << " entities in it"
|
|
|
|
|
// << std::endl << std::flush;);
|
2004-05-10 19:56:52 +00:00
|
|
|
m_map.flush();
|
2001-04-10 19:05:14 +00:00
|
|
|
}
|
|
|
|
|
|
2006-12-26 18:46:07 +00:00
|
|
|
/// \brief Process the Sight of a Create operation.
|
|
|
|
|
///
|
2007-11-23 16:18:18 +00:00
|
|
|
/// @param op The Create operation to be processed.
|
2006-12-26 18:46:07 +00:00
|
|
|
/// @param res The result of the operation is returned here.
|
2007-11-23 16:18:18 +00:00
|
|
|
void BaseMind::sightCreateOperation(const Operation & op, OpVector & res)
|
2000-11-19 20:18:24 +00:00
|
|
|
{
|
2007-11-23 16:18:18 +00:00
|
|
|
const std::vector<Root> & args = op->getArgs();
|
2005-08-27 14:52:12 +00:00
|
|
|
if (args.empty()) {
|
2001-08-14 17:52:50 +00:00
|
|
|
debug( std::cout << " no args!" << std::endl << std::flush;);
|
2004-09-03 Al Riddoch <alriddoch@zepler.org>
* client/CharacterClient.cpp, client/CharacterClient.h,
client/CommClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, common/OOGThing.cpp,
common/OOGThing.h, common/op_switch.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h,
rulesets/Character.cpp, rulesets/Character.h,
rulesets/Creator.cpp, rulesets/Creator.h, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/Food.cpp, rulesets/Food.h,
rulesets/Missile.h, rulesets/Plant.cpp, rulesets/Plant.h,
rulesets/PythonMindScript.cpp, rulesets/PythonThingScript.cpp,
rulesets/Stackable.cpp, rulesets/Stackable.h, rulesets/Thing.cpp,
rulesets/Thing.h, rulesets/World.cpp, rulesets/World.h,
server/Account.cpp, server/Account.h, server/Admin.cpp,
server/Admin.h, server/CommClient.cpp, server/Connection.cpp,
server/Connection.h, server/ExternalMind.cpp, server/ExternalMind.h,
server/Lobby.cpp, server/Lobby.h, server/Player.cpp,
server/Player.h, server/WorldRouter.cpp:
Re-work basic op dispatch mechanism so result is passed by
a reference argument rather than returning by value.
2004-09-03 00:33:19 +00:00
|
|
|
return;
|
2000-11-19 20:18:24 +00:00
|
|
|
}
|
2005-09-08 Al Riddoch <alriddoch@zepler.org>
* rulesets/Entity.cpp: Update copyright date.
* rulesets/BaseMind.cpp, rulesets/Entity_getLocation.h,
rulesets/Entity.h, rulesets/MemMap.cpp, rulesets/MemMap.h,
rulesets/Py_Map.cpp, server/EntityFactory.cpp,
server/EntityFactory.h, server/WorldRouter.cpp,
client/BaseClient.cpp, client/CreatorClient.cpp:
Change various methods to pass entity information
around as RootEntity rather than MapType.
2005-09-08 15:03:31 +00:00
|
|
|
RootEntity ent(smart_dynamic_cast<RootEntity>(args.front()));
|
|
|
|
|
if (!ent.isValid()) {
|
|
|
|
|
log(ERROR, "Got sight(create) of non-entity");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2004-07-20 17:03:02 +00:00
|
|
|
// This does not send a look, so anything added this way will not
|
|
|
|
|
// get flagged as visible until we get an appearance. This is important.
|
2007-11-23 16:18:18 +00:00
|
|
|
m_map.updateAdd(ent, op->getSeconds());
|
2000-11-19 20:18:24 +00:00
|
|
|
}
|
|
|
|
|
|
2006-12-26 18:46:07 +00:00
|
|
|
/// \brief Process the Sight of a Delete operation.
|
|
|
|
|
///
|
2007-11-23 16:18:18 +00:00
|
|
|
/// @param op The Delete operation to be processed.
|
2006-12-26 18:46:07 +00:00
|
|
|
/// @param res The result of the operation is returned here.
|
2007-11-23 16:18:18 +00:00
|
|
|
void BaseMind::sightDeleteOperation(const Operation & op, OpVector & res)
|
2000-11-19 20:18:24 +00:00
|
|
|
{
|
2001-08-14 17:52:50 +00:00
|
|
|
debug( std::cout << "Sight Delete operation" << std::endl << std::flush;);
|
2007-11-23 16:18:18 +00:00
|
|
|
const std::vector<Root> & args = op->getArgs();
|
2005-08-27 14:52:12 +00:00
|
|
|
if (args.empty()) {
|
2001-08-14 17:52:50 +00:00
|
|
|
debug( std::cout << " no args!" << std::endl << std::flush;);
|
2004-09-03 Al Riddoch <alriddoch@zepler.org>
* client/CharacterClient.cpp, client/CharacterClient.h,
client/CommClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, common/OOGThing.cpp,
common/OOGThing.h, common/op_switch.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h,
rulesets/Character.cpp, rulesets/Character.h,
rulesets/Creator.cpp, rulesets/Creator.h, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/Food.cpp, rulesets/Food.h,
rulesets/Missile.h, rulesets/Plant.cpp, rulesets/Plant.h,
rulesets/PythonMindScript.cpp, rulesets/PythonThingScript.cpp,
rulesets/Stackable.cpp, rulesets/Stackable.h, rulesets/Thing.cpp,
rulesets/Thing.h, rulesets/World.cpp, rulesets/World.h,
server/Account.cpp, server/Account.h, server/Admin.cpp,
server/Admin.h, server/CommClient.cpp, server/Connection.cpp,
server/Connection.h, server/ExternalMind.cpp, server/ExternalMind.h,
server/Lobby.cpp, server/Lobby.h, server/Player.cpp,
server/Player.h, server/WorldRouter.cpp:
Re-work basic op dispatch mechanism so result is passed by
a reference argument rather than returning by value.
2004-09-03 00:33:19 +00:00
|
|
|
return;
|
2000-11-19 20:18:24 +00:00
|
|
|
}
|
2005-08-27 14:52:12 +00:00
|
|
|
const Root & obj = args.front();
|
2009-05-19 17:56:27 +01:00
|
|
|
if (!obj.isValid()) {
|
|
|
|
|
log(ERROR, "Sight Delete with invalid entity");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2005-08-27 14:52:12 +00:00
|
|
|
const std::string & id = obj->getId();
|
|
|
|
|
if (!id.empty()) {
|
|
|
|
|
m_map.del(obj->getId());
|
2000-11-19 20:18:24 +00:00
|
|
|
} else {
|
2005-08-27 14:52:12 +00:00
|
|
|
log(WARNING, "Sight Delete with no ID");
|
2000-11-19 20:18:24 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-26 18:46:07 +00:00
|
|
|
/// \brief Process the Sight of a Move operation.
|
|
|
|
|
///
|
2007-11-23 16:18:18 +00:00
|
|
|
/// @param op The Move operation to be processed.
|
2006-12-26 18:46:07 +00:00
|
|
|
/// @param res The result of the operation is returned here.
|
2007-11-23 16:18:18 +00:00
|
|
|
void BaseMind::sightMoveOperation(const Operation & op, OpVector & res)
|
2000-11-19 20:18:24 +00:00
|
|
|
{
|
2001-08-14 17:52:50 +00:00
|
|
|
debug( std::cout << "BaseMind::sightOperation(Sight, Move)" << std::endl << std::flush;);
|
2007-11-23 16:18:18 +00:00
|
|
|
const std::vector<Root> & args = op->getArgs();
|
2005-08-27 14:52:12 +00:00
|
|
|
if (args.empty()) {
|
2001-08-14 17:52:50 +00:00
|
|
|
debug( std::cout << " no args!" << std::endl << std::flush;);
|
2004-09-03 Al Riddoch <alriddoch@zepler.org>
* client/CharacterClient.cpp, client/CharacterClient.h,
client/CommClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, common/OOGThing.cpp,
common/OOGThing.h, common/op_switch.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h,
rulesets/Character.cpp, rulesets/Character.h,
rulesets/Creator.cpp, rulesets/Creator.h, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/Food.cpp, rulesets/Food.h,
rulesets/Missile.h, rulesets/Plant.cpp, rulesets/Plant.h,
rulesets/PythonMindScript.cpp, rulesets/PythonThingScript.cpp,
rulesets/Stackable.cpp, rulesets/Stackable.h, rulesets/Thing.cpp,
rulesets/Thing.h, rulesets/World.cpp, rulesets/World.h,
server/Account.cpp, server/Account.h, server/Admin.cpp,
server/Admin.h, server/CommClient.cpp, server/Connection.cpp,
server/Connection.h, server/ExternalMind.cpp, server/ExternalMind.h,
server/Lobby.cpp, server/Lobby.h, server/Player.cpp,
server/Player.h, server/WorldRouter.cpp:
Re-work basic op dispatch mechanism so result is passed by
a reference argument rather than returning by value.
2004-09-03 00:33:19 +00:00
|
|
|
return;
|
2000-11-19 20:18:24 +00:00
|
|
|
}
|
2005-09-08 Al Riddoch <alriddoch@zepler.org>
* rulesets/Entity.cpp: Update copyright date.
* rulesets/BaseMind.cpp, rulesets/Entity_getLocation.h,
rulesets/Entity.h, rulesets/MemMap.cpp, rulesets/MemMap.h,
rulesets/Py_Map.cpp, server/EntityFactory.cpp,
server/EntityFactory.h, server/WorldRouter.cpp,
client/BaseClient.cpp, client/CreatorClient.cpp:
Change various methods to pass entity information
around as RootEntity rather than MapType.
2005-09-08 15:03:31 +00:00
|
|
|
RootEntity ent(smart_dynamic_cast<RootEntity>(args.front()));
|
|
|
|
|
if (!ent.isValid()) {
|
|
|
|
|
log(ERROR, "Got sight(move) of non-entity");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2007-11-23 16:18:18 +00:00
|
|
|
m_map.updateAdd(ent, op->getSeconds());
|
2000-11-19 20:18:24 +00:00
|
|
|
}
|
|
|
|
|
|
2006-12-26 18:46:07 +00:00
|
|
|
/// \brief Process the Sight of a Set operation.
|
|
|
|
|
///
|
2007-11-23 16:18:18 +00:00
|
|
|
/// @param op The Set operation to be processed.
|
2006-12-26 18:46:07 +00:00
|
|
|
/// @param res The result of the operation is returned here.
|
2007-11-23 16:18:18 +00:00
|
|
|
void BaseMind::sightSetOperation(const Operation & op, OpVector & res)
|
2000-11-19 20:18:24 +00:00
|
|
|
{
|
2007-11-23 16:18:18 +00:00
|
|
|
const std::vector<Root> & args = op->getArgs();
|
2005-08-27 14:52:12 +00:00
|
|
|
if (args.empty()) {
|
2001-08-14 17:52:50 +00:00
|
|
|
debug( std::cout << " no args!" << std::endl << std::flush;);
|
2004-09-03 Al Riddoch <alriddoch@zepler.org>
* client/CharacterClient.cpp, client/CharacterClient.h,
client/CommClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, common/OOGThing.cpp,
common/OOGThing.h, common/op_switch.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h,
rulesets/Character.cpp, rulesets/Character.h,
rulesets/Creator.cpp, rulesets/Creator.h, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/Food.cpp, rulesets/Food.h,
rulesets/Missile.h, rulesets/Plant.cpp, rulesets/Plant.h,
rulesets/PythonMindScript.cpp, rulesets/PythonThingScript.cpp,
rulesets/Stackable.cpp, rulesets/Stackable.h, rulesets/Thing.cpp,
rulesets/Thing.h, rulesets/World.cpp, rulesets/World.h,
server/Account.cpp, server/Account.h, server/Admin.cpp,
server/Admin.h, server/CommClient.cpp, server/Connection.cpp,
server/Connection.h, server/ExternalMind.cpp, server/ExternalMind.h,
server/Lobby.cpp, server/Lobby.h, server/Player.cpp,
server/Player.h, server/WorldRouter.cpp:
Re-work basic op dispatch mechanism so result is passed by
a reference argument rather than returning by value.
2004-09-03 00:33:19 +00:00
|
|
|
return;
|
2000-11-19 20:18:24 +00:00
|
|
|
}
|
2005-09-08 Al Riddoch <alriddoch@zepler.org>
* rulesets/Entity.cpp: Update copyright date.
* rulesets/BaseMind.cpp, rulesets/Entity_getLocation.h,
rulesets/Entity.h, rulesets/MemMap.cpp, rulesets/MemMap.h,
rulesets/Py_Map.cpp, server/EntityFactory.cpp,
server/EntityFactory.h, server/WorldRouter.cpp,
client/BaseClient.cpp, client/CreatorClient.cpp:
Change various methods to pass entity information
around as RootEntity rather than MapType.
2005-09-08 15:03:31 +00:00
|
|
|
RootEntity ent(smart_dynamic_cast<RootEntity>(args.front()));
|
|
|
|
|
if (!ent.isValid()) {
|
|
|
|
|
log(ERROR, "Got sight(set) of non-entity");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2007-11-23 16:18:18 +00:00
|
|
|
m_map.updateAdd(ent, op->getSeconds());
|
2000-11-19 20:18:24 +00:00
|
|
|
}
|
|
|
|
|
|
2004-12-06 Al Riddoch <alriddoch@zepler.org>
* client/BaseClient.cpp, client/BaseClient.h, client/CreatorClient.cpp,
client/CreatorClient.h, common/BaseEntity.cpp, common/BaseEntity.h,
common/BaseWorld.h, common/OOGThing.cpp, common/OOGThing.h,
common/op_switch.h, common/refno.h, common/types.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h, rulesets/Character.cpp,
rulesets/Character.h, rulesets/Creator.cpp, rulesets/Creator.h,
rulesets/Entity.cpp, rulesets/Entity.h, rulesets/Food.cpp,
rulesets/Food.h, rulesets/MemMap.cpp, rulesets/Plant.cpp,
rulesets/Plant.h, rulesets/Py_Map.cpp, rulesets/PythonMindScript.cpp,
rulesets/PythonThingScript.cpp, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/Thing.cpp, rulesets/Thing.h,
rulesets/World.cpp, rulesets/World.h, server/Account.cpp,
server/Account.h, server/Admin.cpp, server/Admin.h,
server/CommClient.cpp, server/Connection.cpp, server/Connection.h,
server/Connection_methods.h, server/ExternalMind.cpp,
server/ExternalMind.h, server/Lobby.cpp, server/Lobby.h,
server/Player.cpp, server/Player.h, server/WorldRouter.cpp,
server/WorldRouter.h, tests/Creatortest.cpp, tests/Worldtest.cpp:
Add a new Operation typedef to clean up headers, and get round
limitation in doxygen.
2004-12-06 16:35:44 +00:00
|
|
|
void BaseMind::SoundOperation(const Operation & op, OpVector & res)
|
2000-08-25 17:51:43 +00:00
|
|
|
{
|
2001-04-11 14:34:15 +00:00
|
|
|
// Deliver argument to sound things
|
2006-07-31 17:58:01 +00:00
|
|
|
// Louder sounds might eventually make character wake up
|
2013-01-22 19:55:06 +00:00
|
|
|
if (!isAwake()) { return; }
|
2005-08-27 14:52:12 +00:00
|
|
|
const std::vector<Root> & args = op->getArgs();
|
|
|
|
|
if (args.empty()) {
|
2001-08-14 17:52:50 +00:00
|
|
|
debug( std::cout << " no args!" << std::endl << std::flush;);
|
2004-09-03 Al Riddoch <alriddoch@zepler.org>
* client/CharacterClient.cpp, client/CharacterClient.h,
client/CommClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, common/OOGThing.cpp,
common/OOGThing.h, common/op_switch.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h,
rulesets/Character.cpp, rulesets/Character.h,
rulesets/Creator.cpp, rulesets/Creator.h, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/Food.cpp, rulesets/Food.h,
rulesets/Missile.h, rulesets/Plant.cpp, rulesets/Plant.h,
rulesets/PythonMindScript.cpp, rulesets/PythonThingScript.cpp,
rulesets/Stackable.cpp, rulesets/Stackable.h, rulesets/Thing.cpp,
rulesets/Thing.h, rulesets/World.cpp, rulesets/World.h,
server/Account.cpp, server/Account.h, server/Admin.cpp,
server/Admin.h, server/CommClient.cpp, server/Connection.cpp,
server/Connection.h, server/ExternalMind.cpp, server/ExternalMind.h,
server/Lobby.cpp, server/Lobby.h, server/Player.cpp,
server/Player.h, server/WorldRouter.cpp:
Re-work basic op dispatch mechanism so result is passed by
a reference argument rather than returning by value.
2004-09-03 00:33:19 +00:00
|
|
|
return;
|
2000-11-29 15:19:36 +00:00
|
|
|
}
|
2005-08-27 14:52:12 +00:00
|
|
|
const Root & arg = args.front();
|
|
|
|
|
Operation op2(Atlas::Objects::smart_dynamic_cast<Operation>(arg));
|
|
|
|
|
if (op2.isValid()) {
|
2001-08-14 17:52:50 +00:00
|
|
|
debug( std::cout << " args is an op!" << std::endl << std::flush;);
|
2006-08-01 15:37:17 +00:00
|
|
|
std::string event_name("sound_");
|
|
|
|
|
event_name += op2->getParents().front();
|
|
|
|
|
|
2011-10-13 14:20:46 +01:00
|
|
|
if (m_script == 0 || m_script->operation(event_name, op2, res) == 0) {
|
2007-11-23 16:18:18 +00:00
|
|
|
callSoundOperation(op2, res);
|
2006-08-01 15:37:17 +00:00
|
|
|
}
|
2000-11-29 15:19:36 +00:00
|
|
|
}
|
2000-11-19 20:18:24 +00:00
|
|
|
}
|
|
|
|
|
|
2004-12-06 Al Riddoch <alriddoch@zepler.org>
* client/BaseClient.cpp, client/BaseClient.h, client/CreatorClient.cpp,
client/CreatorClient.h, common/BaseEntity.cpp, common/BaseEntity.h,
common/BaseWorld.h, common/OOGThing.cpp, common/OOGThing.h,
common/op_switch.h, common/refno.h, common/types.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h, rulesets/Character.cpp,
rulesets/Character.h, rulesets/Creator.cpp, rulesets/Creator.h,
rulesets/Entity.cpp, rulesets/Entity.h, rulesets/Food.cpp,
rulesets/Food.h, rulesets/MemMap.cpp, rulesets/Plant.cpp,
rulesets/Plant.h, rulesets/Py_Map.cpp, rulesets/PythonMindScript.cpp,
rulesets/PythonThingScript.cpp, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/Thing.cpp, rulesets/Thing.h,
rulesets/World.cpp, rulesets/World.h, server/Account.cpp,
server/Account.h, server/Admin.cpp, server/Admin.h,
server/CommClient.cpp, server/Connection.cpp, server/Connection.h,
server/Connection_methods.h, server/ExternalMind.cpp,
server/ExternalMind.h, server/Lobby.cpp, server/Lobby.h,
server/Player.cpp, server/Player.h, server/WorldRouter.cpp,
server/WorldRouter.h, tests/Creatortest.cpp, tests/Worldtest.cpp:
Add a new Operation typedef to clean up headers, and get round
limitation in doxygen.
2004-12-06 16:35:44 +00:00
|
|
|
void BaseMind::SightOperation(const Operation & op, OpVector & res)
|
2000-08-25 17:51:43 +00:00
|
|
|
{
|
2005-09-18 Al Riddoch <alriddoch@zepler.org>
* rulesets/PythonMindScript.cpp, rulesets/PythonMindScript.h,
rulesets/PythonThingScript.cpp, rulesets/PythonThingScript.h
rulesets/PythonScript.h, rulesets/Script.cpp, rulesets/Script.h:
Clean up script API.
* rulesets/BaseMind.cpp, rulesets/Character.cpp, rulesets/Entity.cpp,
rulesets/Food.cpp, rulesets/Plant.cpp, rulesets/Stackable.cpp,
rulesets/Thing.cpp: Modify script calls to new API.
* rulesets/BaseMind.cpp, rulesets/BaseMind.h: All sub_op calls now
take const ref for sub_op argument.
2005-09-18 00:55:58 +00:00
|
|
|
debug( std::cout << "BaseMind::SightOperation(Sight)" << std::endl << std::flush;);
|
2001-04-11 14:34:15 +00:00
|
|
|
// Deliver argument to sight things
|
2013-01-22 19:55:06 +00:00
|
|
|
if (!isAwake()) { return; }
|
2005-08-27 14:52:12 +00:00
|
|
|
const std::vector<Root> & args = op->getArgs();
|
|
|
|
|
if (args.empty()) {
|
2001-08-14 17:52:50 +00:00
|
|
|
debug( std::cout << " no args!" << std::endl << std::flush;);
|
2004-09-03 Al Riddoch <alriddoch@zepler.org>
* client/CharacterClient.cpp, client/CharacterClient.h,
client/CommClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, common/OOGThing.cpp,
common/OOGThing.h, common/op_switch.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h,
rulesets/Character.cpp, rulesets/Character.h,
rulesets/Creator.cpp, rulesets/Creator.h, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/Food.cpp, rulesets/Food.h,
rulesets/Missile.h, rulesets/Plant.cpp, rulesets/Plant.h,
rulesets/PythonMindScript.cpp, rulesets/PythonThingScript.cpp,
rulesets/Stackable.cpp, rulesets/Stackable.h, rulesets/Thing.cpp,
rulesets/Thing.h, rulesets/World.cpp, rulesets/World.h,
server/Account.cpp, server/Account.h, server/Admin.cpp,
server/Admin.h, server/CommClient.cpp, server/Connection.cpp,
server/Connection.h, server/ExternalMind.cpp, server/ExternalMind.h,
server/Lobby.cpp, server/Lobby.h, server/Player.cpp,
server/Player.h, server/WorldRouter.cpp:
Re-work basic op dispatch mechanism so result is passed by
a reference argument rather than returning by value.
2004-09-03 00:33:19 +00:00
|
|
|
return;
|
2000-11-19 20:18:24 +00:00
|
|
|
}
|
2005-08-27 14:52:12 +00:00
|
|
|
const Root & arg = args.front();
|
|
|
|
|
Operation op2(Atlas::Objects::smart_dynamic_cast<Operation>(arg));
|
|
|
|
|
if (op2.isValid()) {
|
2001-08-14 17:52:50 +00:00
|
|
|
debug( std::cout << " args is an op!" << std::endl << std::flush;);
|
2006-08-01 15:37:17 +00:00
|
|
|
std::string event_name("sight_");
|
|
|
|
|
event_name += op2->getParents().front();
|
|
|
|
|
|
2015-09-27 22:38:32 +02:00
|
|
|
//Check that the argument had seconds set; if not the timestamp of the updates will be wrong.
|
|
|
|
|
if (!op2->hasAttrFlag(Atlas::Objects::Operation::SECONDS_FLAG)) {
|
|
|
|
|
//Copy from wrapping op to fix this. This indicates an error in the server.
|
|
|
|
|
op2->setSeconds(op->getSeconds());
|
2016-03-12 14:02:51 +01:00
|
|
|
log(WARNING, String::compose("Sight op argument had no seconds set, for argument %1.", op2->getParents().front()));
|
2015-09-27 22:38:32 +02:00
|
|
|
}
|
|
|
|
|
|
2011-10-13 14:20:46 +01:00
|
|
|
if (m_script == 0 || m_script->operation(event_name, op2, res) == 0) {
|
2007-11-23 16:18:18 +00:00
|
|
|
callSightOperation(op2, res);
|
2006-08-01 15:37:17 +00:00
|
|
|
}
|
2003-08-07 23:03:26 +00:00
|
|
|
} else /* if (op2->getObjtype() == "object") */ {
|
2005-09-08 Al Riddoch <alriddoch@zepler.org>
* rulesets/Entity.cpp: Update copyright date.
* rulesets/BaseMind.cpp, rulesets/Entity_getLocation.h,
rulesets/Entity.h, rulesets/MemMap.cpp, rulesets/MemMap.h,
rulesets/Py_Map.cpp, server/EntityFactory.cpp,
server/EntityFactory.h, server/WorldRouter.cpp,
client/BaseClient.cpp, client/CreatorClient.cpp:
Change various methods to pass entity information
around as RootEntity rather than MapType.
2005-09-08 15:03:31 +00:00
|
|
|
RootEntity ent(Atlas::Objects::smart_dynamic_cast<RootEntity>(arg));
|
|
|
|
|
if (!ent.isValid()) {
|
|
|
|
|
log(ERROR, "Arg of sigh operation is not an op or an entity");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2001-08-14 17:52:50 +00:00
|
|
|
debug( std::cout << " arg is an entity!" << std::endl << std::flush;);
|
2005-09-08 Al Riddoch <alriddoch@zepler.org>
* rulesets/Entity.cpp: Update copyright date.
* rulesets/BaseMind.cpp, rulesets/Entity_getLocation.h,
rulesets/Entity.h, rulesets/MemMap.cpp, rulesets/MemMap.h,
rulesets/Py_Map.cpp, server/EntityFactory.cpp,
server/EntityFactory.h, server/WorldRouter.cpp,
client/BaseClient.cpp, client/CreatorClient.cpp:
Change various methods to pass entity information
around as RootEntity rather than MapType.
2005-09-08 15:03:31 +00:00
|
|
|
MemEntity * me = m_map.updateAdd(ent, op->getSeconds());
|
2004-07-20 17:03:02 +00:00
|
|
|
if (me != 0) {
|
|
|
|
|
me->setVisible();
|
|
|
|
|
}
|
2000-11-19 20:18:24 +00:00
|
|
|
}
|
2000-08-25 17:51:43 +00:00
|
|
|
}
|
|
|
|
|
|
2015-05-12 21:12:11 +02:00
|
|
|
void BaseMind::ThinkOperation(const Operation &op, OpVector &res)
|
|
|
|
|
{
|
|
|
|
|
//Get the contained op
|
|
|
|
|
debug(std::cout << "BaseMind::ThinkOperation(Think)" << std::endl << std::flush
|
|
|
|
|
;);
|
|
|
|
|
const std::vector<Root> & args = op->getArgs();
|
|
|
|
|
if (args.empty()) {
|
|
|
|
|
debug(std::cout << " no args!" << std::endl << std::flush
|
|
|
|
|
;);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const Root & arg = args.front();
|
|
|
|
|
Operation op2(Atlas::Objects::smart_dynamic_cast<Operation>(arg));
|
|
|
|
|
if (op2.isValid()) {
|
|
|
|
|
debug(std::cout << " args is an op!" << std::endl << std::flush
|
|
|
|
|
;);
|
|
|
|
|
std::string event_name("think_");
|
|
|
|
|
event_name += op2->getParents().front();
|
|
|
|
|
|
|
|
|
|
OpVector mres;
|
|
|
|
|
|
|
|
|
|
if (m_script == nullptr || m_script->operation(event_name, op2, mres) == 0) {
|
|
|
|
|
int op2ClassNo = op2->getClassNo();
|
|
|
|
|
switch (op2ClassNo) {
|
|
|
|
|
case Atlas::Objects::Operation::SET_NO:
|
|
|
|
|
thinkSetOperation(op2, mres);
|
|
|
|
|
break;
|
|
|
|
|
case Atlas::Objects::Operation::DELETE_NO:
|
|
|
|
|
thinkDeleteOperation(op2, mres);
|
|
|
|
|
break;
|
|
|
|
|
case Atlas::Objects::Operation::GET_NO:
|
|
|
|
|
thinkGetOperation(op2, mres);
|
|
|
|
|
break;
|
|
|
|
|
case Atlas::Objects::Operation::LOOK_NO:
|
|
|
|
|
thinkLookOperation(op2, mres);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2015-09-25 21:25:04 +02:00
|
|
|
log(WARNING, "Got invalid Think operation. We only support 'Set', 'Delete', 'Get' and 'Look'.");
|
2015-05-12 21:12:11 +02:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!mres.empty() && !op->isDefaultSerialno()) {
|
|
|
|
|
mres.front()->setRefno(op->getSerialno());
|
|
|
|
|
}
|
|
|
|
|
for (auto& resOp : mres) {
|
|
|
|
|
res.push_back(resOp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BaseMind::thinkSetOperation(const Operation & op, OpVector & res)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BaseMind::thinkDeleteOperation(const Operation & op, OpVector & res)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BaseMind::thinkGetOperation(const Operation & op, OpVector & res)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BaseMind::thinkLookOperation(const Operation & op, OpVector & res)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2004-12-06 Al Riddoch <alriddoch@zepler.org>
* client/BaseClient.cpp, client/BaseClient.h, client/CreatorClient.cpp,
client/CreatorClient.h, common/BaseEntity.cpp, common/BaseEntity.h,
common/BaseWorld.h, common/OOGThing.cpp, common/OOGThing.h,
common/op_switch.h, common/refno.h, common/types.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h, rulesets/Character.cpp,
rulesets/Character.h, rulesets/Creator.cpp, rulesets/Creator.h,
rulesets/Entity.cpp, rulesets/Entity.h, rulesets/Food.cpp,
rulesets/Food.h, rulesets/MemMap.cpp, rulesets/Plant.cpp,
rulesets/Plant.h, rulesets/Py_Map.cpp, rulesets/PythonMindScript.cpp,
rulesets/PythonThingScript.cpp, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/Thing.cpp, rulesets/Thing.h,
rulesets/World.cpp, rulesets/World.h, server/Account.cpp,
server/Account.h, server/Admin.cpp, server/Admin.h,
server/CommClient.cpp, server/Connection.cpp, server/Connection.h,
server/Connection_methods.h, server/ExternalMind.cpp,
server/ExternalMind.h, server/Lobby.cpp, server/Lobby.h,
server/Player.cpp, server/Player.h, server/WorldRouter.cpp,
server/WorldRouter.h, tests/Creatortest.cpp, tests/Worldtest.cpp:
Add a new Operation typedef to clean up headers, and get round
limitation in doxygen.
2004-12-06 16:35:44 +00:00
|
|
|
void BaseMind::AppearanceOperation(const Operation & op, OpVector & res)
|
2001-03-07 11:49:43 +00:00
|
|
|
{
|
2013-01-22 19:55:06 +00:00
|
|
|
if (!isAwake()) { return; }
|
2005-08-27 14:52:12 +00:00
|
|
|
const std::vector<Root> & args = op->getArgs();
|
|
|
|
|
std::vector<Root>::const_iterator Iend = args.end();
|
|
|
|
|
for (std::vector<Root>::const_iterator I = args.begin(); I != Iend; ++I) {
|
2006-05-06 Al Riddoch <alriddoch@zepler.org>
* common/Database.cpp, common/newid.cpp, server/server.cpp:
Modify new ID checks so that code still runs when database is
unavailable, and events requiring new IDs fail cleanly.
* server/Connection.cpp: Report a failure to create a player
account if no ID available.
* rulesets/BaseMind.cpp: When processing appearance ops, handle
stamp more efficiently, report an error if ID is missing
from argument.
* server/IdlePSQLConnector.cpp, server/IdlePSQLConnector.h:
Implement re-connecting to the Database if connection is lost.
* rulesets/Character.cpp, rulesets/Entity.cpp, rulesets/Thing.cpp:
Ensure STAMP is present on appearance op args.
* server/CommListener.cpp, server/CommListener.h,
server/CommPeerListener.cpp, server/CommPeerListener.h,
server/CommSlaveListener.cpp, server/CommSlaveListener.h,
server/CommUnixListener.cpp, server/CommUnixListener.h:
Add a return value to method for creating new client socket
objects, and use it to return failure if no ID is available
from the database for a new object.
* rulesets/Py_Point3D.cpp, rulesets/Py_Vector3D.cpp,
rulesets/Python_API.cpp: Add "new" method for class wrappers, and
call the in place constructor from new rather than init. Re-write
internal function for creating new instances so it uses the "new"
method.
* rulesets/Py_Statistics.cpp: Remove some obsolete code inadvertedly
copied from another file. Comment out some unused code to get rid
of a warning.
* server/CommPSQLSocket.cpp: Clear the database connection from
destructor.
* tests/python_class.cpp: A new test for experimenting with new
Python wrappers.
2006-05-06 21:36:57 +00:00
|
|
|
if (!(*I)->hasAttrFlag(Atlas::Objects::ID_FLAG)) {
|
|
|
|
|
log(ERROR, "BaseMind: Appearance op does not have ID");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2005-08-27 14:52:12 +00:00
|
|
|
const std::string & id = (*I)->getId();
|
|
|
|
|
MemEntity * me = m_map.getAdd(id);
|
2004-07-20 17:03:02 +00:00
|
|
|
if (me != 0) {
|
2006-05-06 Al Riddoch <alriddoch@zepler.org>
* common/Database.cpp, common/newid.cpp, server/server.cpp:
Modify new ID checks so that code still runs when database is
unavailable, and events requiring new IDs fail cleanly.
* server/Connection.cpp: Report a failure to create a player
account if no ID available.
* rulesets/BaseMind.cpp: When processing appearance ops, handle
stamp more efficiently, report an error if ID is missing
from argument.
* server/IdlePSQLConnector.cpp, server/IdlePSQLConnector.h:
Implement re-connecting to the Database if connection is lost.
* rulesets/Character.cpp, rulesets/Entity.cpp, rulesets/Thing.cpp:
Ensure STAMP is present on appearance op args.
* server/CommListener.cpp, server/CommListener.h,
server/CommPeerListener.cpp, server/CommPeerListener.h,
server/CommSlaveListener.cpp, server/CommSlaveListener.h,
server/CommUnixListener.cpp, server/CommUnixListener.h:
Add a return value to method for creating new client socket
objects, and use it to return failure if no ID is available
from the database for a new object.
* rulesets/Py_Point3D.cpp, rulesets/Py_Vector3D.cpp,
rulesets/Python_API.cpp: Add "new" method for class wrappers, and
call the in place constructor from new rather than init. Re-write
internal function for creating new instances so it uses the "new"
method.
* rulesets/Py_Statistics.cpp: Remove some obsolete code inadvertedly
copied from another file. Comment out some unused code to get rid
of a warning.
* server/CommPSQLSocket.cpp: Clear the database connection from
destructor.
* tests/python_class.cpp: A new test for experimenting with new
Python wrappers.
2006-05-06 21:36:57 +00:00
|
|
|
if ((*I)->hasAttrFlag(Atlas::Objects::STAMP_FLAG)) {
|
|
|
|
|
if ((int)(*I)->getStamp() != me->getSeq()) {
|
|
|
|
|
Look l;
|
|
|
|
|
Anonymous m;
|
|
|
|
|
m->setId(id);
|
|
|
|
|
l->setArgs1(m);
|
|
|
|
|
res.push_back(l);
|
2005-12-13 18:41:40 +00:00
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
log(ERROR, "BaseMind: Appearance op does not have stamp");
|
|
|
|
|
}
|
2005-08-27 14:52:12 +00:00
|
|
|
me->update(op->getSeconds());
|
2004-07-20 17:03:02 +00:00
|
|
|
me->setVisible();
|
|
|
|
|
}
|
2001-03-07 11:49:43 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-12-06 Al Riddoch <alriddoch@zepler.org>
* client/BaseClient.cpp, client/BaseClient.h, client/CreatorClient.cpp,
client/CreatorClient.h, common/BaseEntity.cpp, common/BaseEntity.h,
common/BaseWorld.h, common/OOGThing.cpp, common/OOGThing.h,
common/op_switch.h, common/refno.h, common/types.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h, rulesets/Character.cpp,
rulesets/Character.h, rulesets/Creator.cpp, rulesets/Creator.h,
rulesets/Entity.cpp, rulesets/Entity.h, rulesets/Food.cpp,
rulesets/Food.h, rulesets/MemMap.cpp, rulesets/Plant.cpp,
rulesets/Plant.h, rulesets/Py_Map.cpp, rulesets/PythonMindScript.cpp,
rulesets/PythonThingScript.cpp, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/Thing.cpp, rulesets/Thing.h,
rulesets/World.cpp, rulesets/World.h, server/Account.cpp,
server/Account.h, server/Admin.cpp, server/Admin.h,
server/CommClient.cpp, server/Connection.cpp, server/Connection.h,
server/Connection_methods.h, server/ExternalMind.cpp,
server/ExternalMind.h, server/Lobby.cpp, server/Lobby.h,
server/Player.cpp, server/Player.h, server/WorldRouter.cpp,
server/WorldRouter.h, tests/Creatortest.cpp, tests/Worldtest.cpp:
Add a new Operation typedef to clean up headers, and get round
limitation in doxygen.
2004-12-06 16:35:44 +00:00
|
|
|
void BaseMind::DisappearanceOperation(const Operation & op, OpVector & res)
|
2001-03-07 11:49:43 +00:00
|
|
|
{
|
2013-01-22 19:55:06 +00:00
|
|
|
if (!isAwake()) { return; }
|
2005-08-27 14:52:12 +00:00
|
|
|
const std::vector<Root> & args = op->getArgs();
|
|
|
|
|
std::vector<Root>::const_iterator Iend = args.end();
|
|
|
|
|
for (std::vector<Root>::const_iterator I = args.begin(); I != Iend; ++I) {
|
|
|
|
|
const std::string & id = (*I)->getId();
|
|
|
|
|
if (id.empty()) { continue; }
|
|
|
|
|
MemEntity * me = m_map.get(id);
|
2004-07-20 17:03:02 +00:00
|
|
|
if (me != 0) {
|
2005-08-27 14:52:12 +00:00
|
|
|
me->update(op->getSeconds());
|
2004-07-20 17:03:02 +00:00
|
|
|
me->setVisible(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-03-07 11:49:43 +00:00
|
|
|
}
|
|
|
|
|
|
2009-08-02 18:29:40 +01:00
|
|
|
void BaseMind::UnseenOperation(const Operation & op, OpVector & res)
|
|
|
|
|
{
|
|
|
|
|
const std::vector<Root> & args = op->getArgs();
|
|
|
|
|
if (args.empty()) {
|
|
|
|
|
debug( std::cout << " no args!" << std::endl << std::flush;);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const Root & arg = args.front();
|
|
|
|
|
if (arg->isDefaultId()) {
|
|
|
|
|
log(ERROR, "BaseMind: Unseen op has no arg ID");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
m_map.del(arg->getId());
|
|
|
|
|
}
|
|
|
|
|
|
2004-12-06 Al Riddoch <alriddoch@zepler.org>
* client/BaseClient.cpp, client/BaseClient.h, client/CreatorClient.cpp,
client/CreatorClient.h, common/BaseEntity.cpp, common/BaseEntity.h,
common/BaseWorld.h, common/OOGThing.cpp, common/OOGThing.h,
common/op_switch.h, common/refno.h, common/types.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h, rulesets/Character.cpp,
rulesets/Character.h, rulesets/Creator.cpp, rulesets/Creator.h,
rulesets/Entity.cpp, rulesets/Entity.h, rulesets/Food.cpp,
rulesets/Food.h, rulesets/MemMap.cpp, rulesets/Plant.cpp,
rulesets/Plant.h, rulesets/Py_Map.cpp, rulesets/PythonMindScript.cpp,
rulesets/PythonThingScript.cpp, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/Thing.cpp, rulesets/Thing.h,
rulesets/World.cpp, rulesets/World.h, server/Account.cpp,
server/Account.h, server/Admin.cpp, server/Admin.h,
server/CommClient.cpp, server/Connection.cpp, server/Connection.h,
server/Connection_methods.h, server/ExternalMind.cpp,
server/ExternalMind.h, server/Lobby.cpp, server/Lobby.h,
server/Player.cpp, server/Player.h, server/WorldRouter.cpp,
server/WorldRouter.h, tests/Creatortest.cpp, tests/Worldtest.cpp:
Add a new Operation typedef to clean up headers, and get round
limitation in doxygen.
2004-12-06 16:35:44 +00:00
|
|
|
void BaseMind::operation(const Operation & op, OpVector & res)
|
2000-08-25 17:51:43 +00:00
|
|
|
{
|
|
|
|
|
// This might end up being quite tricky to do
|
2000-11-19 00:02:29 +00:00
|
|
|
|
|
|
|
|
// In the python the following happens here:
|
|
|
|
|
// Find out if the op refers to any ids we don't know about.
|
|
|
|
|
// If so create look operations to those ids
|
|
|
|
|
// Set the minds time and date
|
2004-09-03 Al Riddoch <alriddoch@zepler.org>
* client/CharacterClient.cpp, client/CharacterClient.h,
client/CommClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, common/OOGThing.cpp,
common/OOGThing.h, common/op_switch.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h,
rulesets/Character.cpp, rulesets/Character.h,
rulesets/Creator.cpp, rulesets/Creator.h, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/Food.cpp, rulesets/Food.h,
rulesets/Missile.h, rulesets/Plant.cpp, rulesets/Plant.h,
rulesets/PythonMindScript.cpp, rulesets/PythonThingScript.cpp,
rulesets/Stackable.cpp, rulesets/Stackable.h, rulesets/Thing.cpp,
rulesets/Thing.h, rulesets/World.cpp, rulesets/World.h,
server/Account.cpp, server/Account.h, server/Admin.cpp,
server/Admin.h, server/CommClient.cpp, server/Connection.cpp,
server/Connection.h, server/ExternalMind.cpp, server/ExternalMind.h,
server/Lobby.cpp, server/Lobby.h, server/Player.cpp,
server/Player.h, server/WorldRouter.cpp:
Re-work basic op dispatch mechanism so result is passed by
a reference argument rather than returning by value.
2004-09-03 00:33:19 +00:00
|
|
|
debug(std::cout << "BaseMind::operation("
|
2005-08-27 14:52:12 +00:00
|
|
|
<< op->getParents().front() << ")"
|
2004-09-03 Al Riddoch <alriddoch@zepler.org>
* client/CharacterClient.cpp, client/CharacterClient.h,
client/CommClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, common/OOGThing.cpp,
common/OOGThing.h, common/op_switch.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h,
rulesets/Character.cpp, rulesets/Character.h,
rulesets/Creator.cpp, rulesets/Creator.h, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/Food.cpp, rulesets/Food.h,
rulesets/Missile.h, rulesets/Plant.cpp, rulesets/Plant.h,
rulesets/PythonMindScript.cpp, rulesets/PythonThingScript.cpp,
rulesets/Stackable.cpp, rulesets/Stackable.h, rulesets/Thing.cpp,
rulesets/Thing.h, rulesets/World.cpp, rulesets/World.h,
server/Account.cpp, server/Account.h, server/Admin.cpp,
server/Admin.h, server/CommClient.cpp, server/Connection.cpp,
server/Connection.h, server/ExternalMind.cpp, server/ExternalMind.h,
server/Lobby.cpp, server/Lobby.h, server/Player.cpp,
server/Player.h, server/WorldRouter.cpp:
Re-work basic op dispatch mechanism so result is passed by
a reference argument rather than returning by value.
2004-09-03 00:33:19 +00:00
|
|
|
<< std::endl << std::flush;);
|
2016-03-20 22:48:28 +01:00
|
|
|
int op_no = op->getClassNo();
|
2005-08-27 14:52:12 +00:00
|
|
|
m_time.update((int)op->getSeconds());
|
|
|
|
|
m_map.check(op->getSeconds());
|
2016-03-20 22:48:28 +01:00
|
|
|
//Unless it's an Unseen op, we should add the entity the op was from.
|
|
|
|
|
if (op_no != Atlas::Objects::Operation::UNSEEN_NO) {
|
|
|
|
|
m_map.getAdd(op->getFrom());
|
|
|
|
|
}
|
2006-07-11 16:29:36 +00:00
|
|
|
m_map.sendLooks(res);
|
2016-03-20 22:48:28 +01:00
|
|
|
if (m_script) {
|
2011-10-13 14:20:46 +01:00
|
|
|
m_script->operation("call_triggers", op, res);
|
|
|
|
|
if (m_script->operation(op->getParents().front(), op, res) != 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2006-08-01 11:17:16 +00:00
|
|
|
}
|
2008-01-17 18:54:04 +00:00
|
|
|
switch (op_no) {
|
|
|
|
|
case Atlas::Objects::Operation::SIGHT_NO:
|
|
|
|
|
SightOperation(op, res);
|
|
|
|
|
break;
|
|
|
|
|
case Atlas::Objects::Operation::SOUND_NO:
|
|
|
|
|
SoundOperation(op, res);
|
|
|
|
|
break;
|
|
|
|
|
case Atlas::Objects::Operation::APPEARANCE_NO:
|
|
|
|
|
AppearanceOperation(op, res);
|
|
|
|
|
break;
|
|
|
|
|
case Atlas::Objects::Operation::DISAPPEARANCE_NO:
|
|
|
|
|
DisappearanceOperation(op, res);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2009-08-02 18:29:40 +01:00
|
|
|
if (op_no == Atlas::Objects::Operation::UNSEEN_NO) {
|
|
|
|
|
UnseenOperation(op, res);
|
2015-05-12 21:12:11 +02:00
|
|
|
} else if (op_no == Atlas::Objects::Operation::THINK_NO) {
|
|
|
|
|
ThinkOperation(op, res);
|
2009-08-02 18:29:40 +01:00
|
|
|
}
|
2008-01-17 18:54:04 +00:00
|
|
|
// ERROR
|
|
|
|
|
break;
|
|
|
|
|
}
|
2000-08-25 17:51:43 +00:00
|
|
|
}
|
|
|
|
|
|
2004-12-06 Al Riddoch <alriddoch@zepler.org>
* client/BaseClient.cpp, client/BaseClient.h, client/CreatorClient.cpp,
client/CreatorClient.h, common/BaseEntity.cpp, common/BaseEntity.h,
common/BaseWorld.h, common/OOGThing.cpp, common/OOGThing.h,
common/op_switch.h, common/refno.h, common/types.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h, rulesets/Character.cpp,
rulesets/Character.h, rulesets/Creator.cpp, rulesets/Creator.h,
rulesets/Entity.cpp, rulesets/Entity.h, rulesets/Food.cpp,
rulesets/Food.h, rulesets/MemMap.cpp, rulesets/Plant.cpp,
rulesets/Plant.h, rulesets/Py_Map.cpp, rulesets/PythonMindScript.cpp,
rulesets/PythonThingScript.cpp, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/Thing.cpp, rulesets/Thing.h,
rulesets/World.cpp, rulesets/World.h, server/Account.cpp,
server/Account.h, server/Admin.cpp, server/Admin.h,
server/CommClient.cpp, server/Connection.cpp, server/Connection.h,
server/Connection_methods.h, server/ExternalMind.cpp,
server/ExternalMind.h, server/Lobby.cpp, server/Lobby.h,
server/Player.cpp, server/Player.h, server/WorldRouter.cpp,
server/WorldRouter.h, tests/Creatortest.cpp, tests/Worldtest.cpp:
Add a new Operation typedef to clean up headers, and get round
limitation in doxygen.
2004-12-06 16:35:44 +00:00
|
|
|
void BaseMind::callSightOperation(const Operation & op,
|
2004-12-03 Al Riddoch <alriddoch@zepler.org>
* 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/Py_CreatorClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, common/BaseWorld.h, common/custom.cpp,
common/inheritance.cpp, common/inheritance.h,
common/inheritance_impl.h, common/op_switch.h, common/type_utils.h,
common/types.h, common/utility.cpp, common/utility.h,
modules/Location.cpp, rulesets/BaseMind.cpp, rulesets/BaseMind.h,
rulesets/Character.cpp, rulesets/Character.h, rulesets/Creator.cpp,
rulesets/Creator.h, rulesets/Entity.cpp, rulesets/Entity.h,
rulesets/EntityProperties.cpp, rulesets/Entity_getLocation.h,
rulesets/Food.cpp, rulesets/Food.h, rulesets/MemMap.cpp,
rulesets/MemMap.h, rulesets/Missile.h, rulesets/Pedestrian.cpp,
rulesets/Plant.cpp, rulesets/Plant.h, rulesets/Py_Mind.cpp,
rulesets/Py_Object.cpp, rulesets/Py_Operation.cpp,
rulesets/Py_Operation.h, rulesets/Py_Thing.cpp,
rulesets/PythonMindScript.h, rulesets/PythonScript.h,
rulesets/PythonThingScript.h, rulesets/Python_API.cpp,
rulesets/Script.cpp, rulesets/Script.h, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/Thing.cpp, rulesets/Thing.h,
rulesets/World.cpp, rulesets/World.h,
server/Account.cpp, server/Account.h server/Admin.cpp, server/Admin.h,
server/CommClient.cpp, 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/Persistor.cpp, server/Player.cpp, server/Player.h,
server/ServerRouting.cpp, server/ServerRouting.h,
server/TrustedConnection.cpp, server/TrustedConnection.h,
server/WorldRouter.cpp, server/WorldRouter.h, tests/Areatest.cpp,
tests/Charactertest.cpp, tests/Creatortest.cpp,
tests/EntityExerciser.h, tests/Entitytest.cpp, tests/Foodtest.cpp,
tests/IGEntityExerciser.h, tests/Linetest.cpp, tests/Planttest.cpp,
tests/Stackabletest.cpp, tests/Structuretest.cpp, tests/Thingtest.cpp,
tests/Worldtest.cpp, tests/allOperations.h, tests/inheritancetest.cpp,
tests/utilitytest.cpp, tools/cycmd.cpp:
Modify the entity interface so that all Operation methods
take references to RootOperation, as its cleaner, and requires
less nasty casts. Clean up operations in headers generally.
2004-12-03 14:49:13 +00:00
|
|
|
OpVector & res)
|
2004-07-20 17:03:02 +00:00
|
|
|
{
|
2007-11-23 16:18:18 +00:00
|
|
|
m_map.getAdd(op->getFrom());
|
2013-02-28 15:39:59 +00:00
|
|
|
auto op_no = op->getClassNo();
|
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
|
|
|
if (debug_flag && (op_no == OP_INVALID)) {
|
2008-11-13 02:33:04 +00:00
|
|
|
debug(std::cout << getId() << " could not deliver sight of "
|
|
|
|
|
<< op->getParents().front()
|
|
|
|
|
<< std::endl << std::flush;);
|
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
|
|
|
}
|
2007-11-23 16:18:18 +00:00
|
|
|
SUB_OP_SWITCH(op, op_no, res, sight)
|
2001-04-05 18:01:12 +00:00
|
|
|
}
|
|
|
|
|
|
2004-12-06 Al Riddoch <alriddoch@zepler.org>
* client/BaseClient.cpp, client/BaseClient.h, client/CreatorClient.cpp,
client/CreatorClient.h, common/BaseEntity.cpp, common/BaseEntity.h,
common/BaseWorld.h, common/OOGThing.cpp, common/OOGThing.h,
common/op_switch.h, common/refno.h, common/types.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h, rulesets/Character.cpp,
rulesets/Character.h, rulesets/Creator.cpp, rulesets/Creator.h,
rulesets/Entity.cpp, rulesets/Entity.h, rulesets/Food.cpp,
rulesets/Food.h, rulesets/MemMap.cpp, rulesets/Plant.cpp,
rulesets/Plant.h, rulesets/Py_Map.cpp, rulesets/PythonMindScript.cpp,
rulesets/PythonThingScript.cpp, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/Thing.cpp, rulesets/Thing.h,
rulesets/World.cpp, rulesets/World.h, server/Account.cpp,
server/Account.h, server/Admin.cpp, server/Admin.h,
server/CommClient.cpp, server/Connection.cpp, server/Connection.h,
server/Connection_methods.h, server/ExternalMind.cpp,
server/ExternalMind.h, server/Lobby.cpp, server/Lobby.h,
server/Player.cpp, server/Player.h, server/WorldRouter.cpp,
server/WorldRouter.h, tests/Creatortest.cpp, tests/Worldtest.cpp:
Add a new Operation typedef to clean up headers, and get round
limitation in doxygen.
2004-12-06 16:35:44 +00:00
|
|
|
void BaseMind::callSoundOperation(const Operation & op,
|
2004-12-03 Al Riddoch <alriddoch@zepler.org>
* 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/Py_CreatorClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, common/BaseWorld.h, common/custom.cpp,
common/inheritance.cpp, common/inheritance.h,
common/inheritance_impl.h, common/op_switch.h, common/type_utils.h,
common/types.h, common/utility.cpp, common/utility.h,
modules/Location.cpp, rulesets/BaseMind.cpp, rulesets/BaseMind.h,
rulesets/Character.cpp, rulesets/Character.h, rulesets/Creator.cpp,
rulesets/Creator.h, rulesets/Entity.cpp, rulesets/Entity.h,
rulesets/EntityProperties.cpp, rulesets/Entity_getLocation.h,
rulesets/Food.cpp, rulesets/Food.h, rulesets/MemMap.cpp,
rulesets/MemMap.h, rulesets/Missile.h, rulesets/Pedestrian.cpp,
rulesets/Plant.cpp, rulesets/Plant.h, rulesets/Py_Mind.cpp,
rulesets/Py_Object.cpp, rulesets/Py_Operation.cpp,
rulesets/Py_Operation.h, rulesets/Py_Thing.cpp,
rulesets/PythonMindScript.h, rulesets/PythonScript.h,
rulesets/PythonThingScript.h, rulesets/Python_API.cpp,
rulesets/Script.cpp, rulesets/Script.h, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/Thing.cpp, rulesets/Thing.h,
rulesets/World.cpp, rulesets/World.h,
server/Account.cpp, server/Account.h server/Admin.cpp, server/Admin.h,
server/CommClient.cpp, 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/Persistor.cpp, server/Player.cpp, server/Player.h,
server/ServerRouting.cpp, server/ServerRouting.h,
server/TrustedConnection.cpp, server/TrustedConnection.h,
server/WorldRouter.cpp, server/WorldRouter.h, tests/Areatest.cpp,
tests/Charactertest.cpp, tests/Creatortest.cpp,
tests/EntityExerciser.h, tests/Entitytest.cpp, tests/Foodtest.cpp,
tests/IGEntityExerciser.h, tests/Linetest.cpp, tests/Planttest.cpp,
tests/Stackabletest.cpp, tests/Structuretest.cpp, tests/Thingtest.cpp,
tests/Worldtest.cpp, tests/allOperations.h, tests/inheritancetest.cpp,
tests/utilitytest.cpp, tools/cycmd.cpp:
Modify the entity interface so that all Operation methods
take references to RootOperation, as its cleaner, and requires
less nasty casts. Clean up operations in headers generally.
2004-12-03 14:49:13 +00:00
|
|
|
OpVector & res)
|
2004-07-20 Al Riddoch <alriddoch@zepler.org>
* client/CreatorClient.cpp, rulesets/BaseMind.cpp,
rulesets/MemEntity.cpp, rulesets/MemEntity.h,
rulesets/MemMap.cpp, rulesets/MemMap.h, rulesets/Py_Map.cpp:
Set time on memory entities when we update them.
* common/BaseWorld.h: Make object accessor const.
* common/Database.cpp, common/Database.h, common/accountbase.cpp,
server/Connection.cpp, server/Persistance.cpp,
server/WorldRouter.cpp: Rename function to get new ID from
database to more correctly reflect its role.
* rulesets/PythonMindScript.cpp: Use get rather than getAdd
to sort out to and from of ops send to mind scripts.
2004-07-20 20:27:56 +00:00
|
|
|
{
|
2006-08-01 15:37:17 +00:00
|
|
|
// This function essentially does nothing now, except add the source
|
|
|
|
|
// of the sound op to the map.
|
2007-11-23 16:18:18 +00:00
|
|
|
m_map.getAdd(op->getFrom());
|
2013-02-28 15:39:59 +00:00
|
|
|
auto op_no = op->getClassNo();
|
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
|
|
|
if (debug_flag && (op_no == OP_INVALID)) {
|
2008-11-13 02:33:04 +00:00
|
|
|
debug(std::cout << getId() << " could not deliver sound of "
|
|
|
|
|
<< op->getParents().front()
|
|
|
|
|
<< std::endl << std::flush;);
|
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
|
|
|
}
|
2004-07-20 17:03:02 +00:00
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
const MemEntityDict & ents = m_map.getEntities();
|
2004-11-06 Al Riddoch <alriddoch@zepler.org>
* aiclient/ClientConnection.cpp, client/BaseClient.cpp,
client/CharacterClient.cpp, client/ClientConnection.cpp,
common/Database.cpp, common/FormattedXMLWriter.cpp,
common/inheritance.cpp, common/refno.h, common/terrain_utils.cpp,
common/type_utils.h, common/utility.cpp, modules/WorldTime.cpp,
modules/WorldTime.h, physics/Collision.cpp, rulesets/Area.cpp,
rulesets/BaseMind.cpp, rulesets/Character.cpp, rulesets/Entity.cpp,
rulesets/Line.cpp, rulesets/MemMap.cpp, rulesets/MemMap_methods.h,
rulesets/Movement.cpp, rulesets/Plant.cpp, rulesets/Py_Map.cpp,
rulesets/Py_Object.cpp, rulesets/Py_Operation.cpp,
rulesets/Py_Oplist.cpp, rulesets/PythonMindScript.cpp,
rulesets/PythonThingScript.cpp, rulesets/Python_API.cpp,
rulesets/Stackable.cpp, rulesets/TerrainProperty.cpp,
rulesets/Thing.cpp, rulesets/World.cpp, server/Account.cpp,
server/CommClient.cpp, server/CommServer.cpp, server/Connection.cpp,
server/EntityFactory.cpp, server/Lobby.cpp, server/Persistance.cpp,
server/Player.cpp, server/Restoration.cpp, server/ServerRouting.cpp,
server/WorldRouter.cpp, tests/EntityExerciser.h,
tests/IGEntityExerciser.h, tests/inheritancetest.cpp,
tools/cycmd.cpp, tools/cyconvertrules.cpp, tools/cydbload.cpp,
tools/cyloadrules.cpp:
Tweak for loops to avoid creating a temporary iterator each
iteration.
* tests/type_utilstest.cpp: New test for function which does
list conversions.
2004-11-06 20:36:03 +00:00
|
|
|
MemEntityDict::const_iterator Iend = ents.end();
|
|
|
|
|
for (MemEntityDict::const_iterator I = ents.begin(); I != Iend; ++I) {
|
2004-07-20 17:03:02 +00:00
|
|
|
std::cout << I->second->getId() << ":" << I->second->getType() << " is "
|
2004-07-21 02:08:05 +00:00
|
|
|
<< ( I->second->isVisible() ? "visible " : "hid " )
|
|
|
|
|
<< I->second->lastSeen()
|
2004-07-20 17:03:02 +00:00
|
|
|
<< std::endl << std::flush;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2007-11-23 16:18:18 +00:00
|
|
|
// SUB_OP_SWITCH(op, op_no, res, sound)
|
2001-04-05 18:01:12 +00:00
|
|
|
}
|