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
|
2005-05-13 23:25:32 +00:00
|
|
|
// Copyright (C) 2001-2005 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
|
2005-05-13 23:25:32 +00:00
|
|
|
|
2006-12-26 Al Riddoch <alriddoch@zepler.org>
* client/CharacterClient.cpp, client/ClientConnection.h,
rulesets/Character.cpp, rulesets/Character.h, tools/cyaddrules.cpp,
tools/cyconfig.cpp, tools/cyconvertrules.cpp, tools/cyctrl.cpp,
tools/cydumprules.cpp, tools/cyloadrules.cpp, tools/cypasswd.cpp:
Add inline documentation.
* client/CharacterClient.h, client/CharacterClient.cpp: Remove
overriden sight operation handlers, as they are no longer
present in the base class, and will never be called.
* client/ClientConnection.h: Remove obsolete unimplemented template
declaration.
* rulesets/Entity.cpp: Remove documentation for an argument that was
never there.
* tools/cyctrl.cpp: Mark as removed from the build.
* Add a FIXME about removing hard coded gender property
2006-12-26 18:24:24 +00:00
|
|
|
|
|
|
|
|
/// \page cyaddrules_index
|
|
|
|
|
///
|
|
|
|
|
/// \section Introduction
|
|
|
|
|
///
|
|
|
|
|
/// cyaddrules is a non-interactive commandline tool to upload rules files
|
|
|
|
|
/// into a running server. For information on the usage, please see the unix
|
|
|
|
|
/// manual page. The manual page is generated from docbook sources, so can
|
|
|
|
|
/// also be converted into other formats.
|
|
|
|
|
///
|
|
|
|
|
/// The code to interact with the server is encapsulated in the AdminClient
|
|
|
|
|
/// class, which is shared with other tools.
|
2006-10-26 00:48:00 +00:00
|
|
|
|
2005-05-13 23:25:32 +00:00
|
|
|
#include "AdminClient.h"
|
|
|
|
|
|
2010-08-26 20:01:28 +01:00
|
|
|
#include "common/compose.hpp"
|
2005-05-13 23:25:32 +00:00
|
|
|
#include "common/globals.h"
|
2007-04-29 13:32:27 +00:00
|
|
|
#include "common/log.h"
|
2009-04-08 21:22:19 +01:00
|
|
|
#include "common/sockets.h"
|
2010-08-26 20:01:28 +01:00
|
|
|
#include "common/system.h"
|
2005-05-13 23:25:32 +00:00
|
|
|
|
|
|
|
|
#include <Atlas/Codecs/XML.h>
|
|
|
|
|
|
2008-11-07 04:04:55 +00:00
|
|
|
#include <varconf/config.h>
|
2006-01-04 15:06:46 +00:00
|
|
|
|
2005-05-13 23:25:32 +00:00
|
|
|
#include <fstream>
|
|
|
|
|
|
2007-06-16 13:39:54 +00:00
|
|
|
#include <dirent.h>
|
|
|
|
|
|
2005-05-13 23:25:32 +00:00
|
|
|
using Atlas::Message::MapType;
|
|
|
|
|
|
2006-12-24 Al Riddoch <alriddoch@zepler.org>
* index.dox, common/BaseWorld.cpp, common/BaseWorld.h,
common/PropertyFactory.h, common/PropertyManager.h, common/const.h,
rulesets/ActivePropertyFactory.h, rulesets/Entity.h,
rulesets/Py_Vector3D.h, rulesets/Py_World.h, rulesets/Py_WorldTime.h,
rulesets/PythonMindScript.cpp, rulesets/PythonMindScript.h,
rulesets/PythonScript.h,
rulesets/PythonThingScript.h, rulesets/PythonWrapper.cpp,
rulesets/PythonWrapper.h, rulesets/Script.cpp, rulesets/Script.h,
server/ArithmeticFactory.h, server/CommServer.h, server/CommSocket.h,
server/ScriptFactory.cpp, server/TaskFactory.cpp,
server/TaskFactory.h, server/WorldRouter.cpp, tools/AdminClient.h,
tools/cyaddrules.cpp, tools/cycmd.cpp, tools/cyconfig.cpp,
tools/cydumprules.cpp, tools/cyloadrules.cpp:
Add a truck load of inline docs.
* tools/cywatchdog.cpp: Mark obsolete file as removed from the build.
* tools/cyloadrules.cpp, tools/cyconfig.cpp, tools/cyaddrules.cpp:
Rename some overly generic types so they have more indicative
and unique names.
* FIXME, server/ScriptFactory.cpp, server/TaskFactory.h: Add a couple
of formal FIXMEs to sort out the code for loading modules and
classes.
* rulesets/PythonThingScript.h: Remove some commented out code.
2006-12-24 14:42:05 +00:00
|
|
|
/// \brief Class that handles reading in a rules file, and loading the
|
|
|
|
|
/// contents to the server via the AdminClient.
|
|
|
|
|
class ServerRulesFileLoader : public Atlas::Message::DecoderBase
|
2005-05-13 23:25:32 +00:00
|
|
|
{
|
2006-12-24 Al Riddoch <alriddoch@zepler.org>
* index.dox, common/BaseWorld.cpp, common/BaseWorld.h,
common/PropertyFactory.h, common/PropertyManager.h, common/const.h,
rulesets/ActivePropertyFactory.h, rulesets/Entity.h,
rulesets/Py_Vector3D.h, rulesets/Py_World.h, rulesets/Py_WorldTime.h,
rulesets/PythonMindScript.cpp, rulesets/PythonMindScript.h,
rulesets/PythonScript.h,
rulesets/PythonThingScript.h, rulesets/PythonWrapper.cpp,
rulesets/PythonWrapper.h, rulesets/Script.cpp, rulesets/Script.h,
server/ArithmeticFactory.h, server/CommServer.h, server/CommSocket.h,
server/ScriptFactory.cpp, server/TaskFactory.cpp,
server/TaskFactory.h, server/WorldRouter.cpp, tools/AdminClient.h,
tools/cyaddrules.cpp, tools/cycmd.cpp, tools/cyconfig.cpp,
tools/cydumprules.cpp, tools/cyloadrules.cpp:
Add a truck load of inline docs.
* tools/cywatchdog.cpp: Mark obsolete file as removed from the build.
* tools/cyloadrules.cpp, tools/cyconfig.cpp, tools/cyaddrules.cpp:
Rename some overly generic types so they have more indicative
and unique names.
* FIXME, server/ScriptFactory.cpp, server/TaskFactory.h: Add a couple
of formal FIXMEs to sort out the code for loading modules and
classes.
* rulesets/PythonThingScript.h: Remove some commented out code.
2006-12-24 14:42:05 +00:00
|
|
|
/// \brief iostream for accessing the rules file.
|
2005-05-13 23:25:32 +00:00
|
|
|
std::fstream m_file;
|
2006-12-24 Al Riddoch <alriddoch@zepler.org>
* index.dox, common/BaseWorld.cpp, common/BaseWorld.h,
common/PropertyFactory.h, common/PropertyManager.h, common/const.h,
rulesets/ActivePropertyFactory.h, rulesets/Entity.h,
rulesets/Py_Vector3D.h, rulesets/Py_World.h, rulesets/Py_WorldTime.h,
rulesets/PythonMindScript.cpp, rulesets/PythonMindScript.h,
rulesets/PythonScript.h,
rulesets/PythonThingScript.h, rulesets/PythonWrapper.cpp,
rulesets/PythonWrapper.h, rulesets/Script.cpp, rulesets/Script.h,
server/ArithmeticFactory.h, server/CommServer.h, server/CommSocket.h,
server/ScriptFactory.cpp, server/TaskFactory.cpp,
server/TaskFactory.h, server/WorldRouter.cpp, tools/AdminClient.h,
tools/cyaddrules.cpp, tools/cycmd.cpp, tools/cyconfig.cpp,
tools/cydumprules.cpp, tools/cyloadrules.cpp:
Add a truck load of inline docs.
* tools/cywatchdog.cpp: Mark obsolete file as removed from the build.
* tools/cyloadrules.cpp, tools/cyconfig.cpp, tools/cyaddrules.cpp:
Rename some overly generic types so they have more indicative
and unique names.
* FIXME, server/ScriptFactory.cpp, server/TaskFactory.h: Add a couple
of formal FIXMEs to sort out the code for loading modules and
classes.
* rulesets/PythonThingScript.h: Remove some commented out code.
2006-12-24 14:42:05 +00:00
|
|
|
|
|
|
|
|
/// \brief Name of the ruleset to be loaded.
|
2005-05-13 23:25:32 +00:00
|
|
|
std::string m_ruleset;
|
2006-12-24 Al Riddoch <alriddoch@zepler.org>
* index.dox, common/BaseWorld.cpp, common/BaseWorld.h,
common/PropertyFactory.h, common/PropertyManager.h, common/const.h,
rulesets/ActivePropertyFactory.h, rulesets/Entity.h,
rulesets/Py_Vector3D.h, rulesets/Py_World.h, rulesets/Py_WorldTime.h,
rulesets/PythonMindScript.cpp, rulesets/PythonMindScript.h,
rulesets/PythonScript.h,
rulesets/PythonThingScript.h, rulesets/PythonWrapper.cpp,
rulesets/PythonWrapper.h, rulesets/Script.cpp, rulesets/Script.h,
server/ArithmeticFactory.h, server/CommServer.h, server/CommSocket.h,
server/ScriptFactory.cpp, server/TaskFactory.cpp,
server/TaskFactory.h, server/WorldRouter.cpp, tools/AdminClient.h,
tools/cyaddrules.cpp, tools/cycmd.cpp, tools/cyconfig.cpp,
tools/cydumprules.cpp, tools/cyloadrules.cpp:
Add a truck load of inline docs.
* tools/cywatchdog.cpp: Mark obsolete file as removed from the build.
* tools/cyloadrules.cpp, tools/cyconfig.cpp, tools/cyaddrules.cpp:
Rename some overly generic types so they have more indicative
and unique names.
* FIXME, server/ScriptFactory.cpp, server/TaskFactory.h: Add a couple
of formal FIXMEs to sort out the code for loading modules and
classes.
* rulesets/PythonThingScript.h: Remove some commented out code.
2006-12-24 14:42:05 +00:00
|
|
|
|
|
|
|
|
/// \brief Client object to handle the connection to the server.
|
2005-05-13 23:25:32 +00:00
|
|
|
AdminClient & m_client;
|
2006-12-24 Al Riddoch <alriddoch@zepler.org>
* index.dox, common/BaseWorld.cpp, common/BaseWorld.h,
common/PropertyFactory.h, common/PropertyManager.h, common/const.h,
rulesets/ActivePropertyFactory.h, rulesets/Entity.h,
rulesets/Py_Vector3D.h, rulesets/Py_World.h, rulesets/Py_WorldTime.h,
rulesets/PythonMindScript.cpp, rulesets/PythonMindScript.h,
rulesets/PythonScript.h,
rulesets/PythonThingScript.h, rulesets/PythonWrapper.cpp,
rulesets/PythonWrapper.h, rulesets/Script.cpp, rulesets/Script.h,
server/ArithmeticFactory.h, server/CommServer.h, server/CommSocket.h,
server/ScriptFactory.cpp, server/TaskFactory.cpp,
server/TaskFactory.h, server/WorldRouter.cpp, tools/AdminClient.h,
tools/cyaddrules.cpp, tools/cycmd.cpp, tools/cyconfig.cpp,
tools/cydumprules.cpp, tools/cyloadrules.cpp:
Add a truck load of inline docs.
* tools/cywatchdog.cpp: Mark obsolete file as removed from the build.
* tools/cyloadrules.cpp, tools/cyconfig.cpp, tools/cyaddrules.cpp:
Rename some overly generic types so they have more indicative
and unique names.
* FIXME, server/ScriptFactory.cpp, server/TaskFactory.h: Add a couple
of formal FIXMEs to sort out the code for loading modules and
classes.
* rulesets/PythonThingScript.h: Remove some commented out code.
2006-12-24 14:42:05 +00:00
|
|
|
|
|
|
|
|
/// \brief Atlas codec used to decode the contents of the rules file.
|
2005-05-13 23:25:32 +00:00
|
|
|
Atlas::Codecs::XML m_codec;
|
2006-12-24 Al Riddoch <alriddoch@zepler.org>
* index.dox, common/BaseWorld.cpp, common/BaseWorld.h,
common/PropertyFactory.h, common/PropertyManager.h, common/const.h,
rulesets/ActivePropertyFactory.h, rulesets/Entity.h,
rulesets/Py_Vector3D.h, rulesets/Py_World.h, rulesets/Py_WorldTime.h,
rulesets/PythonMindScript.cpp, rulesets/PythonMindScript.h,
rulesets/PythonScript.h,
rulesets/PythonThingScript.h, rulesets/PythonWrapper.cpp,
rulesets/PythonWrapper.h, rulesets/Script.cpp, rulesets/Script.h,
server/ArithmeticFactory.h, server/CommServer.h, server/CommSocket.h,
server/ScriptFactory.cpp, server/TaskFactory.cpp,
server/TaskFactory.h, server/WorldRouter.cpp, tools/AdminClient.h,
tools/cyaddrules.cpp, tools/cycmd.cpp, tools/cyconfig.cpp,
tools/cydumprules.cpp, tools/cyloadrules.cpp:
Add a truck load of inline docs.
* tools/cywatchdog.cpp: Mark obsolete file as removed from the build.
* tools/cyloadrules.cpp, tools/cyconfig.cpp, tools/cyaddrules.cpp:
Rename some overly generic types so they have more indicative
and unique names.
* FIXME, server/ScriptFactory.cpp, server/TaskFactory.h: Add a couple
of formal FIXMEs to sort out the code for loading modules and
classes.
* rulesets/PythonThingScript.h: Remove some commented out code.
2006-12-24 14:42:05 +00:00
|
|
|
|
|
|
|
|
/// \brief Count of classes uploaded to the server.
|
2005-05-13 23:25:32 +00:00
|
|
|
int m_count;
|
2006-12-24 Al Riddoch <alriddoch@zepler.org>
* index.dox, common/BaseWorld.cpp, common/BaseWorld.h,
common/PropertyFactory.h, common/PropertyManager.h, common/const.h,
rulesets/ActivePropertyFactory.h, rulesets/Entity.h,
rulesets/Py_Vector3D.h, rulesets/Py_World.h, rulesets/Py_WorldTime.h,
rulesets/PythonMindScript.cpp, rulesets/PythonMindScript.h,
rulesets/PythonScript.h,
rulesets/PythonThingScript.h, rulesets/PythonWrapper.cpp,
rulesets/PythonWrapper.h, rulesets/Script.cpp, rulesets/Script.h,
server/ArithmeticFactory.h, server/CommServer.h, server/CommSocket.h,
server/ScriptFactory.cpp, server/TaskFactory.cpp,
server/TaskFactory.h, server/WorldRouter.cpp, tools/AdminClient.h,
tools/cyaddrules.cpp, tools/cycmd.cpp, tools/cyconfig.cpp,
tools/cydumprules.cpp, tools/cyloadrules.cpp:
Add a truck load of inline docs.
* tools/cywatchdog.cpp: Mark obsolete file as removed from the build.
* tools/cyloadrules.cpp, tools/cyconfig.cpp, tools/cyaddrules.cpp:
Rename some overly generic types so they have more indicative
and unique names.
* FIXME, server/ScriptFactory.cpp, server/TaskFactory.h: Add a couple
of formal FIXMEs to sort out the code for loading modules and
classes.
* rulesets/PythonThingScript.h: Remove some commented out code.
2006-12-24 14:42:05 +00:00
|
|
|
|
|
|
|
|
/// \brief Count of classes read from the file.
|
2005-05-13 23:25:32 +00:00
|
|
|
int m_total;
|
|
|
|
|
|
2006-12-24 Al Riddoch <alriddoch@zepler.org>
* index.dox, common/BaseWorld.cpp, common/BaseWorld.h,
common/PropertyFactory.h, common/PropertyManager.h, common/const.h,
rulesets/ActivePropertyFactory.h, rulesets/Entity.h,
rulesets/Py_Vector3D.h, rulesets/Py_World.h, rulesets/Py_WorldTime.h,
rulesets/PythonMindScript.cpp, rulesets/PythonMindScript.h,
rulesets/PythonScript.h,
rulesets/PythonThingScript.h, rulesets/PythonWrapper.cpp,
rulesets/PythonWrapper.h, rulesets/Script.cpp, rulesets/Script.h,
server/ArithmeticFactory.h, server/CommServer.h, server/CommSocket.h,
server/ScriptFactory.cpp, server/TaskFactory.cpp,
server/TaskFactory.h, server/WorldRouter.cpp, tools/AdminClient.h,
tools/cyaddrules.cpp, tools/cycmd.cpp, tools/cyconfig.cpp,
tools/cydumprules.cpp, tools/cyloadrules.cpp:
Add a truck load of inline docs.
* tools/cywatchdog.cpp: Mark obsolete file as removed from the build.
* tools/cyloadrules.cpp, tools/cyconfig.cpp, tools/cyaddrules.cpp:
Rename some overly generic types so they have more indicative
and unique names.
* FIXME, server/ScriptFactory.cpp, server/TaskFactory.h: Add a couple
of formal FIXMEs to sort out the code for loading modules and
classes.
* rulesets/PythonThingScript.h: Remove some commented out code.
2006-12-24 14:42:05 +00:00
|
|
|
/// \brief Method called from the base class when a complete message
|
|
|
|
|
/// is read from the file.
|
2016-03-18 20:00:48 +01:00
|
|
|
virtual void messageArrived(MapType omap) {
|
2005-05-13 23:25:32 +00:00
|
|
|
MapType::const_iterator I = omap.find("id");
|
|
|
|
|
if (I == omap.end()) {
|
|
|
|
|
std::cerr << "Found rule with no id" << std::endl << std::flush;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!I->second.isString()) {
|
|
|
|
|
std::cerr << "Found rule with non string id" << std::endl << std::flush;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
m_total++;
|
|
|
|
|
// m_rules[I->second.asString()] = obj.asMap();
|
2005-05-14 16:25:39 +00:00
|
|
|
int ret = m_client.uploadRule(I->second.asString(), m_ruleset, omap);
|
|
|
|
|
if (ret > 0) {
|
|
|
|
|
m_count += ret;
|
2005-05-13 23:25:32 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public:
|
2006-12-24 Al Riddoch <alriddoch@zepler.org>
* index.dox, common/BaseWorld.cpp, common/BaseWorld.h,
common/PropertyFactory.h, common/PropertyManager.h, common/const.h,
rulesets/ActivePropertyFactory.h, rulesets/Entity.h,
rulesets/Py_Vector3D.h, rulesets/Py_World.h, rulesets/Py_WorldTime.h,
rulesets/PythonMindScript.cpp, rulesets/PythonMindScript.h,
rulesets/PythonScript.h,
rulesets/PythonThingScript.h, rulesets/PythonWrapper.cpp,
rulesets/PythonWrapper.h, rulesets/Script.cpp, rulesets/Script.h,
server/ArithmeticFactory.h, server/CommServer.h, server/CommSocket.h,
server/ScriptFactory.cpp, server/TaskFactory.cpp,
server/TaskFactory.h, server/WorldRouter.cpp, tools/AdminClient.h,
tools/cyaddrules.cpp, tools/cycmd.cpp, tools/cyconfig.cpp,
tools/cydumprules.cpp, tools/cyloadrules.cpp:
Add a truck load of inline docs.
* tools/cywatchdog.cpp: Mark obsolete file as removed from the build.
* tools/cyloadrules.cpp, tools/cyconfig.cpp, tools/cyaddrules.cpp:
Rename some overly generic types so they have more indicative
and unique names.
* FIXME, server/ScriptFactory.cpp, server/TaskFactory.h: Add a couple
of formal FIXMEs to sort out the code for loading modules and
classes.
* rulesets/PythonThingScript.h: Remove some commented out code.
2006-12-24 14:42:05 +00:00
|
|
|
/// \brief ServerRulesFileLoader constructor
|
|
|
|
|
///
|
|
|
|
|
/// @param filename name of the rules file to be loaded
|
|
|
|
|
/// @param ruleset name of the ruleset the file represents
|
|
|
|
|
/// @param client client object that uploads rules to the server
|
|
|
|
|
ServerRulesFileLoader(const std::string & filename,
|
|
|
|
|
const std::string & ruleset,
|
|
|
|
|
AdminClient & client) :
|
|
|
|
|
m_file(filename.c_str(), std::ios::in),
|
|
|
|
|
m_ruleset(ruleset), m_client(client),
|
2016-03-18 20:00:48 +01:00
|
|
|
m_codec(m_file, m_file, *this), m_count(0), m_total(0)
|
2005-05-13 23:25:32 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-24 Al Riddoch <alriddoch@zepler.org>
* index.dox, common/BaseWorld.cpp, common/BaseWorld.h,
common/PropertyFactory.h, common/PropertyManager.h, common/const.h,
rulesets/ActivePropertyFactory.h, rulesets/Entity.h,
rulesets/Py_Vector3D.h, rulesets/Py_World.h, rulesets/Py_WorldTime.h,
rulesets/PythonMindScript.cpp, rulesets/PythonMindScript.h,
rulesets/PythonScript.h,
rulesets/PythonThingScript.h, rulesets/PythonWrapper.cpp,
rulesets/PythonWrapper.h, rulesets/Script.cpp, rulesets/Script.h,
server/ArithmeticFactory.h, server/CommServer.h, server/CommSocket.h,
server/ScriptFactory.cpp, server/TaskFactory.cpp,
server/TaskFactory.h, server/WorldRouter.cpp, tools/AdminClient.h,
tools/cyaddrules.cpp, tools/cycmd.cpp, tools/cyconfig.cpp,
tools/cydumprules.cpp, tools/cyloadrules.cpp:
Add a truck load of inline docs.
* tools/cywatchdog.cpp: Mark obsolete file as removed from the build.
* tools/cyloadrules.cpp, tools/cyconfig.cpp, tools/cyaddrules.cpp:
Rename some overly generic types so they have more indicative
and unique names.
* FIXME, server/ScriptFactory.cpp, server/TaskFactory.h: Add a couple
of formal FIXMEs to sort out the code for loading modules and
classes.
* rulesets/PythonThingScript.h: Remove some commented out code.
2006-12-24 14:42:05 +00:00
|
|
|
/// \brief Read the contents of the file to the end
|
2005-05-13 23:25:32 +00:00
|
|
|
void read() {
|
|
|
|
|
while (!m_file.eof()) {
|
2018-01-28 21:23:18 +01:00
|
|
|
m_codec.poll(true);
|
2005-05-13 23:25:32 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-24 Al Riddoch <alriddoch@zepler.org>
* index.dox, common/BaseWorld.cpp, common/BaseWorld.h,
common/PropertyFactory.h, common/PropertyManager.h, common/const.h,
rulesets/ActivePropertyFactory.h, rulesets/Entity.h,
rulesets/Py_Vector3D.h, rulesets/Py_World.h, rulesets/Py_WorldTime.h,
rulesets/PythonMindScript.cpp, rulesets/PythonMindScript.h,
rulesets/PythonScript.h,
rulesets/PythonThingScript.h, rulesets/PythonWrapper.cpp,
rulesets/PythonWrapper.h, rulesets/Script.cpp, rulesets/Script.h,
server/ArithmeticFactory.h, server/CommServer.h, server/CommSocket.h,
server/ScriptFactory.cpp, server/TaskFactory.cpp,
server/TaskFactory.h, server/WorldRouter.cpp, tools/AdminClient.h,
tools/cyaddrules.cpp, tools/cycmd.cpp, tools/cyconfig.cpp,
tools/cydumprules.cpp, tools/cyloadrules.cpp:
Add a truck load of inline docs.
* tools/cywatchdog.cpp: Mark obsolete file as removed from the build.
* tools/cyloadrules.cpp, tools/cyconfig.cpp, tools/cyaddrules.cpp:
Rename some overly generic types so they have more indicative
and unique names.
* FIXME, server/ScriptFactory.cpp, server/TaskFactory.h: Add a couple
of formal FIXMEs to sort out the code for loading modules and
classes.
* rulesets/PythonThingScript.h: Remove some commented out code.
2006-12-24 14:42:05 +00:00
|
|
|
/// \brief Send a report of rules laoded and uploaded to standard out
|
2009-11-05 01:52:33 +00:00
|
|
|
void report(const std::string & source) {
|
2005-05-13 23:25:32 +00:00
|
|
|
std::cout << m_count << " new classes uploaded out of "
|
2009-11-05 01:52:33 +00:00
|
|
|
<< m_total << " loaded from " << source << "."
|
2005-05-13 23:25:32 +00:00
|
|
|
<< std::endl << std::flush;
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-24 Al Riddoch <alriddoch@zepler.org>
* index.dox, common/BaseWorld.cpp, common/BaseWorld.h,
common/PropertyFactory.h, common/PropertyManager.h, common/const.h,
rulesets/ActivePropertyFactory.h, rulesets/Entity.h,
rulesets/Py_Vector3D.h, rulesets/Py_World.h, rulesets/Py_WorldTime.h,
rulesets/PythonMindScript.cpp, rulesets/PythonMindScript.h,
rulesets/PythonScript.h,
rulesets/PythonThingScript.h, rulesets/PythonWrapper.cpp,
rulesets/PythonWrapper.h, rulesets/Script.cpp, rulesets/Script.h,
server/ArithmeticFactory.h, server/CommServer.h, server/CommSocket.h,
server/ScriptFactory.cpp, server/TaskFactory.cpp,
server/TaskFactory.h, server/WorldRouter.cpp, tools/AdminClient.h,
tools/cyaddrules.cpp, tools/cycmd.cpp, tools/cyconfig.cpp,
tools/cydumprules.cpp, tools/cyloadrules.cpp:
Add a truck load of inline docs.
* tools/cywatchdog.cpp: Mark obsolete file as removed from the build.
* tools/cyloadrules.cpp, tools/cyconfig.cpp, tools/cyaddrules.cpp:
Rename some overly generic types so they have more indicative
and unique names.
* FIXME, server/ScriptFactory.cpp, server/TaskFactory.h: Add a couple
of formal FIXMEs to sort out the code for loading modules and
classes.
* rulesets/PythonThingScript.h: Remove some commented out code.
2006-12-24 14:42:05 +00:00
|
|
|
/// \brief Indicate whether the file has been opened successfully
|
2005-05-13 23:25:32 +00:00
|
|
|
bool isOpen() {
|
|
|
|
|
return m_file.is_open();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void usage(char * prgname)
|
|
|
|
|
{
|
|
|
|
|
std::cerr << "usage: " << prgname << " [<rulesetname> <atlas-xml-file>]" << std::endl << std::flush;
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-09 00:13:15 +01:00
|
|
|
STRING_OPTION(server, "", "client", "serverhost",
|
|
|
|
|
"Hostname of the server to connect to");
|
|
|
|
|
|
2010-08-26 20:01:28 +01:00
|
|
|
STRING_OPTION(username, "", "client", "account",
|
2009-04-09 00:13:15 +01:00
|
|
|
"Account name to use to authenticate to the server");
|
|
|
|
|
|
|
|
|
|
STRING_OPTION(password, "", "client", "password",
|
|
|
|
|
"Password to use to authenticate to the server");
|
|
|
|
|
|
|
|
|
|
INT_OPTION(useslave, 0, "client", "useslave",
|
|
|
|
|
"Flag to control connecting to an AI slave server, not master world server");
|
|
|
|
|
|
2005-05-13 23:25:32 +00:00
|
|
|
int main(int argc, char ** argv)
|
|
|
|
|
{
|
2007-11-14 22:40:17 +00:00
|
|
|
int config_status = loadConfig(argc, argv, USAGE_CYCMD);
|
2007-04-29 13:32:27 +00:00
|
|
|
if (config_status < 0) {
|
|
|
|
|
if (config_status == CONFIG_VERSION) {
|
|
|
|
|
reportVersion(argv[0]);
|
|
|
|
|
return 0;
|
|
|
|
|
} else if (config_status == CONFIG_HELP) {
|
|
|
|
|
showUsage(argv[0], USAGE_CYCMD, "[<rulesetname> <atlas-xml-file>]");
|
|
|
|
|
return 0;
|
|
|
|
|
} else if (config_status != CONFIG_ERROR) {
|
|
|
|
|
log(ERROR, "Unknown error reading configuration.");
|
|
|
|
|
}
|
2005-05-13 23:25:32 +00:00
|
|
|
// Fatal error loading config file
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2007-04-29 13:32:27 +00:00
|
|
|
int optind = config_status;
|
|
|
|
|
|
2005-05-14 13:05:41 +00:00
|
|
|
AdminClient bridge;
|
|
|
|
|
|
2007-11-05 19:42:10 +00:00
|
|
|
bridge.setUsername(username);
|
2005-05-14 13:05:41 +00:00
|
|
|
|
2009-04-09 00:13:15 +01:00
|
|
|
bridge.setPassword(password);
|
2005-05-13 23:25:32 +00:00
|
|
|
|
|
|
|
|
if (server.empty()) {
|
2008-11-07 01:21:49 +00:00
|
|
|
std::string localSocket;
|
2005-05-13 23:25:32 +00:00
|
|
|
if (useslave != 0) {
|
2008-11-07 01:21:49 +00:00
|
|
|
localSocket = slave_socket_name;
|
2005-05-13 23:25:32 +00:00
|
|
|
} else {
|
2008-11-07 01:21:49 +00:00
|
|
|
localSocket = client_socket_name;
|
2005-05-13 23:25:32 +00:00
|
|
|
}
|
|
|
|
|
|
2009-11-25 04:56:34 +00:00
|
|
|
if (bridge.connectLocal(localSocket) != 0) {
|
2005-05-14 13:05:41 +00:00
|
|
|
std::cerr << "Failed to connect to local server"
|
|
|
|
|
<< std::endl << std::flush;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (bridge.connect(server) != 0) {
|
|
|
|
|
std::cerr << "Failed to connect to remote server"
|
|
|
|
|
<< std::endl << std::flush;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-05-13 23:25:32 +00:00
|
|
|
|
2010-08-26 20:01:28 +01:00
|
|
|
if (username.empty()) {
|
|
|
|
|
if (bridge.create("sys",
|
|
|
|
|
create_session_username(),
|
|
|
|
|
String::compose("%1%2", ::rand(), ::rand())) != 0) {
|
|
|
|
|
std::cerr << "Creation failed." << std::endl << std::flush;
|
2005-05-14 13:05:41 +00:00
|
|
|
return 1;
|
2005-05-13 23:25:32 +00:00
|
|
|
}
|
2010-08-26 20:01:28 +01:00
|
|
|
} else {
|
|
|
|
|
if (bridge.login() != 0) {
|
|
|
|
|
std::cerr << "Login failed." << std::endl << std::flush;
|
|
|
|
|
bridge.getLogin();
|
|
|
|
|
|
|
|
|
|
if (!bridge.login()) {
|
|
|
|
|
std::cerr << "Login failed." << std::endl << std::flush;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-05-13 23:25:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (optind == (argc - 2)) {
|
2006-12-24 Al Riddoch <alriddoch@zepler.org>
* index.dox, common/BaseWorld.cpp, common/BaseWorld.h,
common/PropertyFactory.h, common/PropertyManager.h, common/const.h,
rulesets/ActivePropertyFactory.h, rulesets/Entity.h,
rulesets/Py_Vector3D.h, rulesets/Py_World.h, rulesets/Py_WorldTime.h,
rulesets/PythonMindScript.cpp, rulesets/PythonMindScript.h,
rulesets/PythonScript.h,
rulesets/PythonThingScript.h, rulesets/PythonWrapper.cpp,
rulesets/PythonWrapper.h, rulesets/Script.cpp, rulesets/Script.h,
server/ArithmeticFactory.h, server/CommServer.h, server/CommSocket.h,
server/ScriptFactory.cpp, server/TaskFactory.cpp,
server/TaskFactory.h, server/WorldRouter.cpp, tools/AdminClient.h,
tools/cyaddrules.cpp, tools/cycmd.cpp, tools/cyconfig.cpp,
tools/cydumprules.cpp, tools/cyloadrules.cpp:
Add a truck load of inline docs.
* tools/cywatchdog.cpp: Mark obsolete file as removed from the build.
* tools/cyloadrules.cpp, tools/cyconfig.cpp, tools/cyaddrules.cpp:
Rename some overly generic types so they have more indicative
and unique names.
* FIXME, server/ScriptFactory.cpp, server/TaskFactory.h: Add a couple
of formal FIXMEs to sort out the code for loading modules and
classes.
* rulesets/PythonThingScript.h: Remove some commented out code.
2006-12-24 14:42:05 +00:00
|
|
|
ServerRulesFileLoader f(argv[optind + 1], argv[optind], bridge);
|
2005-05-13 23:25:32 +00:00
|
|
|
if (!f.isOpen()) {
|
|
|
|
|
std::cerr << "ERROR: Unable to open file " << argv[optind + 1]
|
|
|
|
|
<< std::endl << std::flush;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
f.read();
|
2009-11-05 01:52:33 +00:00
|
|
|
f.report(argv[optind]);
|
2005-05-13 23:25:32 +00:00
|
|
|
} else if (optind == argc) {
|
2012-01-19 19:34:20 +00:00
|
|
|
std::cout << "Reading rules from " << ruleset_name
|
|
|
|
|
<< std::endl << std::flush;
|
2007-06-19 13:19:57 +00:00
|
|
|
std::string filename;
|
|
|
|
|
|
2012-01-19 19:34:20 +00:00
|
|
|
// FIXME Use library functions for path concatenation to guarantee
|
|
|
|
|
// sane portability
|
|
|
|
|
std::string dirname = etc_directory + "/cyphesis/" + ruleset_name + ".d";
|
2007-06-19 13:19:57 +00:00
|
|
|
DIR * rules_dir = ::opendir(dirname.c_str());
|
|
|
|
|
if (rules_dir == 0) {
|
2012-01-19 19:34:20 +00:00
|
|
|
filename = etc_directory + "/cyphesis/" + ruleset_name + ".xml";
|
|
|
|
|
ServerRulesFileLoader f(filename, ruleset_name, bridge);
|
2007-06-19 13:19:57 +00:00
|
|
|
if (f.isOpen()) {
|
|
|
|
|
std::cerr << "WARNING: Reading legacy rule data from \""
|
|
|
|
|
<< filename << "\""
|
|
|
|
|
<< std::endl << std::flush;
|
|
|
|
|
f.read();
|
2012-01-19 19:34:20 +00:00
|
|
|
f.report(ruleset_name);
|
2007-06-16 13:39:54 +00:00
|
|
|
}
|
2007-06-19 13:19:57 +00:00
|
|
|
} else {
|
2007-06-16 13:39:54 +00:00
|
|
|
while (struct dirent * rules_entry = ::readdir(rules_dir)) {
|
|
|
|
|
if (rules_entry->d_name[0] == '.') {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2007-06-19 13:19:57 +00:00
|
|
|
filename = dirname + "/" + rules_entry->d_name;
|
|
|
|
|
|
2012-01-19 19:34:20 +00:00
|
|
|
ServerRulesFileLoader f(filename, ruleset_name, bridge);
|
2007-06-16 13:39:54 +00:00
|
|
|
if (!f.isOpen()) {
|
|
|
|
|
std::cerr << "ERROR: Unable to open file " << filename
|
|
|
|
|
<< std::endl << std::flush;
|
|
|
|
|
} else {
|
|
|
|
|
f.read();
|
2009-11-05 01:52:33 +00:00
|
|
|
f.report(rules_entry->d_name);
|
2007-06-16 13:39:54 +00:00
|
|
|
}
|
2005-05-13 23:25:32 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
usage(argv[0]);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2005-05-14 16:25:39 +00:00
|
|
|
|
|
|
|
|
bridge.report();
|
|
|
|
|
|
|
|
|
|
return 0;
|
2005-05-13 23:25:32 +00:00
|
|
|
}
|