Commit graph

303 commits

Author SHA1 Message Date
Al Riddoch
2a2362120f 2003-09-17 Al Riddoch <alriddoch@zepler.org>
* server/EntityFactory.cpp: Be much stricter about missing types,
	  and missing parents of types. Refuse to add types or instances
	  which have non-existant parents.

	* common/BaseWorld.h, rulesets/Thing.cpp, server/Account.cpp,
	  server/Account.h, server/EntityFactory.h,
	  server/WorldRouter.cpp, server/WorldRouter.h:
	  Change names of functions used to add new objects to the world
	  to reflect that they do this. Handle failure to create an
	  entity.
2003-09-17 01:22:53 +00:00
Al Riddoch
0fbfc771ad 2003-08-07 Al Riddoch <alriddoch@zepler.org>
* server/Lobby.cpp: Add some debugging messages.

	* server/CommServer.cpp: Tweak select loop so that closed connections
	  are cleaned up as soon as they are detected.

	* rulesets/World.cpp: Make demo terrain a bit more mountainous.

	* Convert entire codebase over to using Atlas-C++ 0.4.90, as
	  start of transition to 0.6 API.
2003-08-07 23:03:26 +00:00
Al Riddoch
661e208f6d 2003-07-21 Al Riddoch <alriddoch@zepler.org>
* common/Database.h, server/Account.cpp, server/Account.h,
	  server/Admin.h, server/Connection.cpp, server/Player.h,
	  server/WorldRouter.cpp: Change the form of the getEntityId()
	  method in the database code and re-work the code that uses it.

	* common/Database.cpp, common/Database.h: Use PQClear() to free
	  up database result objects, and provide a method to
	  free the contents of a DatabaseResult instance.
2003-07-21 09:37:58 +00:00
Al Riddoch
6718c4037a 2003-07-20 Al Riddoch <alriddoch@zepler.org>
* server/WorldRouter.cpp: Ensure world entity has its type set.
2003-07-20 00:37:29 +00:00
Al Riddoch
23cbb054c0 2003-07-20 Al Riddoch <alriddoch@zepler.org>
* common/BaseWorld.h, server/WorldRouter.cpp, server/WorldRouter.h:
	  Remove old obsolete code for handling id generation.
2003-07-20 00:28:41 +00:00
Al Riddoch
29a290e6ea 2003-06-20 Al Riddoch <alriddoch@zepler.org>
* server/WorldRouter.cpp: Fix variable name bug in non-debug build.

	* Update Makefile.ams so that distcheck works.
2003-06-24 09:53:38 +00:00
Al Riddoch
88bb8c6a42 2003-05-04 Al Riddoch <alriddoch@zepler.org>
* Clean up member variable names.
2003-05-04 18:31:38 +00:00
Al Riddoch
f3f73897e3 2003-05-03 Al Riddoch <alriddoch@zepler.org>
* server/Restoration.cpp: Send restored entities a setup op, so the
	  AI gets initialised as if the entity had just been created.

	* Clean up member variable names.

	* rulesets/mason/mind/SkelMind.py: Get skeleton to recognise
	  settlers.
2003-05-03 19:52:41 +00:00
Al Riddoch
b24ad0c18a 2003-03-22 Al Riddoch <alriddoch@zepler.org>
* client/CommClient.cpp, client/CreatorClient.cpp,
	  client/ObserverClient.cpp, client/Py_CreatorClient.cpp,
	  common/BaseEntity.cpp, common/BaseEntity.h,
	  common/types.h, rulesets/Area.cpp, rulesets/BaseMind.cpp,
	  rulesets/Character.cpp, rulesets/Entity.cpp,
	  rulesets/Food.cpp, rulesets/Line.cpp,
	  rulesets/MemMap.cpp, rulesets/Pedestrian.cpp,
	  rulesets/Plant.cpp, rulesets/Py_Mind.cpp,
	  rulesets/Py_Object.cpp, rulesets/Py_Thing.cpp,
	  rulesets/Python_API.cpp, rulesets/Stackable.cpp,
	  rulesets/Thing.cpp, rulesets/World.cpp,
	  server/Account.cpp, server/Admin.cpp, server/CommClient.cpp,
	  server/CommServer.cpp, server/Connection.cpp,
	  server/EntityFactory.cpp, server/Lobby.cpp,
	  server/Persistance.cpp, server/Player.cpp,
	  server/ServerRouting.cpp, server/WorldRouter.cpp:
	  Switch to using Element as name for Atlas::Message::Object,
	  to avoid name clashes on Object, and bring into line with
	  the way Atlas-C++ will be.
2003-03-23 00:55:09 +00:00
Al Riddoch
096b4d898d 2003-03-21 Al Riddoch <alriddoch@zepler.org>
* modules/Location.h, modules/Location.cpp: Change location
	  member names to fit the Atlas attributes they map to, and
	  make it clear they are members.
