Commit graph

303 commits

Author SHA1 Message Date
Alistair Riddoch
e0c92ebf39 Remove reference to BaseWorld in EntityBuilder 2011-09-21 12:45:18 +01:00
Manohar Vanga
f7d97fb7bd Entity injection works (code needs a lot of cleanup) 2010-08-17 11:56:09 +05:30
Manohar Vanga
3c4163099a Made some changes based on code reviews 2010-08-17 11:56:09 +05:30
Manohar Vanga
3a565afcd2 Added test for InterServerConnection. Extra debugging in WorldRouter::idle() 2010-08-17 11:56:09 +05:30
Alistair Riddoch
e3012c88be Refactor creating Arithmetic objects to de-couple properties from scripting 2010-07-13 16:23:46 +01:00
Alistair Riddoch
a84543bf32 Fix a crash bug caused by malformed name data. 2010-01-03 21:06:24 +00:00
Alistair Riddoch
238f5c629c Improve debut output. 2010-01-03 02:14:52 +00:00
Alistair Riddoch
a6ccd6d36d Support reconfiguring or replacing a spawn. 2010-01-03 00:44:10 +00:00
Alistair Riddoch
b11821bf9a Add some checks when spawning fails. 2009-12-30 15:09:26 +00:00
Alistair Riddoch
309905fedf Extend Spawn interface to support richer Atlas descriptions. 2009-12-30 11:29:12 +00:00
Alistair Riddoch
7660afe705 Modify the interface of the Spawn base class for postprocessing. 2009-12-30 11:12:33 +00:00
Alistair Riddoch
6c89ed0785 Modify spawn interface to give the spawn more control. 2009-12-30 10:01:49 +00:00
Alistair Riddoch
97bd67ea65 Write a bunch more code related to implementing spawn points. 2009-12-30 01:45:16 +00:00
Alistair Riddoch
94350f78bf Add another function to expose the available spawn points. 2009-12-29 19:11:31 +00:00
Alistair Riddoch
14e7754c69 Extend the interface for world to support spawns, and add stubs. 2009-12-29 17:48:34 +00:00
Alistair Riddoch
d52550a9e3 Rename Monitor class tree to Variable for clarity. 2009-09-03 00:38:50 +01:00
Alistair Riddoch
958babd997 Add new Variable files to the build, remove copied code, and fix up includes. 2009-09-03 00:27:59 +01:00
Alistair Riddoch
96e3049cfa Simplify and fix code that queries the mode of an entity. 2009-08-05 19:00:14 +01:00
Alistair Riddoch
209f6842bd Remove the old constraint functions. 2009-05-12 23:38:31 +01:00
Alistair Riddoch
335e162cb0 Use movement domain to do all height constraint requests. 2009-05-12 23:30:19 +01:00
Alistair Riddoch
cd1f42c3f9 Rename Inheritance class files to match class name. 2009-03-20 15:31:38 +00:00
Al Riddoch
84c1a94412 Rename files for EntityBuilder from EntityFactory to match the class rename. 2009-03-12 00:50:25 +00:00
Al Riddoch
351058f34c 2008-09-13 Al Riddoch <alriddoch@googlemail.com>
* data/basic.xml, data/characters.xml, data/mason.xml: Add tick
	  properties to a bunch of entity classes so they no longer need
	  a setup operation to get them going.

	* rulesets/mason/world/objects/Weather.py,
	  rulesets/mason/world/objects/elements/Fire.py,
	  rulesets/mason/world/objects/plants/seeds/Apple.py: Remove setup
	  handlers from a bunch of scripts as it is now handled by
	  properties.

	* data/buildings.xml: Add setup property to entity classes which
	  really need a setup op at startup.

	* client/BaseClient.cpp: Send a look when creating the avatar, so
	  that notifications get back without the need for a special case.

	* common/op_switch.h, rulesets/Creator.cpp, rulesets/Entity.cpp,
	  rulesets/Entity.h, server/WorldRouter.cpp:
	  Remove the setup operation sent to all entities on startup by
	  default. Get rid of some special cases that depended on it.

	* rulesets/InternalProperties.cpp, rulesets/InternalProperties.h:
	  Make the tick property schedule the operation on apply(), and
	  use the property value as the time to schedule it.