2003-03-21 10:48:17 +00:00
Al Riddoch
26633cf574 2003-03-21 Al Riddoch <alriddoch@zepler.org>
* client/Py_CreatorClient.cpp, common/BaseEntity.cpp,
	  common/BaseEntity.h, rulesets/MemMap.cpp, rulesets/Py_Mind.cpp,
	  rulesets/Py_Thing.cpp, rulesets/Thing.cpp, rulesets/Thing.h,
	  server/Account.cpp, server/Admin.cpp, server/Connection.cpp,
	  server/Lobby.cpp, server/ServerRouting.cpp:
	  Use a more efficient technique to set the attributes on
	  operation arguments without a copy.

	* common/BaseEntity.cpp, rulesets/Entity.cpp, rulesets/Thing.h,
	  rulesets/World.cpp, server/WorldRouter.cpp:
	  Move handling IG Look ops into the IG code in rulesets.
2003-03-21 00:04:53 +00:00
Al Riddoch
bba2b08639 2003-03-20 Al Riddoch <alriddoch@zepler.org>
* server/WorldRouter.cpp: Re-work handling look ops for efficiency.
2003-03-20 20:52:09 +00:00
Al Riddoch
15ef748518 2003-03-07 Al Riddoch <alriddoch@zepler.org>
* Use " instead of < when including application headers.

	* Re-work the interface between server and worldrouter objects
	  so that the are less tied together, and more flexible.
2003-03-07 00:22:12 +00:00
Al Riddoch
5ef716948f 2003-01-05 Al Riddoch <alriddoch@zepler.org>
* common/globals.cpp, common/globals.h, server/Connection.cpp,
	  server/Persistance.cpp, server/Persistance.h, server/ServerRouting.cpp,
	  server/server.cpp: Move restricted flag out of persistance into
	  globals.

	* server/Account.h, server/Admin.cpp, server/Connection_methods.h,
	  server/WorldRouter.cpp: Remove unnecessary includes.

	* server/ServerRouting.cpp: No longer necessary to load the admin
	  account at startup. Can be loaded on demand.
2003-01-05 01:28:49 +00:00
Al Riddoch
babd1472a8 2002-12-30 Al Riddoch <alriddoch@zepler.org>
* common/Database.cpp: Don't make update requests if no columns
	  are given to be updated.

	* common/Database.cpp, common/Database.h: Add new method to select
	  all rows in a given class table with a given location.

	* rulesets/Entity.cpp, rulesets/Entity.h: Make update_flags
	  public.

	* rulesets/Entity.cpp, rulesets/Thing.cpp, rulesets/attributes.h,
	  server/Persistor.cpp, server/Persistor_impl.h,
	  server/WorldRouter.cpp: Add new cont column to entity tables which
	  is zero if the entity has no contained entities.

	* server/Restoration.cpp, server/Restoration.h, server/Restorer.cpp,
	  server/Restorer.h, server/Restorer_impl.h:
	  Modify restorers so they now use a database result iterator to
	  indicate the row they should restore from.

	* server/Restoration.cpp: Implement new way of restoring world from
	  database using new function to fetch multiple complete entities
	  from database at the same time. Massive speedup.
2002-12-31 12:41:19 +00:00
Al Riddoch
8d7eb1b6e1 2002-12-28 Al Riddoch <alriddoch@zepler.org>
* common/BaseEntity.cpp, common/BaseEntity.h, rulesets/Character.cpp,
	  rulesets/Food.cpp, rulesets/Thing.cpp, rulesets/World.cpp:
	  Add arg to error method specifying where the error should go. Use
	  this arg to ensure that errors don't get broadcast.

	* common/Database.cpp, common/Database.h, common/const.cpp,
	  server/Persistor.cpp, server/Restoration.cpp,
	  server/WorldRouter.cpp
	  Change id and loc column in entity tables to integer for
	  performance. Add id generator sequence to database

	* common/Database.cpp, common/Database.h, server/Persistance.cpp,
	  server/Persistance.h: Remove old legacy world, mind and server
	  tables as they are no longer used.

	* common/BaseEntity.cpp, common/Load.h, common/Save.h,
	  common/custom.cpp, common/op_switch.h, common/operations.cpp,
	  common/operations.h, common/types.h, rulesets/BaseMind.cpp,
	  rulesets/BaseMind.h, rulesets/Character.cpp, rulesets/Character.h,
	  server/Admin.cpp, server/Admin.h, server/server.cpp,
	  tools/cycmd.cpp: Remove Load and Save ops.

	* rulesets/Area.cpp, rulesets/Character.cpp, rulesets/Line.cpp,
	  rulesets/Plant.cpp: Fix != to |= when setting update flags.

	* server/CommMetaClient.cpp, server/CommMetaClient.h,
	  server/CommServer.cpp, server/CommServer.h, server/server.cpp:
	  Add mechanism for sockets to be called whenever the server
	  is idle, so that they do period things. Use this mechanis,
	  to handle sending periodic packets to the metaserver, removing
	  special case code from CommServer.
2002-12-28 21:52:32 +00:00
Al Riddoch
8915b80e5d 2002-12-23 Al Riddoch <alriddoch@zepler.org>
* common/BaseEntity.h, common/BaseWorld.cpp, common/BaseWorld.h,
	  common/OOGThing.h, rulesets/Area.cpp, rulesets/Area.h,
	  rulesets/BaseMind.cpp, 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/Line.cpp, rulesets/Line.h,
	  rulesets/MemMap.cpp, rulesets/Plant.cpp, rulesets/Plant.h,
	  rulesets/Stackable.cpp, rulesets/Stackable.h,
	  rulesets/Structure.h, rulesets/Thing.cpp, rulesets/Thing.h,
	  rulesets/World.cpp, rulesets/World.h, server/Account.cpp,
	  server/CommClient.cpp, server/CommClient.h,
	  server/Connection.cpp, server/Connection.h,
	  server/EntityFactory.cpp, server/Lobby.cpp, server/Lobby.h,
	  server/PersistantThingFactory.h,
	  server/PersistantThingFactory_impl.h,
	  server/Restorer.cpp, server/Restorer_impl.h, server/ServerRouting.cpp,
	  server/WorldRouter.cpp: Assign ID at entity construction time,
	  and make it constant, and thus unmodifiable.
2002-12-23 23:22:25 +00:00
Al Riddoch
b995597aec 2002-12-22 Al Riddoch <alriddoch@zepler.org>
* physics/Quaternion.h, physics/Vector3D.h: Add accessors to
	  allow direct modification of coordinates.

	* server/Persistor_impl.h: Remove duplicate attribute handler.

	* server/Restoration.cpp: And in the final code for loading
	  restored entities from database.

	* server/Restoration.h, server/Restorer.h,
	  server/Restorer_impl.h: Implement handler that populate
	  member variables of entity objects from database
	  structures.

	* server/ServerRouting.h: Make WorldRouter reference public.

	* server/WorldRouter.cpp, server/WorldRouter.h: Slight
	  modification to addObject(Entity *) to allow restored
	  objects to be added as well as new ones.
2002-12-22 02:29:21 +00:00
Al Riddoch
201c6d683a 2002-12-21 Al Riddoch <alriddoch@zepler.org>
* server/WorldRouter.cpp, server/Admin.cpp:
	  Use consts::rootWorldId correctly.

	* server/Persistor.cpp, server/PersistantThingFactory.cpp,
	  server/PersistantThingFactory.h, server/EntityFactory.h,
	  server/EntityFactory.cpp: Add World specialisation of Persistor
	  so that row in entity database is maintained, but not created.

	* common/Database.h: Ensure iterator has != as well as ==.

	* common/Database.cpp: Check that tuples have been returned
	  in response to a select.

	* server/Restoration.cpp, server/Restoration.h,
	  server/Restorer.cpp: Restoration code now iterates over the
	  contents of the database, but does not attempt to actually
	  restore it yet.
2002-12-21 21:28:20 +00:00
Al Riddoch
34a42f4a5b 2002-12-15 Al Riddoch <alriddoch@zepler.org>
* server/WorldRouter.cpp: Shuffle the way id is generated, so
	  its available for persistance.

	* server/EntityFactory.h, server/EntityFactory.cpp: Pass id
	  into entityfactory so it can be passed to database.
2002-12-15 03:22:33 +00:00
Al Riddoch
1db722f079 2002-12-15 Al Riddoch <alriddoch@zepler.org>
* server/server.cpp, server/WorldRouter.cpp,
	  server/EntityFactory.h, server/EntityFactory.cpp:
	  Change the way the EnitityFactory is created so it has a
	  reference to the world.

	* rulesets/Entity.h, rulesets/Entity.cpp: getLocation returns
	  whether an error occured setting location data.

	* common/Database.h, common/Database.cpp: Add stub functions
	  for generating queries to new format entity tables.

	* server/Persistor_impl.h, server/Persistor.h,
	  server/Persistor.cpp: Add hooks for syncing update to
	  database using new database functions.
2002-12-15 02:52:54 +00:00
Al Riddoch
6ee0168646 2002-12-06 Al Riddoch <alriddoch@zepler.org>
* server/PersistantThingFactory.h, server/PersistantThingFactory.cpp:
	  Work in progress on code to handle creating entities to be persisted.

	* server/WorldRouter.cpp: Get rid of hard tab.

	* rulesets/Thing.cpp: Clean up checks on new entities.

	* server/EntityFactory.cpp: Be stricter about entity classes which
	  aren't installed properlly. Add comments about implementing
	  persistance. Removed redundant handling of name attribute.
2002-12-10 01:25:18 +00:00
Al Riddoch
3a5390b5f8 2002-11-28 Al Riddoch <alriddoch@zepler.org>
* common/const.cpp, common/const.h, rulesets/Creator.cpp,
	  rulesets/Entity.cpp, rulesets/Entity.h, server/WorldRouter.cpp:
	  Re-work omnipresent flag so it can only work in a debug build,
	  and has no performance impact on the production code.
2002-11-28 18:26:45 +00:00
Al Riddoch
cb24511ec0 2002-11-25 Al Riddoch <alriddoch@zepler.org>
* common/Database.h, common/Database.cpp, server/Persistance.cpp:
	  Finish entity table creation code, and test it.

	* rulesets/Entity.cpp, rulesets/Entity.h, rulesets/EntityFactory.h,
	  rulesets/PythonThingScript.cpp, rulesets/PythonThingScript.h,
	  rulesets/Python_API.cpp, rulesets/Python_API.h,
	  rulesets/Thing.cpp, rulesets/Thing.h, server/EntityFactory.cpp,
	  server/EntityFactory.h, server/WorldRouter.cpp: Sort out
	  some incorrect use of Thing instead of Entity. Move some code
	  from Thing into Entity.