2008-09-13 18:02:08 +00:00
Al Riddoch
c5ad96fcbd 2008-09-03 Al Riddoch <alriddoch@googlemail.com>
* server/WorldRouter.cpp: Emit the updated signal when an entity
	  is destroyed and removed from the world, so that the store
	  can remove it.
2008-09-04 09:34:55 +00:00
Al Riddoch
d1695c9617 2008-09-01 Al Riddoch <alriddoch@googlemail.com>
* common/Monitors.cpp, common/Monitors.h: Add dynamic variable
	  monitor functionality, allowing arbitrary variables to appear
	  in the monitors output.

	* server/ServerRouting.cpp: Use the new monitor functionality for
	  variables prebviously pushed to monitors once.

	* server/WorldRouter.cpp, server/WorldRouter.h: Add a count of
	  in-game entities. Expose it to the monitors.
2008-09-01 16:14:42 +00:00
Al Riddoch
de4f241e4e 2008-08-29 Al Riddoch <alriddoch@googlemail.com>
* common/Monitors.cpp, common/Monitors.h: Add a new class to handle
	  storing key value pairs useful in monitoring the state of a server.

	* server/HttpCache.cpp, server/HttpCache.h: Add a function argument
	  to allow the content type to be controlled in the header.
	  Expose the Monitors class under /monitors URL.
2008-08-30 16:29:11 +00:00
Al Riddoch
34437a4a84 2008-08-17 Al Riddoch <alriddoch@googlemail.com>
* common/BaseWorld.h: Modify the addEntity() function so we no longer
	  need to specify whether it needs to be set up, as nowhere was ever
	  specifying.

	* server/WorldRouter.cpp, server/WorldRouter.h: Implement the modified
	  BaseWorld API, and ensure all entities are sent Setup operations
	  for now.

	* tests/TestWorld.h: Update test world so it implements the interface
	  correctly.
2008-08-17 21:17:35 +00:00
Al Riddoch
b9e5f8d79f 2008-08-17 Al Riddoch <alriddoch@googlemail.com>
* rulesets/LocatedEntity.h: Add onUpdated() virtual method to be
	  called when the attributes of an Entity are changed.

	* rulesets/Entity.cpp, rulesets/Entity.h, rulesets/LocatedEntity.cpp,
	  rulesets/Thing.cpp, server/WorldRouter.cpp: Implement onUpdated()
	  to emit the updated signal on Entity, and change all code to
	  call onUpdated instead of emiting the signal.
2008-08-16 23:21:06 +00:00
Al Riddoch
24aa46bc4d 2008-01-05 Al Riddoch <alriddoch@googlemail.com>
* rulesets/LocatedEntity.cpp, rulesets/LocatedEntity.h:
	  Don't allocated storage for m_contains by default, only
	  on demand. Add a convenience method which checks, and
	  allocates the storage if required. Set up the ID property
	  on this base class rather then Entity.

	* rulesets/Py_Thing.cpp: Remove special handling of ID attribute
	  as it is now handled by the property.

	* rulesets/Character.cpp, rulesets/Entity.cpp, rulesets/MemMap.cpp,
	  rulesets/Motion.cpp, rulesets/Py_Mind.cpp, rulesets/Py_Thing.cpp,
	  rulesets/Thing.cpp, rulesets/World.cpp, server/WorldRouter.cpp:
	  Make sure all parts of the code where contains is used have
	  the right checks, as it could be null.
2008-01-05 14:05:05 +00:00
Al Riddoch
41bed0431b 2007-12-31 Al Riddoch <alriddoch@googlemail.com>
* rulesets/Character.cpp, rulesets/Entity.cpp,
	  rulesets/LocatedEntity.cpp, rulesets/LocatedEntity.h,
	  rulesets/MemMap.cpp, rulesets/Motion.cpp, rulesets/Py_Mind.cpp,
	  rulesets/Py_Thing.cpp, rulesets/Thing.cpp, rulesets/World.cpp,
	  server/WorldRouter.cpp: Change LocatedEntity::m_contains into
	  a pointer so that the majority of entities that can not contain
	  anything don't waste the storage.