2002-11-25 22:48:13 +00:00
Al Riddoch
b89504d49c 2002-08-30 Al Riddoch <alriddoch@zepler.org>
* common/globals.cpp: Only persist this sessions command line
	  options if the user is overriding the installation directory.

	* cyphesis.vconf, client/Py_CreatorClient.cpp,
	  client/Py_CreatorClient.h, client/client.cpp:
	  Add client functionality to allow diferent scripts to be run to
	  perform different functions on the server.

	* client/CharacterClient.cpp: Add debug option.

	* rulesets/Character.h: Make mind operation functions virtual,
	  so they can be overridden.

	* common/BaseWorld.h, server/WorldRouter.cpp,
	  server/WorldRouter.h: Add server functions to search for
	  entities by name or type.

	* rulesets/Creator.h, rulesets/Creator.cpp: Allow creator to
	  specify a look without an id to search for entities with
	  a given name or type.

	* client/CreatorClient.cpp, client/CreatorClient.h,
	  client/ObserverClient.cpp, client/ObserverClient.h,
	  client/Py_CreatorClient.cpp, rulesets/basic/editor.py,
	  rulesets/mason/define_world.py:
	  Add support for looking for entities in the world by name or
	  type from client script, so client scripts can modify existing
	  world.

	* rulesets/Entity.cpp, rulesets/Movement.cpp,
	  rulesets/Py_Object.cpp, rulesets/Py_Operation.cpp,
	  rulesets/Py_Oplist.cpp, rulesets/Python_API.cpp,
	  rulesets/Stackable.cpp, rulesets/Thing.cpp,
	  rulesets/World.cpp, server/Account.cpp,
	  server/CommServer.cpp, server/Connection.cpp,
	  server/Player.cpp, server/ServerRouting.cpp,
	  server/server.cpp, tools/cycmd.cpp,
	  tools/cywatchdog.cpp: Code formatting cleanups.

	* rulesets/basic/world/objects/tools/Bow.py: Fix up bow so it now
	  fires correctly.
2002-08-30 13:48:39 +00:00
Al Riddoch
00199f8aa6 2002-07-27 Al Riddoch <alriddoch@zepler.org>
* tools/cyloadrules.cpp, server/server.cpp,
	  aiclient/ClientConnection.cpp, client/ClientConnection.cpp,
	  common/inheritance.h: Use const iterators and references
	  whenever possible.

	* client/CommClient.cpp, client/CreatorClient.cpp,
	  client/ObserverClient.cpp, client/Py_CreatorClient.cpp,
	  common/BaseEntity.cpp, common/BaseEntity.h,
	  common/types.h, rulesets/Area.cpp, rulesets/BaseMind.cpp,
	  rulesets/Character.cpp, rulesets/Entity.cpp,
	  rulesets/Food.cpp, rulesets/Line.cpp,
	  rulesets/MemMap.cpp, rulesets/Pedestrian.cpp,
	  rulesets/Plant.cpp, rulesets/Py_Mind.cpp,
	  rulesets/Py_Object.cpp, rulesets/Py_Thing.cpp,
	  rulesets/Python_API.cpp, rulesets/Stackable.cpp,
	  rulesets/Thing.cpp, rulesets/World.cpp,
	  server/Account.cpp, server/Admin.cpp, server/CommClient.cpp,
	  server/CommServer.cpp, server/Connection.cpp,
	  server/EntityFactory.cpp, server/Lobby.cpp,
	  server/Persistance.cpp, server/Player.cpp,
	  server/ServerRouting.cpp, server/WorldRouter.cpp:
	  Switch to using Fragment as name for Atlas::Message::Object,
	  to avoid name clashes on Object.

	* common/BaseEntity.h: Make BaseEntity inherit from SigC::Object,
	  so signals and callbacks can be used, and add destroyed
	  signal.

	* common/accountbase.h, physics/BBox.h, physics/Quaternion.h,
	  physics/Vector3D.h, rulesets/MemMap_methods.h,
	  rulesets/Movement.cpp, rulesets/Plant.h,
	  rulesets/Py_Operation.cpp, rulesets/PythonMindScript.cpp,
	  rulesets/PythonThingScript.cpp, rulesets/Script.cpp,
	  common/inheritance.cpp: Cleaned up Atlas::Message::Object
	  use, and excessive use of "using ...".

	* rulesets/Movement.h, rulesets/Pedestrian.h:
	  Use forward declarations rather than including Move.h

	* server/Account.cpp, server/Account.h, server/Connection.cpp,
	  server/Connection.h: Use destroyed signal to ensure references
	  to in game entities are removed when those entities are
	  destroyed. Ensure Connection is only destroyed once.
2002-07-28 13:34:58 +00:00
Al Riddoch
07a7543461 2002-07-14 Al Riddoch <alriddoch@zepler.org>
* ALL: Cleaned up headers into correct order.

	* common/log.h, common/log.cpp: Write some logging code which
	  handles message of different types using syslog or standard
	  error, depending on whether we are running as a daemon.

	* ALL: Switched to using log() for all output.