2007-12-31 17:39:25 +00:00
Al Riddoch
6da7ff7592 2007-12-27 Al Riddoch <alriddoch@zepler.org>
* common/TypeNode.h, common/TypeNode.cpp: Move TypeNode into
	  its own files.

	* common/Makefile.am, common/inheritance.cpp, common/inheritance.h:
	  Add the new files to the build and remove the old implementation.

	* client/Py_CreatorClient.cpp, rulesets/Character.cpp,
	  rulesets/Entity.cpp, rulesets/MemMap.cpp,
	  rulesets/MindFactory.cpp, rulesets/Py_Mind.cpp,
	  rulesets/Py_Thing.cpp, rulesets/Stackable.cpp,
	  server/WorldRouter.cpp: Fix up the includes for all code that
	  uses TypeNode.
2007-12-27 03:31:47 +00:00
Al Riddoch
3a2bc079e9 2007-12-20 Al Riddoch <alriddoch@zepler.org>
* server/EntityFactory.cpp, server/EntityFactory.h, server/Admin.cpp,
	  server/PersistantThingFactory.cpp, server/WorldRouter.cpp,
	  server/server.cpp: Rename EntityFactory to EntityBuilder, to make
	  it's function clearer.
2007-12-20 19:27:12 +00:00
Al Riddoch
8e8df5b482 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
Al Riddoch
954519c828 2007-12-02 Al Riddoch <alriddoch@zepler.org>
* server/WorldRouter.cpp: Add some checks to make sure the world
	  state is consistent.
2007-12-02 18:30:18 +00:00
Al Riddoch
bd3a9e153c 2007-11-28 Al Riddoch <alriddoch@zepler.org>
* client/BaseClient.cpp, client/CharacterClient.cpp,
	  client/CharacterClient.h, client/CreatorClient.cpp,
	  client/CreatorClient.h, rulesets/BaseMind.cpp, rulesets/BaseMind.h,
	  rulesets/Character.cpp, rulesets/Entity.cpp, rulesets/Entity.h,
	  rulesets/MindFactory.cpp, rulesets/MindFactory.h, rulesets/Thing.cpp,
	  rulesets/World.cpp, server/Account.cpp, server/Connection.cpp,
	  server/EntityFactory.cpp, server/Persistor.cpp,
	  server/Persistor_impl.h, server/Restorer_impl.h,
	  server/WorldRouter.cpp: Remove the hard name attribute, now that
	  most entities don't set it.
2007-11-28 20:22:42 +00:00
Al Riddoch
72020dfa61 2007-11-28 Al Riddoch <alriddoch@zepler.org>
* rulesets/Entity.h: Remove an old experimental type class, and clean
	  up includes.

	* client/Py_CreatorClient.cpp, rulesets/MemMap.cpp,
	  rulesets/MindFactory.cpp, rulesets/Py_Mind.cpp,
	  rulesets/Py_Thing.cpp, rulesets/Stackable.cpp,
	  server/WorldRouter.cpp: Add necessary includes.
2007-11-28 10:56:59 +00:00
Al Riddoch
12e5d50b5b 2007-11-26 Al Riddoch <alriddoch@zepler.org>
* common/inheritance.cpp, common/inheritance.h: Introduce a type
	  node class as a carrier for all information, including default
	  values for a type.

	* rulesets/Entity.h, rulesets/Entity.cpp, rulesets/Character.cpp:
	  Use a TypeNode pointer rather than a string giving the type
	  of an entity.

	* client/Py_CreatorClient.cpp, rulesets/MemMap.cpp, rulesets/MemMap.h,
	  rulesets/MindFactory.cpp, rulesets/MindFactory.h,
	  rulesets/Py_Mind.cpp, rulesets/Py_Thing.cpp, rulesets/Stackable.cpp,
	  rulesets/World.cpp, server/PersistantThingFactory.h,
	  server/Restorer_impl.h, server/WorldRouter.cpp:
	  Adapt all the code that deals with types. Set the type pointer
	  up correctly in BaseMind.

	* server/EntityFactory.cpp: Initialise the TypeNode pointer on new
	  entities.

	* tests/inheritancetest.cpp: Adapt the test to cope with TypeNode.