2002-07-14 21:04:50 +00:00
Al Riddoch
e4b05c4b8f 2002-06-08 Al Riddoch <alriddoch@zepler.org>
* common/const.h: Increase the sight range.

	* server/WorldRouter.cpp: Put in some warnings, as I want to
	  know when ops are getting broadcast.

	* server/server.cpp: Ensure stdout is not used when in daemon mode.

	* tools/cydbload.cpp: Rename the daftly named class WorldBase
	  to WorldAccessor.

	* mason.xml, cyphesis.vconf: Stop using the Acorn ruleset in Mason,
	  as it contains strange stuff, and remove the playable farmer
	  class from basic. Now games themselves define the only
	  playable types, and mason contains its own copies of classes
	  it has in common with acorn.
2002-06-08 00:56:25 +00:00
Al Riddoch
aa47340d59 2002-05-18 Al Riddoch <alriddoch@zepler.org>
* client/ObserverClient.cpp, server/Account.cpp, server/Connection.h,
	  server/Routing.h: Formatting cleanup

	* client/Py_CreatorClient.cpp, rulesets/Area.cpp, rulesets/Area.h,
	  rulesets/Character.cpp, rulesets/Character.h, rulesets/Entity.cpp,
	  rulesets/Entity.h, rulesets/Line.cpp, rulesets/Line.h,
	  rulesets/Plant.cpp, rulesets/Plant.h, rulesets/Py_Mind.cpp,
	  rulesets/Py_Thing.cpp, rulesets/Stackable.cpp, rulesets/Stackable.h:
	  Replace operator[] with get() method for querying attributes.
	  Make this get() method const, and re-write the internals so
	  that it more cleanly handles attributes.

	* common/BaseWorld.h: Re-write world.getObject() so that it
	  no longer uses std::map::operator[], as the old method was
	  inserting NULLs into the world dictionary when non-existant
	  entities were queried.

	* rulesets/Character.cpp: Clean up outstanding issues when movement
	  position is supplied, and is very close to being correct, and
	  clarify comments about movement when neither destination nor
	  source are provided.

	* rulesets/Character.cpp: Modify mind2body interface so that setting
	  the TO of ops is done in the individual handlers, and copying
	  the operation globally is avoided.

	* rulesets/MemMap_methods.h: Remove dodgy debug code.

	* rulesets/Pedestrian.cpp: Clarify movement fixme.

	* rulesets/Py_Operation.cpp: Clarify operation time handler fixme.

	* rulesets/Stackable.cpp: Clarify fixme's in combine and divide
	  handlers.

	* server/CommServer.cpp: Remove redundant fixme.

	* server/Connection.cpp, server/ServerRouting.cpp,
	  server/ServerRouting.h, server/ServerRouting_methods.h,
	  server/server.cpp:
	  Move inline ServerRouting::getObject into class header.

	* server/WorldRouter.cpp, server/WorldRouter.h:
	  Clean up  includes, and move updateTime into the main body of the
	  file. Clean up code formatting when handling maps and dictionaries.
	  Clarify error output and comments about NULL objects in the world
	  dictionary.
2002-05-18 18:09:14 +00:00
Al Riddoch
79e06ff18d 2002-05-15 Al Riddoch <alriddoch@zepler.org>
* server/WorldRouter.h, server/WorldRouter.cpp, common/BaseWorld.h,
	  rulesets/Creator.cpp, rulesets/World.cpp: Removed unused and
	  unnecessary code from BaseWorld class, and move some stuff into
	  the WorldRouter where it belongs.

	* rulesets/Character.cpp: Fixed a bug in the way ops from the
	  mind are handled which caused a segfault.

	* rulesets/Character.h, rulesets/Creator.h: Made some functions
	  which are never overridden non-virtual for speed.

	* rulesets/MemMap.cpp, rulesets/MemMap.h, rulesets/MemMap_methods.h:
	  Cleaned up the memmap code to get rid of inefficiency, and badly
	  written code.

	* rulesets/Movement.cpp: Code formatting cleanup.

	* server/Routing.h: Remove old commented out code.
2002-05-15 08:15:55 +00:00
Al Riddoch
49c0278508 2002-05-14 Al Riddoch <alriddoch@zepler.org>
* server/Account.cpp, server/Connection.cpp: Switched to using
	  USERNAME of accounts rather that ID for login and account creation.
	  Toughened up the connection code, so invalid login/create ops
	  are handled.

	* server/Connection.h: Removed unused getObject method.

	* rulesets/Character.cpp, rulesets/Character.h: Get rid of
	  inefficiency handling ops from internal and external mind. Fix
	  leak of some ops.

	* common/BaseWorld.h, server/WorldRouter.cpp, server/WorldRouter.h:
	  Add method for getting a new serialno.

	* rulesets/Thing.cpp, rulesets/Thing.h, server/WorldRouter.cpp:
	  Set refno on ops as they come back from entities. Set serialnos
	  on same ops at the same time, but do not set serialnos
	  on ops that come in from elsewhere, as those are now handled at
	  source.

	* rulesets/Creator.cpp, rulesets/Character.cpp:
	  Ensure that ops from external client preserve their serialno,
	  and assign new serialnos to other ops created at the same time.
2002-05-14 19:17:52 +00:00
Al Riddoch
4dcfac66b5 2002-05-10 Al Riddoch <alriddoch@zepler.org>
* modules/Location.cpp, modules/Location.h, physics/BBox.h,
	  physics/Vector3D.h, rulesets/Character.cpp, rulesets/Entity.cpp,
	  rulesets/MemMap.cpp, rulesets/Movement.cpp, rulesets/Pedestrian.cpp,
	  rulesets/Py_BBox.cpp, rulesets/Py_Location.cpp,
	  server/Account.cpp, server/WorldRouter.cpp:
	  Get rid of operator bool() in vector and related classes,
	  so that errors are less likely to emerge in code. Make use
	  of Vector3D::isZero() where apropriate.
2002-05-10 21:20:14 +00:00
Al Riddoch
5cf4f0491b 2002-03-19 Al Riddoch <alriddoch@zepler.org>
* server/WorldRouter.cpp, server/ServerRouting_methods.h,
	  server/ServerRouting.h, server/ServerRouting.cpp,
	  server/Routing.h, server/Routing.cpp, server/Connection.h,
	  server/Admin.cpp:
	  Removed inheritance from Routing by Connection and ServerRouting,
	  as there is almost no functionality in common. Get rid of global
	  idDict in ServerRouting is it serves little or no useful purpose.
	  IG objects are now managed in WorldRouter, and OOG objects in
	  ServerRouting.

	* common/BaseWorld.h: Made accessor method const, as it should be.
2002-03-19 09:26:40 +00:00
Al Riddoch
e491d6995a 2002-03-12 Al Riddoch <alriddoch@zepler.org>
* server/server.cpp, rulesets/Python_API.cpp, rulesets/Line.cpp,
	  modules/Location.cpp, client/CreatorClient.cpp:
	  Removed some obsolete comments.

	* server/WorldRouter.h, server/WorldRouter.cpp: Add member to
	  deliver operation to known entity. Make use if it to avoid
	  having to recurse in operation() when broadcasting. Ensure
	  that the container of new entities is managed from here.

	* rulesets/Thing.cpp: Tell world to create new entities at the
	  same position as the creator if no other info is provided.
	  Do not attempt to handle setting up the default containership
	  of entity once created, as this is always handled by the
	  WorldRouter from now on.

	* rulesets/Py_World.cpp: Implement getting time info from world.

	* rulesets/Py_Location.cpp: Implement handling of the orientation
	  attribute from python.

	* rulesets/MemMap.cpp: Update comments about unimplemented code.

	* rulesets/Creator.cpp: Check for string.empty() instead of "".

	* rulesets/BaseMind.cpp: Remove reference python code.
	  Cleanly handle and delete operations returned when savinf mind state.

	* client/CharacterClient.cpp: Move delete to the right place.
2002-03-12 18:08:56 +00:00
Al Riddoch
83c53f06c6 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
Al Riddoch
7f9cf3a053 2002-03-08 Al Riddoch <alriddoch@zepler.org>
* common/BaseEntity.cpp, common/BaseEntity.h, rulesets/Entity.h,
	  server/Connection.cpp: Remove destroy from the base class, and
	  make it non-virtual, as it is not used this way.

	* rulesets/Entity.cpp: Clean up destroy, ensuring that contains
	  is managed correctly.

	* server/WorldRouter.cpp: Eliminate duplicate contains management.
2002-03-08 22:52:18 +00:00
Al Riddoch
49691213c9 2002-03-08 Al Riddoch <alriddoch@zepler.org>
* Changed typedef names to ones which make more sense, and are
	  clearer. There is no change in functionality in this commit.
2002-03-08 14:58:40 +00:00
Al Riddoch
d4d586d470 2002-03-07 Al Riddoch <alriddoch@zepler.org>
* server/WorldRouter.h, server/WorldRouter.cpp, rulesets/Thing.cpp,
	  rulesets/Entity.h, rulesets/Entity.cpp, common/types.h,
	  common/BaseWorld.h: Switched to using sets instead of lists
	  for contains, and other data structore for performance.

	* rulesets/Line.cpp: Added debugging.

	* rulesets/MemMap.cpp, rulesets/MemMap.h, rulesets/MemMap_methods.h:
	  Switch to using vectors instead of lists for performance.
2002-03-07 16:02:43 +00:00
Al Riddoch
ec3e9fe029 2002-03-06 Al Riddoch <alriddoch@zepler.org>
* tools/cycmd.cpp, server/WorldRouter.cpp, server/EntityFactory.cpp,
	  server/Connection.cpp, server/Admin.cpp, server/Account.cpp,
	  rulesets/World.cpp, rulesets/Thing.cpp, rulesets/Py_Operation.cpp,
	  rulesets/MemMap_methods.h, rulesets/MemMap.cpp, rulesets/Entity.cpp,
	  rulesets/Character.cpp, rulesets/BaseMind.cpp:
	  Use empty() instead of size() == 0 for STL sequence types.

	* rulesets/ThingFactory.h, server/EntityFactory.cpp: Modified the
	  way adding classes to the inheritance tree is handled, so types
	  no longer have to inherit directly from a C++ class.

	* server/WorldRouter.cpp: Modified the way broadcast operations are
	  handled to make them more efficient, and catch NULL pointers in
	  the world dictionary.