2007-11-26 02:57:04 +00:00
Al Riddoch
87ecdcad4b 2007-07-30 Al Riddoch <alriddoch@zepler.org>
* client/Py_CreatorClient.cpp, common/Database.cpp,
	  common/accountbase.cpp, common/system.cpp, rulesets/Character.cpp,
	  rulesets/Motion.cpp, rulesets/Plant.cpp, rulesets/Py_Location.cpp,
	  rulesets/Py_Mind.cpp, rulesets/Py_Operation.cpp,
	  rulesets/Py_Point3D.cpp, rulesets/Py_Statistics.cpp,
	  rulesets/Py_Task.cpp, rulesets/Py_TerrainProperty.cpp,
	  rulesets/Py_Thing.cpp, rulesets/Py_Vector3D.cpp,
	  rulesets/Py_WorldTime.cpp, rulesets/Python_API.cpp,
	  rulesets/TerrainProperty.cpp, server/Admin.cpp,
	  server/CommServer.cpp, server/Connection.cpp,
	  server/EntityFactory.cpp, server/WorldRouter.cpp,
	  tools/cycmd.cpp, tools/cyconvertrules.cpp, tools/cyctrl.cpp:
	  Remove unnecessary () from conditional expressions, where operator
	  binding is clear.
2007-07-30 18:12:50 +00:00
Al Riddoch
2069f3dd4c 2007-07-29 Al Riddoch <alriddoch@zepler.org>
* common/log.cpp, common/log.h: Switch to taking a C++ string reference
	  rather than a char *, as it is not really an optimisation, and it
	  makes the code simpler to read and write.

	* client/BaseClient.cpp, client/ClientConnection.cpp,
	  common/AtlasFileLoader.cpp, common/BaseEntity.cpp,
	  common/Database.cpp, common/globals.cpp, common/id.cpp,
	  common/inheritance.cpp, common/log.cpp, common/log.h,
	  rulesets/Character.cpp, rulesets/Creator.cpp, rulesets/Entity.cpp,
	  rulesets/MemMap.cpp, rulesets/Motion.cpp, rulesets/Pedestrian.cpp,
	  rulesets/Py_Object.cpp, rulesets/Py_RootEntity.cpp,
	  rulesets/PythonMindScript.cpp, rulesets/PythonThingScript.cpp,
	  rulesets/Python_API.cpp, rulesets/Thing.cpp, server/Account.cpp,
	  server/Admin.cpp, server/ArithmeticFactory.cpp,
	  server/CommClient.cpp, server/CommListener.cpp,
	  server/CommMDNSPublisher.cpp, server/CommServer.cpp,
	  server/Connection.cpp, server/EntityFactory.cpp,
	  server/Persistance.cpp, server/Restoration.cpp,
	  server/ScriptFactory.cpp, server/TaskFactory.cpp,
	  server/WorldRouter.cpp, server/server.cpp: Convert over to using
	  new API correctly.

	* data/mason.xml: Add biomass and transient to fircone, making its
	  script obsolete:
2007-07-29 03:33:33 +00:00
Al Riddoch
23851b3fd0 2007-01-01 Al Riddoch <alriddoch@zepler.org>
* rulesets/Character.cpp, rulesets/Creator.cpp, rulesets/Entity.cpp,
	  rulesets/Entity.h, rulesets/Pedestrian.cpp, rulesets/Py_Thing.cpp,
	  rulesets/Stackable.cpp, rulesets/Thing.cpp, rulesets/World.cpp:
	  Remove m_world member variable from all Entity classes, and
	  access the world manager object as a singleton.