2002-03-06 00:23:28 +00:00
Al Riddoch
de23b36445 2002-02-22 Al Riddoch <alriddoch@zepler.org>
* server/WorldRouter.h, server/WorldRouter.cpp, server/EntityFactory.h,
	  server/Account.h, server/Account.cpp, common/BaseWorld.h:
	  Clean up interface so that entities are passed around more simply.

	* server/EntityFactory.cpp:
	  Get rid of redundant code, and ensure that all classes, even
	  undefined ones, have a type info node.
2002-02-22 11:41:05 +00:00
Al Riddoch
c741fda28a 2002-01-27 Al Riddoch <alriddoch@zepler.org>
* common/Database.cpp, common/Database.h,
	  server/Persistance.cpp, server/Persistance.h:
	  Add a new table to store rulesets, so they can be persisted, and
	  edited online.  The new ruleset format integrates information
	  about the class hierarchy, scripting and default attributes.
	  Added low level method to fetch an entire database table as an
	  Atlas map.

	* tools/cyloadrules.cpp: New tool to load rulesets in new xml
	  format into database table.

	* server/EntityFactory.cpp, server/EntityFactory.h:
	  New re-written Entity Factory, to support new rules database
	  table, and better class definition capabilities.

	* rulesets/EntityFactory.cpp, rulesets/EntityFactory.h:
	  Removed from build.

	* client/CommClient.cpp: Redundant include removed.

	* rulesets/ThingFactory.h: Add storage to factory for script
	  info and default attributes.

	* server/WorldRouter.cpp: Switch to using new EntityFactory.

	* server/server.cpp: Removed old ruleset loading code, and now
	  simply load the ruleset names from the config file.

	* tools/cycmd.cpp: Exit correctly if connection fails.
2002-01-27 00:38:27 +00:00
Michael Koch
dfab12949c typo 2002-01-23 17:09:18 +00:00
Al Riddoch
4de50bb822 * Cleaned up auto* build files. Added more updated info to README.
* modules/Location.cpp: Removed redundant includes.

	* rulesets/mason/define_world.py: Drop in copy of Acorn world.

	* server/WorldRouter.cpp: Removed double delete of gameWorld.

	* server/server.cpp: Modified comments about segfault in Python
	  shutdown, as this has now been eliminated.

Al Riddoch  <alriddoch@zepler.org>
2001-11-10 15:20:58 +00:00
Al Riddoch
aa3f4f0db4 * common/BaseWorld.cpp, common/OOGThing.cpp, rulesets/Entity.cpp,
rulesets/EntityFactory.cpp, rulesets/MindFactory.cpp,
	  rulesets/Stackable.cpp, server/Account.cpp, server/Admin.cpp,
	  server/CommClient.h, server/CommServer.cpp, server/CommServer.h,
	  server/Connection.cpp, server/ExternalMind.cpp,
	  server/Persistance.cpp, server/Persistance.h,
	  server/ServerRouting.cpp, server/WorldRouter.cpp,
	  server/server.cpp: Removed unused includes and code. Added some
	  FIXMEs.

	* rulesets/Thing.cpp: Added TO and FROM to faked Sight(Create()) ops.

	* server/OOG_Thing.cpp, server/OOG_Thing.h: Marked files as removed.

Al Riddoch  <alriddoch@zepler.org>
2001-10-18 16:06:06 +00:00
Al Riddoch
c0af3c3c63 * aiclient/ClientConnection.cpp, aiclient/client.cpp,
client/ClientConnection.cpp, common/database.h, common/globals.cpp,
	  common/persistance.cpp, common/stringstream.h, server/CommClient.cpp,
	  server/CommServer.cpp, server/Persistance.cpp, tools/cyctrl.cpp,
	  tools/cyctrl.cpp, tools/cydbload.cpp, tools/cyisoload.cpp,
	  tools/cypasswd.cpp: Removed unused config.h.

	* client/ObserverClient.cpp, common/const.h, tools/cycmd.cpp:
	  Use default password if the admin account cannot be fetched from
	  the database.

	* client/Py_CreatorClient.cpp, common/BaseEntity.cpp,
	  common/BaseEntity.h, rulesets/Character.cpp, rulesets/Creator.cpp,
	  rulesets/Entity.cpp, rulesets/Entity.h, rulesets/EntityFactory.cpp,
	  rulesets/MemMap.cpp, rulesets/Py_Mind.cpp, rulesets/Py_Thing.cpp,
	  rulesets/Py_World.cpp, rulesets/Thing.cpp, server/Account.cpp,
	  server/Admin.cpp, server/Connection.cpp, tools/cywatchdog.cpp:
	  Make many of the member variables of Entity protected, and add
	  the required accessors. Changed the name of the id attribute
	  to m_id.

	* common/BaseWorld.h, common/database.cpp, common/persistance.cpp:
	  Removed unused includes.

	* common/Chop.h, common/Cut.h, common/Eat.h, common/Fire.h,
	  common/Generic.h, common/Load.h, common/Nourish.h, common/Save.h,
	  common/Setup.h, common/Tick.h: Moved definition of virtual
	  functions into cpp file, to reduce wasted code.

	* common/Makefile.am: Create cyphesis library, which can be used by
	  other applications to access cyphesis databases.

	* common/config.h, common/database.h, server/Persistance.cpp,
	  tools/cydbload.cpp, tools/cyisoload.cpp, tools/cypasswd.cpp:
	  Remove conditional compilation of db code. db3 is now required.

	* server/WorldRouter.h: Fixed getNewId() so it take const string.

	* server/server.cpp: Removed python shutdown, so it does not
	  mess up the db if it causes a segfault.