2007-01-01 17:57:06 +00:00
Al Riddoch
65bd6125d5 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
Al Riddoch
02cf540c09 2006-12-10 Al Riddoch <alriddoch@zepler.org>
* rulesets/Entity.cpp, rulesets/Entity.h, rulesets/Task.h,
	  rulesets/TerrainProperty.cpp, rulesets/TerrainProperty.h,
	  rulesets/Thing.cpp, rulesets/World.cpp, server/TrustedConnection.cpp,
	  server/WorldRouter.cpp: Add inline documentation.
2006-12-10 17:53:52 +00:00
Al Riddoch
2f9f247d28 2006-11-01 Al Riddoch <alriddoch@zepler.org>
* server/CommListener.cpp, server/CommPeerListener.cpp,
	  server/CommUnixListener.cpp:
	  Use closesocket to close sockets, so that it works on systems
	  which do not use the same namespace for files and sockets.
	  Use typedefs provided by skstream to ensure platform neutral
	  handling of socket related types. Disable code that stores
	  presentation version of client address on systems which don't
	  have inet_ntop.

	* server/CommServer.cpp: Use skstream to get the right header
	  for select system call, and use skstream typedefs.

	* server/WorldRouter.cpp: Use common/system.h to get getimeofday
	  on systems which don't provide it.
2006-11-02 05:14:54 +00:00
Al Riddoch
9a56dac06c 2006-10-26 Al Riddoch <alriddoch@zepler.org>
* Add RCS Id keywords to every file, for better version tracking.
2006-10-26 00:48:00 +00:00
Al Riddoch
294c781dc7 2006-08-02 Al Riddoch <alriddoch@zepler.org>
* common/Use.h, common/Wield.h, common/Generic.h: Mark unused files
	  as removed from the build.

	* common/Attack.h, common/Burn.h, common/Chop.h, common/Connect.h,
	  common/Cut.h, common/Delve.h, common/Dig.h, common/Drop.h,
	  common/Eat.h, common/Monitor.h, common/Mow.h, common/Nourish.h,
	  common/Pickup.h, common/Setup.h, common/Tick.h, common/Unseen.h,
	  common/Update.h: Add class documentation to all the custom
	  properties.

	* common/DynamicProperty.h, client/ClientPropertyManager.h,
	  server/CorePropertyManager.h, server/PersistantThingFactory.h,
	  server/ScriptFactory.h, server/WorldRouter.cpp: Add documentation
	  to some places where it is missing.
2006-08-02 11:27:15 +00:00
Al Riddoch
e5d6d37be4 2006-07-19 Al Riddoch <alriddoch@zepler.org>
* rulesets/Thing.cpp, server/WorldRouter.cpp: Remove broadcasting
	  an appearance from Setup handlers, and put it WorldRouter when
	  the entity is added to the world, to take out the special case
	  from the Setup operation handler.
2006-07-20 23:02:39 +00:00
Al Riddoch
5dea86304c 2006-07-11 Al Riddoch <alriddoch@zepler.org>
* server/WorldRouter.cpp: Use the flag check to see if TO is set on
	  an operation, rather than checking if TO is empty.
2006-07-11 14:33:30 +00:00
Al Riddoch
b0803d1cba 2006-07-08 Al Riddoch <alriddoch@zepler.org>
* server/WorldRouter.cpp: Use class number to check for delete ops.
2006-07-08 23:05:18 +00:00
Al Riddoch
01a095803f 2006-07-08 Al Riddoch <alriddoch@zepler.org>
* server/WorldRouter.cpp, server/WorldRouter.h: Remove now obsolete
	  object list.
2006-07-08 22:53:47 +00:00
Al Riddoch
9543fc17a3 2006-07-08 Al Riddoch <alriddoch@zepler.org>
* server/WorldRouter.h, server/WorldRouter.cpp: Re-write the way
	  broadcasts are handled, so the code is cleaner, and non
	  perception operations are properlly broadcast without the
	  need to store an explicit list of all entities in the world.
2006-07-08 22:36:31 +00:00