Al Riddoch  <alriddoch@zepler.org>
2001-10-17 14:09:42 +00:00
Al Riddoch
a44ee6f86d * BUGS: Note that C++ version of client currently does not work.
* TODO: Update on important issues which allow easy DOS attacks.

	* client/ClientConnection.cpp, client/ClientConnection.h:
	  Cleaned up unused code from ClientConnection class.

	* client/client.cpp: Removed monitoring section of client
	  so it simply exits once the world is initialised.

	* rulesets/basic/mind/goals/humanoid/werewolf.py:
	  Started work on dynamic goals for playing werewolf.

	* rulesets/werewolf/define_world.py: Added in the mayor, who runs
	  werewolf games.

	* common/BaseEntity.h: Made id of entity private, and implemented
	  accessors.

Al Riddoch  <alriddoch@zepler.org>
2001-09-13 15:21:16 +00:00
Al Riddoch
dcc3dfa85a * server/server.cpp, server/CommClient.h, client/ClientConnection.h,
tools/cycmd.cpp: Switched to using skstream library for socket
	  comms instead of hand rolled fstream based version.

	* ALL FILES: Fixed use of std namespace throughout all code.

This server is now ISO C++ compliand and builds with gcc 3.0.

Al Riddoch  <alriddoch@zepler.org>
2001-08-14 17:52:50 +00:00
Al Riddoch
73b210279c * client/client.cpp,
client/ObserverClient.cpp, client/ObserverClient.h,
	  client/ClientConnection.cpp, client/ClientConnection.h,
	  client/define_world.cpp, client define_world.h:
	  Started re-coding of python client code in C++.

	* common/accountbase.h:
	  Database class used for simply accessing accounts.

	* common/OOGThing.cpp, common/OOGThing.h, server/Account.h,
	  server/Routing.h:
	  Moved OOGThing class into common as it is not server specific.

	* common/BaseWorld.cpp, common/BaseWorld.h,
	  server/WorldRouter.cpp, server/WorldRouter.h,
	  rulesets/Entity.h, rulesets/Py_World.cpp,
	  rulesets/PythonThingScript.cpp, rulesets/Python_API.h,
	  rulesets/Thing.cpp, rulesets/Thing.h:
	  Added base class for WorldRouter so that code that previously
	  used WorldRouter now used the interface defined by this
	  new class. This means that the code in rulesets no longer
	  has dependencies on code in server, so can be used in the client.

	* server/ExternalMind.cpp, server/ExternalMind.h,
	  rulesets/Character.h, rulesets/Creator.cpp,
	  server/Account.cpp:
	  Moved ExternalMind class into server as it is server specific,
	  so that there is no dependancy on server in rulesets.

	* server/Persistance.cpp. server/Persistance.h,
	  server/Admin.cpp, server/ServerRouting.cpp, server/server.cpp:
	  Moved high level server specific persistance class into
	  server, so there is no dependency on server in common.

	* common/database.cpp, common/database.h, server/Admin.cpp,
	  tools/cydbload.cpp, tools/cyisoload.cpp, tools/cypasswd.cpp:
	  Increases efficiency of some interfaces by passing Object::MapType
	  instead of MapType, when the value must be a map.

	* modules/WorldTime.cpp, modules/WorldTime.h,
	  rulesets/Py_WorldTime.cpp, rulesets/Python_API.cpp:
	  Brought the version of WorldTime in modules up to date, as this is
	  the version now used.

	* rulesets/Character.cpp, server/WorldRouter.cpp, rulesets/Thing.cpp,
	  server/Admin.cpp:
	  Made world objects dictionary private.

	* rulesets/EntityFactory.cpp, rulesets/EntityFactory.h:
	  Change newThing parameters so entity factory does not need to
	  know about WorldRouter.

	* server/Lobby.cpp: Added support for people and rooms attributes
	  of OOG room class.

Al Riddoch  <alriddoch@zepler.org>
2001-08-13 17:22:27 +00:00
Al Riddoch
3969bffbfe * common/inheritance.cpp, common/inheritance.h: Added code to store
atlas object inheritance tree.

	* server/Connection.cpp: Added code to allow client to query
	  atlas object inheritance using get ops.

	* example/client/InheritanceClient.*: Added example client which
	  queries the inheritance tree of the server.

	* rulesets/MemMap.h, rulesets/Py_Map.cpp: Made hooks lists private,
	  and added methods to access them.

	* server/Account.cpp, server/Lobby.h: Added correct handling of OOG
	  look ops when looking at own characters, other accounts, or the
	  lobby.

	* server/ServerRouting.h: Added function to generate serial numbers
	  for operations.

	* server/WorldRouter.cpp: Assign genuine serial number to all
	  in game operations as they are pulled off the queue.

	* Cleaned up header file multiple inclusion checks for uniqueness,
	  and made sure of ISO compliant use of std::string.

Al Riddoch  <alriddoch@zepler.org>
2001-08-02 14:27:06 +00:00
Al Riddoch
bae6175e99 *** empty log message *** 2001-07-28 14:00:55 +00:00